diff --git a/CHANGES.md b/CHANGES.md index f7ed751bc9..16ed1f9aea 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -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 diff --git a/frontend/src/app/main/data/event.cljs b/frontend/src/app/main/data/event.cljs index 934a0f4757..fa2ba0b398 100644 --- a/frontend/src/app/main/data/event.cljs +++ b/frontend/src/app/main/data/event.cljs @@ -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) diff --git a/frontend/src/app/main/data/workspace/tokens/application.cljs b/frontend/src/app/main/data/workspace/tokens/application.cljs index def0708c28..b62110e315 100644 --- a/frontend/src/app/main/data/workspace/tokens/application.cljs +++ b/frontend/src/app/main/data/workspace/tokens/application.cljs @@ -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