0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-21 06:02:32 -05:00

Fix context menu missing name param

This commit is contained in:
Florian Schroedl 2024-09-12 10:36:05 +02:00
parent 309476fdfd
commit a1e4d6b3b3
2 changed files with 8 additions and 5 deletions

View file

@ -93,7 +93,8 @@
(st/emit!
(wdt/show-token-set-context-menu
{:position (dom/get-client-position event)
:token-set-id id})))))]
:token-set-id id
:token-set-name name})))))]
[:div {:class (stl/css :set-item-container)
:on-click on-select
:on-double-click #(on-edit id)

View file

@ -28,11 +28,11 @@
[:span {:class (stl/css :title)} title]])
(mf/defc menu
[{:keys [token-set-id]}]
[{:keys [token-set-id token-set-name]}]
(let [{:keys [on-edit]} (sets-context/use-context)]
[:ul {:class (stl/css :context-list)}
[:& menu-entry {:title "Rename" :on-click #(on-edit token-set-id)}]
[:& menu-entry {:title "Delete" :on-click #(st/emit! (wdt/delete-token-set token-set-id))}]]))
[:& menu-entry {:title "Delete" :on-click #(st/emit! (wdt/delete-token-set token-set-id token-set-name))}]]))
(mf/defc sets-context-menu
[]
@ -41,7 +41,8 @@
left (+ (get-in mdata [:position :x]) 5)
width (mf/use-state 0)
dropdown-ref (mf/use-ref)
token-set-id (:token-set-id mdata)]
token-set-id (:token-set-id mdata)
token-set-name (:token-set-name mdata)]
(mf/use-effect
(mf/deps mdata)
(fn []
@ -53,4 +54,5 @@
:ref dropdown-ref
:style {:top top :left left}
:on-context-menu prevent-default}
[:& menu {:token-set-id token-set-id}]]]))
[:& menu {:token-set-id token-set-id
:token-set-name token-set-name}]]]))