mirror of
https://github.com/penpot/penpot.git
synced 2025-03-06 04:41:57 -05:00
🐛 Fix set with spaces not being rename-able via context menu (#5956)
This commit is contained in:
parent
6cccacaaab
commit
65c6c821e7
2 changed files with 11 additions and 9 deletions
|
@ -149,7 +149,7 @@
|
||||||
|
|
||||||
on-context-menu
|
on-context-menu
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps is-editing can-edit?)
|
(mf/deps is-editing id tree-path can-edit?)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
|
@ -157,6 +157,7 @@
|
||||||
(st/emit! (dt/assign-token-set-context-menu
|
(st/emit! (dt/assign-token-set-context-menu
|
||||||
{:position (dom/get-client-position event)
|
{:position (dom/get-client-position event)
|
||||||
:is-group true
|
:is-group true
|
||||||
|
:id id
|
||||||
:path tree-path})))))
|
:path tree-path})))))
|
||||||
|
|
||||||
on-collapse-click
|
on-collapse-click
|
||||||
|
@ -247,7 +248,7 @@
|
||||||
|
|
||||||
on-context-menu
|
on-context-menu
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps is-editing tree-path can-edit?)
|
(mf/deps is-editing id tree-path can-edit?)
|
||||||
(fn [event]
|
(fn [event]
|
||||||
(dom/prevent-default event)
|
(dom/prevent-default event)
|
||||||
(dom/stop-propagation event)
|
(dom/stop-propagation event)
|
||||||
|
@ -255,6 +256,7 @@
|
||||||
(st/emit! (dt/assign-token-set-context-menu
|
(st/emit! (dt/assign-token-set-context-menu
|
||||||
{:position (dom/get-client-position event)
|
{:position (dom/get-client-position event)
|
||||||
:is-group false
|
:is-group false
|
||||||
|
:id id
|
||||||
:path tree-path})))))
|
:path tree-path})))))
|
||||||
|
|
||||||
on-double-click
|
on-double-click
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
(:require-macros [app.main.style :as stl])
|
(:require-macros [app.main.style :as stl])
|
||||||
(:require
|
(:require
|
||||||
[app.common.data.macros :as dm]
|
[app.common.data.macros :as dm]
|
||||||
[app.common.types.tokens-lib :as ctob]
|
|
||||||
[app.main.data.tokens :as dt]
|
[app.main.data.tokens :as dt]
|
||||||
[app.main.refs :as refs]
|
[app.main.refs :as refs]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
|
@ -35,16 +34,15 @@
|
||||||
|
|
||||||
(mf/defc menu*
|
(mf/defc menu*
|
||||||
{::mf/private true}
|
{::mf/private true}
|
||||||
[{:keys [is-group path]}]
|
[{:keys [is-group id path]}]
|
||||||
(let [create-set-at-path
|
(let [create-set-at-path
|
||||||
(mf/use-fn (mf/deps path) #(st/emit! (dt/start-token-set-creation path)))
|
(mf/use-fn (mf/deps path) #(st/emit! (dt/start-token-set-creation path)))
|
||||||
|
|
||||||
on-edit
|
on-edit
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps path)
|
(mf/deps id)
|
||||||
(fn []
|
(fn []
|
||||||
(let [name (ctob/join-set-path path)]
|
(st/emit! (dt/start-token-set-edition id))))
|
||||||
(st/emit! (dt/start-token-set-edition name)))))
|
|
||||||
|
|
||||||
on-delete
|
on-delete
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
|
@ -59,7 +57,7 @@
|
||||||
|
|
||||||
(mf/defc token-set-context-menu*
|
(mf/defc token-set-context-menu*
|
||||||
[]
|
[]
|
||||||
(let [{:keys [position is-group path]}
|
(let [{:keys [position is-group id path]}
|
||||||
(mf/deref ref:token-sets-context-menu)
|
(mf/deref ref:token-sets-context-menu)
|
||||||
|
|
||||||
position-top
|
position-top
|
||||||
|
@ -78,4 +76,6 @@
|
||||||
:style {:top position-top
|
:style {:top position-top
|
||||||
:left position-left}
|
:left position-left}
|
||||||
:on-context-menu prevent-default}
|
:on-context-menu prevent-default}
|
||||||
[:> menu* {:is-group is-group :path path}]]]))
|
[:> menu* {:is-group is-group
|
||||||
|
:id id
|
||||||
|
:path path}]]]))
|
||||||
|
|
Loading…
Add table
Reference in a new issue