mirror of
https://github.com/penpot/penpot.git
synced 2025-08-03 15:28:21 +02:00
✨ Remove token when applying tyopgraphic asset style
This commit is contained in:
parent
f6b97af148
commit
58a843ea23
2 changed files with 30 additions and 38 deletions
|
@ -11,6 +11,7 @@
|
|||
[app.common.files.helpers :as cfh]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.logic.variant-properties :as clvp]
|
||||
[app.common.text :as ct]
|
||||
[app.common.types.component :as ctk]
|
||||
[app.common.types.container :as ctn]
|
||||
[app.common.types.pages-list :as ctpl]
|
||||
|
@ -21,9 +22,12 @@
|
|||
[app.common.uuid :as uuid]
|
||||
[clojure.set :as set]))
|
||||
|
||||
(def text-typography-attrs (set ct/text-typography-attrs))
|
||||
|
||||
(defn- generate-unapply-tokens
|
||||
"When updating attributes that have a token applied, we must unapply it, because the value
|
||||
of the attribute now has been given directly, and does not come from the token."
|
||||
of the attribute now has been given directly, and does not come from the token.
|
||||
When applying a typography asset style we also unapply any typographic tokens."
|
||||
[changes objects changed-sub-attr]
|
||||
(let [new-objects (pcb/get-objects changes)
|
||||
mod-obj-changes (->> (:redo-changes changes)
|
||||
|
@ -32,7 +36,11 @@
|
|||
text-changed-attrs
|
||||
(fn [shape]
|
||||
(let [new-shape (get new-objects (:id shape))
|
||||
attrs (ctt/get-diff-attrs (:content shape) (:content new-shape))]
|
||||
attrs (ctt/get-diff-attrs (:content shape) (:content new-shape))
|
||||
;; Unapply token when applying typography asset style
|
||||
attrs (if (set/intersection text-typography-attrs attrs)
|
||||
(into attrs cto/typography-keys)
|
||||
attrs)]
|
||||
(apply set/union (map cto/shape-attr->token-attrs attrs))))
|
||||
|
||||
check-attr (fn [shape changes attr]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue