From 017aa9db4350dba88eee6055385d7fe93fab2e5e Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Wed, 22 Apr 2026 19:13:13 +0800 Subject: [PATCH] fix(editor): keep journal title non-editable with visible caret --- src/main/frontend/components/editor.cljs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/main/frontend/components/editor.cljs b/src/main/frontend/components/editor.cljs index c16dc60193..5104eb75be 100644 --- a/src/main/frontend/components/editor.cljs +++ b/src/main/frontend/components/editor.cljs @@ -699,6 +699,10 @@ (some-> config :on-escape-editing (apply [(str uuid) (= type :esc)]))))))) +(defn editor-readonly? + [block] + (boolean (:block/journal-day block))) + (rum/defcs box < rum/reactive {:init (fn [state] (assoc state @@ -729,6 +733,7 @@ (let [*ref (::ref state) content (state/sub-edit-content (:block/uuid block)) heading-class (get-editor-style-class block content format) + read-only? (editor-readonly? block) opts (cond-> {:id id :ref #(reset! *ref %) @@ -747,6 +752,10 @@ :auto-capitalize (if (util/mobile?) "sentences" "off") :auto-correct (if (util/mobile?) "true" "false") :class heading-class} + read-only? + (merge + {:on-before-input #(.preventDefault ^js/Event %) + :on-paste #(.preventDefault ^js/Event %)}) (some? parent-block) (assoc :parentblockid (str (:block/uuid parent-block)))