diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index 7397405eac..eae231fe72 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -183,8 +183,9 @@ ptk/UpdateEvent (update [_ state] (let [text-state (some->> content ted/import-content) - attrs (merge (txt/get-default-text-attrs) - (get-in state [:workspace-global :default-font])) + attrs (d/without-nils + (merge (txt/get-default-text-attrs) + (get-in state [:workspace-global :default-font]))) editor (cond-> (ted/create-editor-state text-state decorator) (and (nil? content) (some? attrs)) (ted/update-editor-current-block-data attrs))] @@ -945,9 +946,10 @@ ;; `stylechange` can fire on every `selectionchange` while typing. ;; Avoid swapping the global store when the computed styles are unchanged, ;; otherwise we can end up in store->rerender->selectionchange loops. - (let [merged-styles (merge (txt/get-default-text-attrs) - (get-in state [:workspace-global :default-font]) - new-styles) + (let [merged-styles (d/without-nils + (merge (txt/get-default-text-attrs) + (get-in state [:workspace-global :default-font]) + new-styles)) prev (get-in state [:workspace-v2-editor-state id])] (if (= merged-styles prev) state diff --git a/frontend/src/app/main/data/workspace/texts_v3.cljs b/frontend/src/app/main/data/workspace/texts_v3.cljs index 4f0834d7d2..01a36aa729 100644 --- a/frontend/src/app/main/data/workspace/texts_v3.cljs +++ b/frontend/src/app/main/data/workspace/texts_v3.cljs @@ -6,6 +6,7 @@ (ns app.main.data.workspace.texts-v3 (:require + [app.common.data :as d] [app.common.types.text :as txt] [potok.v2.core :as ptk])) @@ -14,7 +15,8 @@ (ptk/reify ::v3-update-text-editor-styles ptk/UpdateEvent (update [_ state] - (let [merged-styles (merge (txt/get-default-text-attrs) - (get-in state [:workspace-global :default-font]) - new-styles)] + (let [merged-styles (d/without-nils + (merge (txt/get-default-text-attrs) + (get-in state [:workspace-global :default-font]) + new-styles))] (update-in state [:workspace-wasm-editor-styles id] (fnil merge {}) merged-styles))))) diff --git a/frontend/src/app/util/text/content.cljs b/frontend/src/app/util/text/content.cljs index 492aa4477b..71245b8121 100644 --- a/frontend/src/app/util/text/content.cljs +++ b/frontend/src/app/util/text/content.cljs @@ -6,6 +6,7 @@ (ns app.util.text.content (:require + [app.common.data :as d] [app.common.types.text :as txt] [app.main.refs :as refs] [app.util.text.content.from-dom :as fd] @@ -26,7 +27,7 @@ current default typography. Used by the V2 editor/WASM path when a shape is created with no content yet." [] - (let [default-font (deref refs/default-font) + (let [default-font (d/without-nils (deref refs/default-font)) text-defaults (merge (txt/get-default-text-attrs) default-font) default-span (merge {:text ""} (select-keys text-defaults txt/text-node-attrs))