1
0
Эх сурвалжийг харах

fix: invalid block when adding existing pages to library

Tienson Qin 4 сар өмнө
parent
commit
f830bccadf

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

@@ -866,12 +866,12 @@
                    :block/order block-order}
                    (not (ldb/page? block))
                    (assoc :block/page target-page))]
-        children-page-tx (when not-same-page?
+        children-page-tx (when (and not-same-page? (not (ldb/page? block)))
                            (let [children-ids (ldb/get-block-full-children-ids db (:block/uuid block))]
                              (keep (fn [id]
                                      (let [child (d/entity db id)]
                                        (when-not (ldb/page? child)
-                                         {:block/uuid id
+                                         {:block/uuid (:block/uuid child)
                                           :block/page target-page}))) children-ids)))
         target-from-property (:logseq.property/created-from-property target-block)
         block-from-property (:logseq.property/created-from-property block)

+ 2 - 2
src/main/frontend/components/library.cljs

@@ -43,8 +43,8 @@
                                            ldb/sort-by-order
                                            last)
                            target (or last-child library-page)
-                           sibling? (some? last-child)]
-                       (editor-handler/move-blocks! [{:db/id chosen}] target sibling?)
+                           chosen-block (db/entity chosen)]
+                       (editor-handler/move-blocks! [chosen-block] target (if last-child true false))
                        (set-selected-choices! (conj selected-choices chosen)))
                      (do
                        (db/transact! (state/get-current-repo)