mirror of
https://github.com/penpot/penpot.git
synced 2025-04-05 03:21:26 -05:00
🎉 Avoid setting token to group shapes (#6055)
* 🎉 Avoid setting token to group shapes * 📎 Fix on update shape when double click
This commit is contained in:
parent
2aee2ea79e
commit
0efbebd94f
3 changed files with 28 additions and 3 deletions
|
@ -1251,6 +1251,21 @@
|
|||
(update data :tokens-lib update-tokens-lib)
|
||||
data)))
|
||||
|
||||
(defmethod migrate-data "Remove tokens from groups"
|
||||
[data _]
|
||||
(letfn [(update-object [object]
|
||||
(cond-> object
|
||||
(and (= :group (:type object))
|
||||
(contains? (:applied-tokens object) :fill))
|
||||
(assoc :fills [])
|
||||
(and (= :group (:type object))
|
||||
(contains? object :applied-tokens))
|
||||
(dissoc :applied-tokens)))
|
||||
|
||||
(update-page [page]
|
||||
(d/update-when page :objects update-vals update-object))]
|
||||
(update data :pages-index update-vals update-page)))
|
||||
|
||||
(def available-migrations
|
||||
(into (d/ordered-set)
|
||||
["legacy-2"
|
||||
|
@ -1306,4 +1321,5 @@
|
|||
"legacy-66"
|
||||
"legacy-67"
|
||||
"Ensure hidden theme"
|
||||
"Add token theme id"]))
|
||||
"Add token theme id"
|
||||
"Remove tokens from groups"]))
|
||||
|
|
|
@ -49,6 +49,13 @@
|
|||
(rx/mapcat
|
||||
(fn [resolved-tokens]
|
||||
(let [undo-id (js/Symbol)
|
||||
objects (dsh/lookup-page-objects state)
|
||||
|
||||
shape-ids (or (->> (select-keys objects shape-ids)
|
||||
(filter (fn [[_ shape]] (not= (:type shape) :group)))
|
||||
(keys))
|
||||
[])
|
||||
|
||||
resolved-value (get-in resolved-tokens [(wtt/token-identifier token) :resolved-value])
|
||||
tokenized-attributes (wtt/attributes-map attributes token)]
|
||||
(rx/of
|
||||
|
|
|
@ -371,8 +371,10 @@
|
|||
|
||||
(mf/defc menu-tree
|
||||
[{:keys [selected-shapes submenu-offset type errors] :as context-data}]
|
||||
(let [entries (if (and (not (some? errors))
|
||||
(seq selected-shapes))
|
||||
(let [shape-types (into #{} (map :type selected-shapes))
|
||||
entries (if (and (not (some? errors))
|
||||
(seq selected-shapes)
|
||||
(not= shape-types #{:group}))
|
||||
(if (some? type)
|
||||
(submenu-actions-selection-actions context-data)
|
||||
(selection-actions context-data))
|
||||
|
|
Loading…
Add table
Reference in a new issue