mirror of
https://github.com/penpot/penpot.git
synced 2025-01-20 05:34:23 -05:00
🐛 Fix selecting a set in the sidebar toggling the active state
This commit is contained in:
parent
1f6512cff0
commit
d34c88b6e4
2 changed files with 10 additions and 7 deletions
|
@ -271,6 +271,11 @@
|
|||
(mf/deps theme-state)
|
||||
(fn [set-name]
|
||||
(swap! theme-state #(ctob/toggle-set % set-name))))
|
||||
on-click-token-set (mf/use-callback
|
||||
(mf/deps on-toggle-token-set)
|
||||
(fn [prefixed-set-path-str]
|
||||
(let [set-name (ctob/prefixed-set-path-string->set-name-string prefixed-set-path-str)]
|
||||
(on-toggle-token-set set-name))))
|
||||
on-change-field (fn [field value]
|
||||
(swap! theme-state #(assoc % field value)))
|
||||
on-save-form (mf/use-callback
|
||||
|
@ -322,7 +327,7 @@
|
|||
{:token-sets token-sets
|
||||
:token-set-selected? (constantly false)
|
||||
:token-set-active? token-set-active?
|
||||
:on-select on-toggle-token-set
|
||||
:on-select on-click-token-set
|
||||
:on-toggle-token-set on-toggle-token-set
|
||||
:origin "theme-modal"
|
||||
:context sets-context/static-context}]]
|
||||
|
|
|
@ -110,9 +110,7 @@
|
|||
(fn [event]
|
||||
(dom/stop-propagation event)
|
||||
(when-not editing?'
|
||||
(on-toggle set-name)
|
||||
(on-select tree-path))))
|
||||
|
||||
on-context-menu
|
||||
(mf/use-fn
|
||||
(mf/deps editing?' tree-path)
|
||||
|
@ -163,9 +161,9 @@
|
|||
[{:keys [set-path set-node tree-depth tree-path on-select selected? on-toggle active? editing? on-edit on-edit-reset on-edit-submit]
|
||||
:or {tree-depth 0}
|
||||
:as props}]
|
||||
(let [[set-prefix set-path'] (some-> set-path (ctob/split-set-str-path-prefix))
|
||||
(let [[set-path-prefix set-fname] (some-> set-path (ctob/split-set-str-path-prefix))
|
||||
set? (instance? ctob/TokenSet set-node)
|
||||
set-group? (= ctob/set-group-prefix set-prefix)
|
||||
set-group? (= ctob/set-group-prefix set-path-prefix)
|
||||
root? (= tree-depth 0)
|
||||
collapsed? (mf/use-state false)
|
||||
children? (and
|
||||
|
@ -180,7 +178,7 @@
|
|||
:active? active?
|
||||
:selected? (selected? tree-path)
|
||||
:on-select on-select
|
||||
:label set-path'
|
||||
:label set-fname
|
||||
:tree-path (or tree-path set-path)
|
||||
:tree-depth tree-depth
|
||||
:editing? editing?
|
||||
|
@ -192,7 +190,7 @@
|
|||
[:& sets-tree-set-group
|
||||
{:selected? (selected? tree-path)
|
||||
:on-select on-select
|
||||
:label set-path'
|
||||
:label set-fname
|
||||
:collapsed? collapsed?
|
||||
:tree-path (or tree-path set-path)
|
||||
:tree-depth tree-depth
|
||||
|
|
Loading…
Add table
Reference in a new issue