mirror of
https://github.com/penpot/penpot.git
synced 2025-05-03 14:25:53 +02: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)
|
(update data :tokens-lib update-tokens-lib)
|
||||||
data)))
|
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
|
(def available-migrations
|
||||||
(into (d/ordered-set)
|
(into (d/ordered-set)
|
||||||
["legacy-2"
|
["legacy-2"
|
||||||
|
@ -1306,4 +1321,5 @@
|
||||||
"legacy-66"
|
"legacy-66"
|
||||||
"legacy-67"
|
"legacy-67"
|
||||||
"Ensure hidden theme"
|
"Ensure hidden theme"
|
||||||
"Add token theme id"]))
|
"Add token theme id"
|
||||||
|
"Remove tokens from groups"]))
|
||||||
|
|
|
@ -49,6 +49,13 @@
|
||||||
(rx/mapcat
|
(rx/mapcat
|
||||||
(fn [resolved-tokens]
|
(fn [resolved-tokens]
|
||||||
(let [undo-id (js/Symbol)
|
(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])
|
resolved-value (get-in resolved-tokens [(wtt/token-identifier token) :resolved-value])
|
||||||
tokenized-attributes (wtt/attributes-map attributes token)]
|
tokenized-attributes (wtt/attributes-map attributes token)]
|
||||||
(rx/of
|
(rx/of
|
||||||
|
|
|
@ -371,8 +371,10 @@
|
||||||
|
|
||||||
(mf/defc menu-tree
|
(mf/defc menu-tree
|
||||||
[{:keys [selected-shapes submenu-offset type errors] :as context-data}]
|
[{:keys [selected-shapes submenu-offset type errors] :as context-data}]
|
||||||
(let [entries (if (and (not (some? errors))
|
(let [shape-types (into #{} (map :type selected-shapes))
|
||||||
(seq selected-shapes))
|
entries (if (and (not (some? errors))
|
||||||
|
(seq selected-shapes)
|
||||||
|
(not= shape-types #{:group}))
|
||||||
(if (some? type)
|
(if (some? type)
|
||||||
(submenu-actions-selection-actions context-data)
|
(submenu-actions-selection-actions context-data)
|
||||||
(selection-actions context-data))
|
(selection-actions context-data))
|
||||||
|
|
Loading…
Add table
Reference in a new issue