瀏覽代碼

fix: outliner bug

Tienson Qin 1 年之前
父節點
當前提交
2a79b44725

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

@@ -1761,8 +1761,8 @@
           move-nodes (fn [blocks]
                        (let [blocks' (block-handler/get-top-level-blocks blocks)]
                          (ui-outliner-tx/transact!
-                         {:outliner-op :move-blocks}
-                         (outliner-core/move-blocks-up-down! (state/get-current-repo) (db/get-db false) blocks' up?)))
+                          {:outliner-op :move-blocks}
+                          (outliner-core/move-blocks-up-down! (state/get-current-repo) (db/get-db false) blocks' up?)))
                        (when-let [block-node (util/get-first-block-by-id (:block/uuid (first blocks)))]
                          (.scrollIntoView block-node #js {:behavior "smooth" :block "nearest"})))]
       (if edit-block-id

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

@@ -947,7 +947,6 @@
   [:pre [(seq blocks)
          (s/valid? ::block-map-or-entity target-block)]]
   (let [db @conn
-        blocks (map (fn [b] (d/entity db [:block/uuid (:block/uuid b)])) blocks)
         [target-block sibling?] (get-target-block db blocks target-block opts)
         non-consecutive-blocks? (seq (ldb/get-non-consecutive-blocks db blocks))
         original-position? (move-to-original-position? blocks target-block sibling? non-consecutive-blocks?)]

+ 4 - 0
src/main/frontend/modules/outliner/datascript.cljs

@@ -96,6 +96,10 @@
               (distinct))]
     (when (and (seq txs)
                (or db-based? (not unlinked-graph?)))
+
+      ;; (prn :debug "DB transact")
+      ;; (cljs.pprint/pprint txs)
+
       (try
         (let [tx-report (d/transact! conn txs (assoc tx-meta :outliner/transact? true))]
           (when (fn? after-transact-fn) (after-transact-fn tx-report opts))