fix: separate saving current block from other outliner op's tx

pull/8350/head
Tienson Qin 2023-01-13 15:04:23 +08:00
parent e7a5119ce5
commit ccb5628f3c
1 changed files with 5 additions and 6 deletions

View File

@ -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)