mirror of https://github.com/penpot/penpot.git
Merge pull request #7994 from penpot/alotor-fix-font-style
🐛 Fix problem when changing colors with multiple fonts
This commit is contained in:
commit
cb325282ec
|
|
@ -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)))))))
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue