diff --git a/src/main/frontend/components/datetime.cljs b/src/main/frontend/components/datetime.cljs index b2c91b634d..aba6a9508e 100644 --- a/src/main/frontend/components/datetime.cljs +++ b/src/main/frontend/components/datetime.cljs @@ -82,6 +82,7 @@ (reset! *timestamp default-timestamp-value) (reset! *show-time? false) (reset! *show-repeater? false) + (state/set-timestamp-block! nil) (state/set-state! :date-picker/date nil)) (defn- on-submit @@ -95,8 +96,8 @@ text (repeated/timestamp-map->text timestamp) block-data (state/get-timestamp-block) {:keys [block typ show?]} block-data - block-id (or (:block/uuid (state/get-edit-block)) - (:block/uuid block)) + block-id (or (:block/uuid block) + (:block/uuid (state/get-edit-block))) typ (or @commands/*current-command typ)] (editor-handler/set-block-timestamp! block-id typ diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 30cd6a3587..d588920982 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -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]