mirror of
https://github.com/penpot/penpot.git
synced 2025-01-21 06:02:32 -05:00
Allow passing custom on-update-shape function
This commit is contained in:
parent
ededd23849
commit
9340ba9cc0
1 changed files with 7 additions and 5 deletions
|
@ -32,8 +32,10 @@
|
|||
:shape-ids shape-ids
|
||||
:selected-pred #(seq (% ids-by-attributes))}))
|
||||
|
||||
(defn generic-attribute-actions [attributes title {:keys [token selected-shapes]}]
|
||||
(let [{:keys [on-update-shape]} (wtty/get-token-properties token)
|
||||
(defn generic-attribute-actions [attributes title {:keys [token selected-shapes on-update-shape]}]
|
||||
(let [on-update-shape-fn (or on-update-shape
|
||||
(-> (wtty/get-token-properties token)
|
||||
(:on-update-shape)))
|
||||
{:keys [selected-pred shape-ids]} (attribute-actions token selected-shapes attributes)]
|
||||
(map (fn [attribute]
|
||||
(let [selected? (selected-pred attribute)
|
||||
|
@ -43,9 +45,9 @@
|
|||
|
||||
{:title title
|
||||
:selected? selected?
|
||||
:action #(if selected?
|
||||
(st/emit! (wtch/unapply-token props))
|
||||
(st/emit! (wtch/apply-token (assoc props :on-update-shape on-update-shape))))}))
|
||||
:action (if selected?
|
||||
(st/emit! (wtch/unapply-token props))
|
||||
(st/emit! (wtch/apply-token (assoc props :on-update-shape on-update-shape-fn))))}))
|
||||
attributes)))
|
||||
|
||||
(defn all-or-sepearate-actions [{:keys [attribute-labels on-update-shape-all on-update-shape]}
|
||||
|
|
Loading…
Add table
Reference in a new issue