From c707107ae17202f321fe307ab70248a0e46d5f74 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Thu, 5 Nov 2020 15:07:02 +0800 Subject: [PATCH] fix(editor): don't add properties for pre-blocks Resolved https://github.com/logseq/logseq/issues/614 --- src/main/frontend/handler/editor.cljs | 31 +++++++++++++++------------ 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 2340b7275..e92a30daf 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -1032,20 +1032,21 @@ key (string/lower-case (str key)) value (str value)] (when-let [block (db/pull [:block/uuid block-id])] - (let [{:block/keys [content properties]} block] - (cond - (and (get properties key) - (= (string/trim (get properties key)) value)) - nil + (when-not (:block/pre-block? block) + (let [{:block/keys [content properties]} block] + (cond + (and (get properties key) + (= (string/trim (get properties key)) value)) + nil - :else - (let [properties (:block/properties block) - properties' (if (seq properties) - (assoc properties key value) - {key value})] - (save-block-if-changed! block content - {:custom-properties properties' - :rebuild-content? false}))))))) + :else + (let [properties (:block/properties block) + properties' (if (seq properties) + (assoc properties key value) + {key value})] + (save-block-if-changed! block content + {:custom-properties properties' + :rebuild-content? false})))))))) (defn set-block-timestamp! [block-id key value] @@ -1093,7 +1094,9 @@ (defn copy-block-ref! [block-id] - (set-block-property! block-id "custom_id" (str block-id)) + (let [block (db/entity [:block/uuid block-id])] + (when-not (:block/pre-block? block) + (set-block-property! block-id "custom_id" (str block-id)))) (util/copy-to-clipboard! (str block-id))) (defn clear-selection!