mirror of https://github.com/logseq/logseq
fix(editor): incorrect auto save when paste batch blocks
parent
6fab02581d
commit
ea196dfe67
|
@ -2017,6 +2017,7 @@
|
||||||
keep-uuid?
|
keep-uuid?
|
||||||
revert-cut-txs]
|
revert-cut-txs]
|
||||||
:or {exclude-properties []}}]
|
:or {exclude-properties []}}]
|
||||||
|
(state/set-editor-op! :paste-blocks)
|
||||||
(let [editing-block (when-let [editing-block (state/get-edit-block)]
|
(let [editing-block (when-let [editing-block (state/get-edit-block)]
|
||||||
(some-> (db/pull [:block/uuid (:block/uuid editing-block)])
|
(some-> (db/pull [:block/uuid (:block/uuid editing-block)])
|
||||||
(assoc :block/content (state/get-edit-content))))
|
(assoc :block/content (state/get-edit-content))))
|
||||||
|
@ -2068,7 +2069,8 @@
|
||||||
:replace-empty-target? replace-empty-target?
|
:replace-empty-target? replace-empty-target?
|
||||||
:keep-uuid? keep-uuid?})]
|
:keep-uuid? keep-uuid?})]
|
||||||
(state/set-block-op-type! nil)
|
(state/set-block-op-type! nil)
|
||||||
(edit-last-block-after-inserted! result))))))
|
(edit-last-block-after-inserted! result)))))
|
||||||
|
(state/set-editor-op! nil))
|
||||||
|
|
||||||
(defn- block-tree->blocks
|
(defn- block-tree->blocks
|
||||||
"keep-uuid? - maintain the existing :uuid in tree vec"
|
"keep-uuid? - maintain the existing :uuid in tree vec"
|
||||||
|
|
|
@ -39,7 +39,7 @@
|
||||||
(when (and
|
(when (and
|
||||||
(not (contains? #{:insert :indent-outdent :auto-save :undo :redo :delete} (state/get-editor-op)))
|
(not (contains? #{:insert :indent-outdent :auto-save :undo :redo :delete} (state/get-editor-op)))
|
||||||
;; Don't trigger auto-save if the latest op is undo or redo
|
;; Don't trigger auto-save if the latest op is undo or redo
|
||||||
(not (contains? #{:undo :redo} (state/get-editor-latest-op))))
|
(not (contains? #{:undo :redo :paste-blocks} (state/get-editor-latest-op))))
|
||||||
(editor-handler/save-block! (get-state) value)))
|
(editor-handler/save-block! (get-state) value)))
|
||||||
state)
|
state)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue