diff --git a/frontend/src/app/util/text/content/from_dom.cljs b/frontend/src/app/util/text/content/from_dom.cljs index dbc318cc08..7773a13fee 100644 --- a/frontend/src/app/util/text/content/from_dom.cljs +++ b/frontend/src/app/util/text/content/from_dom.cljs @@ -50,8 +50,11 @@ [_ style-decode] (get styles/mapping key)] (style-decode (.getPropertyValue style style-name))) (let [style-name (styles/get-style-name key)] - (styles/normalize-attr-value key (.getPropertyValue style style-name))))] - (assoc acc key (if (value-empty? value) (get defaults key) value)))) + (styles/normalize-attr-value key (.getPropertyValue style style-name)))) + resolved (if (value-empty? value) (get defaults key) value)] + (if (some? resolved) + (assoc acc key resolved) + acc))) {} attrs))) (defn get-text-span-styles diff --git a/frontend/src/app/util/text/content/styles.cljs b/frontend/src/app/util/text/content/styles.cljs index 0adc821d46..7dcb3f5d31 100644 --- a/frontend/src/app/util/text/content/styles.cljs +++ b/frontend/src/app/util/text/content/styles.cljs @@ -200,13 +200,17 @@ (if (contains? mapping k) (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)))) + style-value (.getPropertyValue style-declaration style-name) + decoded (style-decode style-value)] + (if (and (some? decoded) + (or (not removed-mixed) (not (contains? mixed-values style-value)))) + (assoc acc k decoded) + 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"