From 3e9da023f097feceb7181da323729b6db360853e Mon Sep 17 00:00:00 2001 From: Eva Marco Date: Thu, 23 Apr 2026 13:26:20 +0200 Subject: [PATCH] :bug: Fix multiselect options --- common/src/app/common/text.cljc | 4 +++- common/src/app/common/types/text.cljc | 4 +++- frontend/src/app/util/text/content/styles.cljs | 16 ++++++++++------ 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/common/src/app/common/text.cljc b/common/src/app/common/text.cljc index e0ed3515e6..cc997f62d6 100644 --- a/common/src/app/common/text.cljc +++ b/common/src/app/common/text.cljc @@ -37,7 +37,9 @@ (defn attrs-to-styles [attrs] (reduce-kv (fn [res k v] - (conj res (encode-style k v))) + (if (some? v) + (conj res (encode-style k v)) + res)) #{} attrs)) diff --git a/common/src/app/common/types/text.cljc b/common/src/app/common/types/text.cljc index d9cd5488dc..cde27c19c4 100644 --- a/common/src/app/common/types/text.cljc +++ b/common/src/app/common/types/text.cljc @@ -95,7 +95,9 @@ :text-direction "ltr"}) (def default-text-attrs - {:font-id "sourcesanspro" + {:typography-ref-file nil + :typography-ref-id nil + :font-id "sourcesanspro" :font-family "sourcesanspro" :font-variant-id "regular" :font-size "14" diff --git a/frontend/src/app/util/text/content/styles.cljs b/frontend/src/app/util/text/content/styles.cljs index c67ca4d629..da1da78df4 100644 --- a/frontend/src/app/util/text/content/styles.cljs +++ b/frontend/src/app/util/text/content/styles.cljs @@ -132,8 +132,10 @@ "Maps attrs to styles" [styles] (let [mapped-styles - (into {} (map attr->style styles))] - (clj->js mapped-styles))) + (into {} (comp (filter (fn [[_ v]] (some? v))) + (map attr->style)) + styles)] + (clj->js mapped-styles))) (defn style-needs-mapping? [name] @@ -199,12 +201,14 @@ (let [style-name (get-style-name-as-css-variable k) [_ style-decode] (get mapping k) style-value (.getPropertyValue style-declaration style-name)] - (when (or (not removed-mixed) (not (contains? mixed-values style-value))) - (assoc acc k (style-decode style-value)))) + (if (or (not removed-mixed) (not (contains? mixed-values style-value))) + (assoc acc k (style-decode style-value)) + acc)) (let [style-name (get-style-name k) style-value (normalize-attr-value k (.getPropertyValue style-declaration style-name))] - (when (or (not removed-mixed) (not (contains? mixed-values style-value))) - (assoc acc k style-value))))) {} txt/text-style-attrs)) + (if (or (not removed-mixed) (not (contains? mixed-values style-value))) + (assoc acc k style-value) + acc)))) {} txt/text-style-attrs)) (defn get-styles-from-event "Returns a ClojureScript object compatible with text nodes"