fix: restore the editing cursor after saving a block

pull/852/head
Tienson Qin 2020-12-07 21:35:14 +08:00
parent 1dfd7958d4
commit 1b20c3e214
1 changed files with 5 additions and 1 deletions

View File

@ -1353,7 +1353,11 @@
(when (and block value db-content-without-heading (when (and block value db-content-without-heading
(not= (string/trim db-content-without-heading) (not= (string/trim db-content-without-heading)
(string/trim value))) (string/trim value)))
(save-block-aux! block value (:block/format block))))))) (let [cur-pos (util/get-input-pos elem)]
(save-block-aux! block value (:block/format block))
;; Restore the cursor after saving the block
(when (and elem cur-pos)
(util/set-caret-pos! elem cur-pos))))))))
(defn on-up-down (defn on-up-down
[state e up?] [state e up?]