mirror of
https://github.com/penpot/penpot.git
synced 2026-05-16 05:23:39 +00:00
✨ Add info to apply-token events (#7050)
This commit is contained in:
parent
fe53869308
commit
905699d15a
@ -27,6 +27,7 @@
|
||||
- Improve text layer auto-resize: auto-width switches to auto-height on horizontal resize, and only switches to fixed on vertical resize [Taiga #11578](https://tree.taiga.io/project/penpot/issue/11578)
|
||||
- Add the ability to show login dialog on profile settings [Github #6871](https://github.com/penpot/penpot/pull/6871)
|
||||
- Improve the application of tokens with object specific tokens [Taiga #10209](https://tree.taiga.io/project/penpot/us/10209)
|
||||
- Add info to apply-token event [Taiga #11710](https://tree.taiga.io/project/penpot/task/11710)
|
||||
|
||||
### :bug: Bugs fixed
|
||||
|
||||
|
||||
@ -79,14 +79,29 @@
|
||||
(defprotocol Event
|
||||
(-data [_] "Get event data"))
|
||||
|
||||
(defn- coerce-to-string
|
||||
[v]
|
||||
(cond
|
||||
(keyword? v)
|
||||
(name v)
|
||||
(string? v)
|
||||
v
|
||||
(nil? v)
|
||||
nil
|
||||
:else
|
||||
(str v)))
|
||||
|
||||
(def ^:private xf:coerce-to-string
|
||||
(keep coerce-to-string))
|
||||
|
||||
(defn- simplify-props
|
||||
"Removes complex data types from props."
|
||||
[data]
|
||||
(reduce-kv (fn [data k v]
|
||||
(cond
|
||||
(map? v) (assoc data k :placeholder/map)
|
||||
(vector? v) (assoc data k :placeholder/vec)
|
||||
(set? v) (assoc data k :placeholder/set)
|
||||
(vector? v) (assoc data k (into [] xf:coerce-to-string v))
|
||||
(set? v) (assoc data k (into [] xf:coerce-to-string v))
|
||||
(coll? v) (assoc data k :placeholder/coll)
|
||||
(fn? v) (assoc data k :placeholder/fn)
|
||||
(nil? v) (dissoc data k)
|
||||
|
||||
@ -319,9 +319,12 @@
|
||||
[])
|
||||
|
||||
resolved-value (get-in resolved-tokens [(cft/token-identifier token) :resolved-value])
|
||||
tokenized-attributes (cft/attributes-map attributes token)]
|
||||
tokenized-attributes (cft/attributes-map attributes token)
|
||||
type (:type token)]
|
||||
(rx/of
|
||||
(st/emit! (ptk/event ::ev/event {::ev/name "apply-tokens"}))
|
||||
(st/emit! (ev/event {::ev/name "apply-tokens"
|
||||
:type type
|
||||
:applyed-to attributes}))
|
||||
(dwu/start-undo-transaction undo-id)
|
||||
(dwsh/update-shapes shape-ids (fn [shape]
|
||||
(cond-> shape
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user