mirror of
https://github.com/penpot/penpot.git
synced 2025-08-01 06:48:28 +02:00
Merge remote-tracking branch 'origin/staging' into develop
This commit is contained in:
commit
8aebe1a41e
15 changed files with 67 additions and 32 deletions
|
@ -518,15 +518,31 @@
|
|||
;; --- SHAPE UPDATE
|
||||
|
||||
(defn- get-token-groups
|
||||
"Get the sync attrs groups that are affected by changes in applied tokens.
|
||||
|
||||
If any token has been applied or unapplied in the shape, calculate the corresponding
|
||||
attributes and get the groups. If some of the attributes are to be applied in the
|
||||
content nodes of a text shape, also return the content groups (only for attributes,
|
||||
so the text is not touched)."
|
||||
[shape new-applied-tokens]
|
||||
(let [old-applied-tokens (d/nilv (:applied-tokens shape) #{})
|
||||
changed-token-attrs (filter #(not= (get old-applied-tokens %) (get new-applied-tokens %))
|
||||
ctt/all-keys)
|
||||
changed-groups (into #{}
|
||||
(comp (map ctt/token-attr->shape-attr)
|
||||
(map #(get ctk/sync-attrs %))
|
||||
(filter some?))
|
||||
changed-token-attrs)]
|
||||
(let [old-applied-tokens (d/nilv (:applied-tokens shape) #{})
|
||||
changed-token-attrs (filter #(not= (get old-applied-tokens %) (get new-applied-tokens %))
|
||||
ctt/all-keys)
|
||||
text-shape? (= (:type shape) :text)
|
||||
attrs-in-text-content? (some #(ctt/attrs-in-text-content %)
|
||||
changed-token-attrs)
|
||||
|
||||
changed-groups (into #{}
|
||||
(comp (map ctt/token-attr->shape-attr)
|
||||
(map #(get ctk/sync-attrs %))
|
||||
(filter some?))
|
||||
changed-token-attrs)
|
||||
|
||||
changed-groups (if (and text-shape?
|
||||
(d/not-empty? changed-groups)
|
||||
attrs-in-text-content?)
|
||||
(conj changed-groups :content-group :text-content-attribute)
|
||||
changed-groups)]
|
||||
changed-groups))
|
||||
|
||||
(defn set-shape-attr
|
||||
|
|
|
@ -273,6 +273,13 @@
|
|||
[attributes token-type]
|
||||
(seq (appliable-attrs attributes token-type)))
|
||||
|
||||
;; Token attrs that are set inside content blocks of text shapes, instead
|
||||
;; at the shape level.
|
||||
(def attrs-in-text-content
|
||||
(set/union
|
||||
typography-keys
|
||||
#{:fill}))
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;; TOKENS IN SHAPES
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue