fix(editor): do not remove properties before parse

This commit is contained in:
Andelf
2021-12-16 18:43:33 +08:00
committed by Tienson Qin
parent 90119ba74d
commit acabab5ba7
2 changed files with 4 additions and 4 deletions

View File

@@ -158,9 +158,10 @@
(let [block (db/pull [:block/uuid (:block/uuid config)])
content (:block/content block)
{:keys [start_pos end_pos]} (:pos_meta (last (:rum/args state)))
offset (if (:block/pre-block? block) 0 2)
raw-content (utf8/encode content) ;; NOTE: :pos_meta is based on byte position
prefix (utf8/decode (.slice raw-content 0 (- start_pos 2)))
surfix (utf8/decode (.slice raw-content (- end_pos 2)))
prefix (utf8/decode (.slice raw-content 0 (- start_pos offset)))
surfix (utf8/decode (.slice raw-content (- end_pos offset)))
new-content (if (string/blank? value)
(str prefix surfix)
(str prefix value "\n" surfix))]