fix: set timestamp to another editing block

close https://github.com/logseq/logseq/issues/3783
This commit is contained in:
llcc
2022-02-25 10:33:48 +08:00
committed by Andelf
parent 50e5764369
commit 03d8c8a8d2
2 changed files with 9 additions and 6 deletions

View File

@@ -1040,13 +1040,15 @@
value (str value)]
(when-let [block (db/pull [:block/uuid block-id])]
(let [{:block/keys [content]} block
content (or (state/get-edit-content) content)
content (or content (state/get-edit-content))
new-content (-> (text/remove-timestamp content key)
(text/add-timestamp key value))]
(when (not= content new-content)
(if-let [input-id (state/get-edit-input-id)]
(state/set-edit-content! input-id new-content)
(save-block-if-changed! block new-content)))))))
(let [input-id (state/get-edit-input-id)]
(if (and input-id
(string/ends-with? input-id (str block-id)))
(state/set-edit-content! input-id new-content)
(save-block-if-changed! block new-content))))))))
(defn- set-blocks-id!
[block-ids]