Browse Source

fix: move target block could be a page

Tienson Qin 3 years ago
parent
commit
e992e627ab
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/main/frontend/modules/outliner/core.cljs

+ 4 - 1
src/main/frontend/modules/outliner/core.cljs

@@ -449,9 +449,11 @@
         move? (contains? #{:move-blocks :move-blocks-up-down :indent-outdent-blocks} outliner-op)
         keep-uuid? (if move? true keep-uuid?)
         replace-empty-target? (if (and (some? replace-empty-target?)
+                                       (:block/content target-block')
                                        (string/blank? (:block/content target-block')))
                                 replace-empty-target?
                                 (and sibling?
+                                     (:block/content target-block')
                                      (string/blank? (:block/content target-block'))
                                      (> (count blocks) 1)
                                      (not move?)))
@@ -587,7 +589,8 @@
                                                                     :outliner-op (or outliner-op :move-blocks)})]
           (when (seq tx-data)
             (let [first-block-page (:db/id (:block/page first-block))
-                  target-page (:db/id (:block/page target-block))
+                  target-page (or (:db/id (:block/page target-block))
+                                  (:db/id target-block))
                   not-same-page? (not= first-block-page target-page)
                   move-blocks-next-tx [(build-move-blocks-next-tx blocks)]
                   children-page-tx (when not-same-page?