From ccb5628f3cc44c075ae0abdc01709a27f233b5c1 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Fri, 13 Jan 2023 15:04:23 +0800 Subject: [PATCH] fix: separate saving current block from other outliner op's tx --- src/main/frontend/handler/editor.cljs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 0f856676b..ced39b634 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -1660,11 +1660,11 @@ [up?] (fn [event] (util/stop event) + (save-current-block!) (let [edit-block-id (:block/uuid (state/get-edit-block)) move-nodes (fn [blocks] (outliner-tx/transact! {:outliner-op :move-blocks} - (save-current-block!) (outliner-core/move-blocks-up-down! blocks up?)) (when-let [block-node (util/get-first-block-by-id (:block/uuid (first blocks)))] (.scrollIntoView block-node #js {:behavior "smooth" :block "nearest"})))] @@ -2076,10 +2076,10 @@ :else true)] + (save-current-block!) (outliner-tx/transact! {:outliner-op :insert-blocks :created-from-journal-template? journal?} - (save-current-block!) (let [result (outliner-core/insert-blocks! blocks' target (assoc opts @@ -2139,10 +2139,10 @@ [node] (when-not (parent-is-page? node) (let [parent-node (tree/-get-parent node)] + (save-current-block!) (outliner-tx/transact! {:outliner-op :move-blocks :real-outliner-op :indent-outdent} - (save-current-block!) (outliner-core/move-blocks! [(:data node)] (:data parent-node) true))))) (defn- last-top-level-child? @@ -2666,6 +2666,7 @@ (defn indent-outdent [indent?] + (save-current-block!) (state/set-editor-op! :indent-outdent) (let [pos (some-> (state/get-input) cursor/pos) {:keys [block]} (get-state)] @@ -2674,14 +2675,12 @@ (outliner-tx/transact! {:outliner-op :move-blocks :real-outliner-op :indent-outdent} - (save-current-block!) - (outliner-core/indent-outdent-blocks! [block] indent?))) + (outliner-core/indent-outdent-blocks! [block] indent?))) (state/set-editor-op! :nil))) (defn keydown-tab-handler [direction] (fn [e] - (save-current-block!) (cond (state/editing?) (when-not (state/get-editor-action)