فهرست منبع

fix: move blocks

Tienson Qin 3 سال پیش
والد
کامیت
5f21e2d07e

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

@@ -623,7 +623,9 @@
                                      (let [children-ids (mapcat #(db/get-block-children-ids (state/get-current-repo) (:block/uuid %)) blocks)]
                                        (map (fn [uuid] {:block/uuid uuid
                                                         :block/page target-page}) children-ids)))
-                  fix-non-consecutive-tx (fix-non-consecutive-blocks blocks target-block sibling?)
+                  fix-non-consecutive-tx (->> (fix-non-consecutive-blocks blocks target-block sibling?)
+                                              (remove (fn [b]
+                                                        (contains? (set (map :db/id move-blocks-next-tx)) (:db/id b)))))
                   full-tx (util/concat-without-nil tx-data move-blocks-next-tx children-page-tx fix-non-consecutive-tx)
                   tx-meta (cond-> {:move-blocks (mapv :db/id blocks)
                                    :target (:db/id target-block)}

+ 1 - 0
src/main/frontend/modules/outliner/datascript.cljc

@@ -55,6 +55,7 @@
                               m)) txs)]
        (when (and (seq txs)
                   (not (:skip-transact? opts)))
+         ;; (frontend.util/pprint txs)
          (try
            (let [repo (get opts :repo (state/get-current-repo))
                  conn (conn/get-db repo false)

+ 1 - 1
src/test/frontend/modules/outliner/core_test.cljs

@@ -412,7 +412,7 @@
           (outliner-tx/transact! {:graph test-db}
             (outliner-core/delete-blocks! blocks {})))))))
 
-#_(deftest ^:long random-moves
+(deftest ^:long random-moves
   (testing "Random moves"
     (transact-random-tree!)
     (let [c1 (get-blocks-count)