fix: remove-properties!

This commit is contained in:
Tienson Qin
2021-04-30 19:10:49 +08:00
parent b8af6e7e53
commit dc6acbab6c
4 changed files with 54 additions and 45 deletions

View File

@@ -1109,6 +1109,13 @@
(catch js/Error error
(log/error :save-block-failed error))))))))
(defn- clean-content!
[format content]
(->> content
(text/remove-level-spaces format)
(text/remove-properties! format)
string/trim))
(defn on-up-down
[direction]
(when (state/editing?)
@@ -1126,10 +1133,7 @@
(when sibling-block
(when-let [sibling-block-id (dom/attr sibling-block "blockid")]
(let [value (state/get-edit-content)]
(when (not= (-> content
(text/remove-level-spaces format)
text/remove-properties!
string/trim)
(when (not= (clean-content! format content)
(string/trim value))
(save-block! repo uuid value)))
(let [block (db/pull repo '[*] [:block/uuid (cljs.core/uuid sibling-block-id)])]
@@ -1967,10 +1971,7 @@
(when sibling-block
(when-let [sibling-block-id (dom/attr sibling-block "blockid")]
(let [value (state/get-edit-content)]
(when (not= (-> content
(text/remove-level-spaces format)
text/remove-properties!
string/trim)
(when (not= (clean-content! format content)
(string/trim value))
(save-block! repo uuid value)))
@@ -2017,10 +2018,7 @@
(when-let [sibling-block-id (dom/attr sibling-block "blockid")]
(let [content (:block/content block)
value (state/get-edit-content)]
(when (not= (-> content
(text/remove-level-spaces format)
text/remove-properties!
string/trim)
(when (not= (clean-content! format content)
(string/trim value))
(save-block! repo uuid value)))
(let [block (db/pull repo '[*] [:block/uuid (cljs.core/uuid sibling-block-id)])]