Browse Source

fix: blocks in Library pages have incorrect page relationship

fixed https://github.com/logseq/db-test/issues/394
Tienson Qin 4 months ago
parent
commit
9ed4cdc34d

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

@@ -524,6 +524,8 @@
 (defn- get-target-block-page
   [target-block]
   (or
+   (when (ldb/page? target-block)
+     (:db/id target-block))
    (:db/id (:block/page target-block))
    ;; target parent is a page
    (when-let [parent (:block/parent target-block)]

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

@@ -330,10 +330,14 @@
                                       (:custom-query? config))
                                   (not (:ref-query-child? config)))
         has-children? (db/has-children? (:block/uuid current-block))
+        library? (:library? config)
         sibling? (cond
                    ref-query-top-block?
                    false
 
+                   (and library? (ldb/page? current-block))
+                   true
+
                    (boolean? sibling?)
                    sibling?
 
@@ -342,7 +346,6 @@
 
                    :else
                    (not has-children?))
-        library? (:library? config)
         new-block' (if library?
                      (-> new-block
                          (-> (assoc :block/tags #{:logseq.class/Page}