fix: templates with bullet will auto duplicate

Related to #1141 and #1123
This commit is contained in:
Tienson Qin
2021-01-17 11:40:44 +08:00
parent 9256706838
commit 14cb8af42c

View File

@@ -606,6 +606,14 @@
(when chan {:chan chan
:chan-callback chan-callback})))
;; fix editing template with multiple headings
(when (> (count blocks) 1)
(let [new-value (-> (text/remove-level-spaces (:block/content (first blocks)) (:block/format (first blocks)))
(string/trim-newline))
edit-input-id (state/get-edit-input-id)]
(when edit-input-id
(state/set-edit-content! edit-input-id new-value))))
(when (or (seq retract-refs) pre-block?)
(ui-handler/re-render-root!))