fix: only restore last editor's position if it's the same block

This commit is contained in:
Tienson Qin
2022-04-21 20:41:38 +08:00
parent dd92e10b96
commit 4eec369740
3 changed files with 12 additions and 9 deletions

View File

@@ -868,6 +868,8 @@
([edit-input-id content block cursor-range]
(set-editing! edit-input-id content block cursor-range true))
([edit-input-id content block cursor-range move-cursor?]
(when-let [editing-block (get-edit-block)]
(swap! state assoc :editor/last-edit-block editing-block))
(when (and edit-input-id block
(or
(publishing-enable-editing?)
@@ -886,7 +888,6 @@
(assoc
:editor/block block
:editor/editing? {edit-input-id true}
:editor/last-edit-block block
:editor/last-key-code nil
:cursor-range cursor-range))))
(when-let [input (gdom/getElement edit-input-id)]