mirror of
https://github.com/penpot/penpot.git
synced 2025-06-09 09:21:37 +02:00
🐛 Fix on libraries section, items shouldn't have context menu
This commit is contained in:
parent
54c63fef06
commit
6bd1f19e36
1 changed files with 34 additions and 24 deletions
|
@ -331,6 +331,15 @@
|
||||||
client-position)]
|
client-position)]
|
||||||
(st/emit! (dd/show-file-menu-with-position file-id position)))))
|
(st/emit! (dd/show-file-menu-with-position file-id position)))))
|
||||||
|
|
||||||
|
on-context-menu
|
||||||
|
(mf/use-fn
|
||||||
|
(mf/deps is-library-view)
|
||||||
|
(fn [event]
|
||||||
|
(dom/stop-propagation event)
|
||||||
|
(dom/prevent-default event)
|
||||||
|
(when-not is-library-view
|
||||||
|
(on-menu-click event))))
|
||||||
|
|
||||||
edit
|
edit
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps file)
|
(mf/deps file)
|
||||||
|
@ -373,7 +382,7 @@
|
||||||
:on-key-down handle-key-down
|
:on-key-down handle-key-down
|
||||||
:on-double-click on-navigate
|
:on-double-click on-navigate
|
||||||
:on-drag-start on-drag-start
|
:on-drag-start on-drag-start
|
||||||
:on-context-menu on-menu-click}
|
:on-context-menu on-context-menu}
|
||||||
|
|
||||||
[:div {:class (stl/css :overlay)}]
|
[:div {:class (stl/css :overlay)}]
|
||||||
|
|
||||||
|
@ -392,31 +401,32 @@
|
||||||
[:h3 (:name file)])
|
[:h3 (:name file)])
|
||||||
[:& grid-item-metadata {:modified-at (:modified-at file)}]]
|
[:& grid-item-metadata {:modified-at (:modified-at file)}]]
|
||||||
|
|
||||||
[:div {:class (stl/css-case :project-th-actions true :force-display (:menu-open dashboard-local))}
|
(when-not is-library-view
|
||||||
[:div
|
[:div {:class (stl/css-case :project-th-actions true :force-display (:menu-open dashboard-local))}
|
||||||
{:class (stl/css :project-th-icon :menu)
|
[:div
|
||||||
:tab-index "0"
|
{:class (stl/css :project-th-icon :menu)
|
||||||
:ref menu-ref
|
:tab-index "0"
|
||||||
:id (str file-id "-action-menu")
|
:ref menu-ref
|
||||||
:on-click on-menu-click
|
:id (str file-id "-action-menu")
|
||||||
:on-key-down (fn [event]
|
:on-click on-menu-click
|
||||||
(when (kbd/enter? event)
|
:on-key-down (fn [event]
|
||||||
(dom/stop-propagation event)
|
(when (kbd/enter? event)
|
||||||
(on-menu-click event)))}
|
(dom/stop-propagation event)
|
||||||
menu-icon
|
(on-menu-click event)))}
|
||||||
(when (and selected? file-menu-open?)
|
menu-icon
|
||||||
|
(when (and selected? file-menu-open?)
|
||||||
;; When the menu is open we disable events in the dashboard. We need to force pointer events
|
;; When the menu is open we disable events in the dashboard. We need to force pointer events
|
||||||
;; so the menu can be handled
|
;; so the menu can be handled
|
||||||
[:div {:style {:pointer-events "all"}}
|
[:div {:style {:pointer-events "all"}}
|
||||||
[:> file-menu* {:files (vals selected-files)
|
[:> file-menu* {:files (vals selected-files)
|
||||||
:left (+ 24 (:x (:menu-pos dashboard-local)))
|
:left (+ 24 (:x (:menu-pos dashboard-local)))
|
||||||
:top (:y (:menu-pos dashboard-local))
|
:top (:y (:menu-pos dashboard-local))
|
||||||
:can-edit can-edit
|
:can-edit can-edit
|
||||||
:navigate true
|
:navigate true
|
||||||
:on-edit on-edit
|
:on-edit on-edit
|
||||||
:on-menu-close on-menu-close
|
:on-menu-close on-menu-close
|
||||||
:origin origin
|
:origin origin
|
||||||
:parent-id (dm/str file-id "-action-menu")}]])]]]]]))
|
:parent-id (dm/str file-id "-action-menu")}]])]])]]]))
|
||||||
|
|
||||||
(mf/defc grid
|
(mf/defc grid
|
||||||
{::mf/props :obj}
|
{::mf/props :obj}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue