fix: redo

pull/11049/head
Tienson Qin 2024-02-23 19:42:13 +08:00
parent 674c787f46
commit 8b9c3e249e
2 changed files with 6 additions and 7 deletions

View File

@ -36,10 +36,12 @@
(defn will-unmount
[state]
(let [{:keys [value block] :as state} (editor-handler/get-state)]
(let [{:keys [value block] :as state} (editor-handler/get-state)
editor-op (state/get-editor-op)]
(editor-handler/clear-when-saved!)
(state/set-editor-op! nil)
(when (db/entity [:block/uuid (:block/uuid block)]) ; block still exists
(when-not (or (contains? #{:undo :redo} (state/get-editor-op))
(when-not (or (contains? #{:undo :redo} editor-op)
(state/editor-in-composition?))
(editor-handler/save-block! state value))))
state)

View File

@ -158,8 +158,7 @@
(when (= :rename-page (:outliner-op tx-meta))
(when-let [old-page (:old-name (:data tx-meta))]
(route-handler/redirect-to-page! old-page)))
(util/schedule #(state/set-editor-op! nil)))
(route-handler/redirect-to-page! old-page))))
(assoc e
:txs-op new-txs
:editor-cursor editor-cursor))))
@ -180,9 +179,7 @@
(when (= :rename-page (:outliner-op tx-meta))
(when-let [new-page (:new-name (:data tx-meta))]
(route-handler/redirect-to-page! new-page)))
(util/schedule #(state/set-editor-op! :nil)))
(route-handler/redirect-to-page! new-page))))
(assoc e
:txs-op new-txs