diff --git a/frontend/src/app/main/data/workspace/texts.cljs b/frontend/src/app/main/data/workspace/texts.cljs index eb7312744c..f2fdf75aa4 100644 --- a/frontend/src/app/main/data/workspace/texts.cljs +++ b/frontend/src/app/main/data/workspace/texts.cljs @@ -554,7 +554,7 @@ (when (features/active-feature? state "text-editor/v2") (let [instance (:workspace-editor state) styles (some-> (editor.v2/getCurrentStyle instance) - (styles/get-styles-from-style-declaration) + (styles/get-styles-from-style-declaration :removed-mixed true) ((comp update-node-fn migrate-node)) (styles/attrs->styles))] (editor.v2/applyStylesToSelection instance styles))))))) diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs index 51e74d6f49..79d745421a 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/typography.cljs @@ -307,7 +307,7 @@ :title (tr "inspect.attributes.typography.font-family") :on-click #(reset! open-selector? true)} (cond - (= :multiple font-id) + (or (= :multiple font-id) (= "mixed" font-id)) "--" (some? font) diff --git a/frontend/src/app/util/text/content/styles.cljs b/frontend/src/app/util/text/content/styles.cljs index f37938525c..4b801ee864 100644 --- a/frontend/src/app/util/text/content/styles.cljs +++ b/frontend/src/app/util/text/content/styles.cljs @@ -187,19 +187,23 @@ style-value (normalize-style-value style-name v)] (assoc acc style-name style-value)))) {} style-defaults))) +(def mixed-values #{:mixed :multiple "mixed" "multiple"}) + (defn get-styles-from-style-declaration "Returns a ClojureScript object compatible with text nodes" - [style-declaration] + [style-declaration & {:keys [removed-mixed] :or {removed-mixed false}}] (reduce (fn [acc k] (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)] - (assoc acc k (style-decode style-value))) + (when (or (not removed-mixed) (not (contains? mixed-values style-value))) + (assoc acc k (style-decode style-value)))) (let [style-name (get-style-name k) style-value (normalize-attr-value k (.getPropertyValue style-declaration style-name))] - (assoc acc k style-value)))) {} txt/text-style-attrs)) + (when (or (not removed-mixed) (not (contains? mixed-values style-value))) + (assoc acc k style-value))))) {} txt/text-style-attrs)) (defn get-styles-from-event "Returns a ClojureScript object compatible with text nodes"