0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-06 14:50:20 -05:00

Fix renaming via context menu

This commit is contained in:
Florian Schroedl 2024-10-01 15:45:14 +02:00
parent 7418d1fa2c
commit fa3e2c90e6

View file

@ -28,10 +28,10 @@
[:span {:class (stl/css :title)} title]])
(mf/defc menu
[{:keys [token-set-id token-set-name]}]
[{:keys [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 "Rename" :on-click #(on-edit token-set-name)}]
[:& menu-entry {:title "Delete" :on-click #(st/emit! (wdt/delete-token-set token-set-name))}]]))
(mf/defc sets-context-menu
@ -41,7 +41,6 @@
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-name (:token-set-name mdata)]
(mf/use-effect
(mf/deps mdata)
@ -54,5 +53,4 @@
:ref dropdown-ref
:style {:top top :left left}
:on-context-menu prevent-default}
[:& menu {:token-set-id token-set-id
:token-set-name token-set-name}]]]))
[:& menu {:token-set-name token-set-name}]]]))