fix: code block issue

Close #2000
This commit is contained in:
Tienson Qin
2021-05-27 14:48:06 +08:00
parent 52ab749445
commit 70ebbc286b
2 changed files with 9 additions and 3 deletions

View File

@@ -64,7 +64,7 @@
fl (first lines)
ll (last lines)]
(when (and fl ll)
(let [value' (str fl "\n" value "\n" ll)
(let [value' (str (string/trim fl) "\n" value "\n" (string/trim ll))
;; FIXME: What if there're multiple code blocks with the same value?
content' (string/replace-first content full-content value')]
(editor-handler/save-block-if-changed! block content'))))))