فهرست منبع

fix: enter to create a tagged block

Tienson Qin 1 سال پیش
والد
کامیت
b7f8a5eef8
2فایلهای تغییر یافته به همراه15 افزوده شده و 3 حذف شده
  1. 14 2
      deps/outliner/src/logseq/outliner/core.cljs
  2. 1 1
      src/main/frontend/handler/editor.cljs

+ 14 - 2
deps/outliner/src/logseq/outliner/core.cljs

@@ -241,12 +241,21 @@
                        (gp-block/extract-refs-from-text repo db content date-formatter))]
     (concat property-refs content-refs
             (when (sqlite-util/db-based-graph? repo)
-              (:block/tags block)))))
+              (map (fn [t]
+                     (cond
+                       (de/entity? t)
+                       (:db/id t)
+                       (and (vector? t) (= (count t) 2) (= :block/uuid (first t)))
+                       [:block/uuid (second t)]
+                       (map? t)
+                       [:block/uuid (:block/uuid t)]))
+                (:block/tags block))))))
 
 (defn- rebuild-refs
   [repo conn date-formatter txs-state block m]
   (when (sqlite-util/db-based-graph? repo)
-    (let [refs (->> (rebuild-block-refs repo conn date-formatter block (:block/properties block))
+    (let [refs' (rebuild-block-refs repo conn date-formatter block (:block/properties block))
+          refs (->> refs'
                     (concat (:block/refs m))
                     (remove nil?))
           add-tag-type (map
@@ -258,6 +267,9 @@
                             (and (vector? t) (= (count t) 2) (= :block/uuid (first t)))
                             {:block/uuid (second t)
                              :block/type "class"}
+                            (map? t)
+                            {:block/uuid (:block/uuid t)
+                             :block/type "class"}
                             :else
                             (throw (js/Error. (str "Wrong tag: " t)))))
                         (:block/tags m))]

+ 1 - 1
src/main/frontend/handler/editor.cljs

@@ -1267,7 +1267,7 @@
                 (ui-outliner-tx/transact!
                  opts
                  (outliner-save-block! {:db/id (:db/id block)
-                                             :block/tags tag-pages})))))
+                                        :block/tags tag-pages})))))
           (save-block-if-changed! block value opts))))))
 
 (defn save-block!