enhance(ui): refactor the context menu with the shui dropdown menu items

pull/11293/head
charlie 2024-04-25 15:25:47 +08:00
parent d0866fe4de
commit 1e13b67ab0
1 changed files with 26 additions and 26 deletions

View File

@ -353,32 +353,32 @@
(rum/defc block-ref-custom-context-menu-content (rum/defc block-ref-custom-context-menu-content
[block block-ref-id] [block block-ref-id]
(when (and block block-ref-id) (when (and block block-ref-id)
[:.menu-links-wrapper [:<>
(ui/menu-link (shui/dropdown-menu-item
{:key "open-in-sidebar" {:key "open-in-sidebar"
:on-click (fn [] :on-click (fn []
(state/sidebar-add-block! (state/sidebar-add-block!
(state/get-current-repo) (state/get-current-repo)
block-ref-id block-ref-id
:block-ref)) :block-ref))}
:shortcut ["⇧+click"]} (t :content/open-in-sidebar)
(t :content/open-in-sidebar)) (shui/dropdown-menu-shortcut ["⇧+click"]))
(ui/menu-link (shui/dropdown-menu-item
{:key "copy" {:key "copy"
:on-click (fn [] (editor-handler/copy-current-ref block-ref-id))} :on-click (fn [] (editor-handler/copy-current-ref block-ref-id))}
(t :content/copy-ref)) (t :content/copy-ref))
(ui/menu-link (shui/dropdown-menu-item
{:key "delete" {:key "delete"
:on-click (fn [] (editor-handler/delete-current-ref! block block-ref-id))} :on-click (fn [] (editor-handler/delete-current-ref! block block-ref-id))}
(t :content/delete-ref)) (t :content/delete-ref))
(ui/menu-link (shui/dropdown-menu-item
{:key "replace-with-text" {:key "replace-with-text"
:on-click (fn [] (editor-handler/replace-ref-with-text! block block-ref-id))} :on-click (fn [] (editor-handler/replace-ref-with-text! block block-ref-id))}
(t :content/replace-with-text)) (t :content/replace-with-text))
(ui/menu-link (shui/dropdown-menu-item
{:key "replace-with-embed" {:key "replace-with-embed"
:on-click (fn [] (editor-handler/replace-ref-with-embed! block block-ref-id))} :on-click (fn [] (editor-handler/replace-ref-with-embed! block block-ref-id))}
(t :content/replace-with-embed))])) (t :content/replace-with-embed))]))
(rum/defc page-title-custom-context-menu-content (rum/defc page-title-custom-context-menu-content
[page] [page]