fix: save code block resets cursor position

close #7816
This commit is contained in:
Tienson Qin
2022-12-31 23:00:59 +08:00
parent 6fa862a954
commit f5e37091dd

View File

@@ -261,13 +261,10 @@
:did-update (fn [state]
(reset! (:code-options state) (last (:rum/args state)))
(when-not (:file? (first (:rum/args state)))
(->> state
:rum/args
last
:lines
butlast
(string/join "")
(.setValue @(:editor-atom state))))
(let [code (nth (:rum/args state) 3)
editor @(:editor-atom state)]
(when (not= (.getValue editor) code)
(.setValue editor code))))
state)}
[state _config id attr code _theme _options]
[:div.extensions__code