mirror of
https://github.com/logseq/logseq.git
synced 2026-05-25 05:04:24 +00:00
fix: allow custom context menu
This commit is contained in:
committed by
Tienson Qin
parent
bdd1dbb937
commit
4282f21a62
@@ -354,38 +354,36 @@
|
||||
block-id (d/attr target "blockid")
|
||||
{:keys [block block-ref]} (state/sub :block-ref/context)
|
||||
{:keys [page]} (state/sub :page-title/context)]
|
||||
;; TODO: Find a better way to handle this on whiteboards
|
||||
(when-not (whiteboard-handler/inside-portal? target)
|
||||
(cond
|
||||
page
|
||||
(do
|
||||
(common-handler/show-custom-context-menu!
|
||||
e
|
||||
(page-title-custom-context-menu-content page))
|
||||
(state/set-state! :page-title/context nil))
|
||||
|
||||
block-ref
|
||||
(do
|
||||
(common-handler/show-custom-context-menu!
|
||||
e
|
||||
(block-ref-custom-context-menu-content block block-ref))
|
||||
(state/set-state! :block-ref/context nil))
|
||||
|
||||
(and (state/selection?) (not (d/has-class? target "bullet")))
|
||||
(cond
|
||||
page
|
||||
(do
|
||||
(common-handler/show-custom-context-menu!
|
||||
e
|
||||
(custom-context-menu-content))
|
||||
(page-title-custom-context-menu-content page))
|
||||
(state/set-state! :page-title/context nil))
|
||||
|
||||
(and block-id (parse-uuid block-id))
|
||||
(let [block (.closest target ".ls-block")]
|
||||
(when block
|
||||
(util/select-highlight! [block]))
|
||||
(common-handler/show-custom-context-menu!
|
||||
e
|
||||
(block-context-menu-content target (uuid block-id))))
|
||||
block-ref
|
||||
(do
|
||||
(common-handler/show-custom-context-menu!
|
||||
e
|
||||
(block-ref-custom-context-menu-content block block-ref))
|
||||
(state/set-state! :block-ref/context nil))
|
||||
|
||||
:else
|
||||
nil)))))))
|
||||
(and (state/selection?) (not (d/has-class? target "bullet")))
|
||||
(common-handler/show-custom-context-menu!
|
||||
e
|
||||
(custom-context-menu-content))
|
||||
|
||||
(and block-id (parse-uuid block-id))
|
||||
(let [block (.closest target ".ls-block")]
|
||||
(when block
|
||||
(util/select-highlight! [block]))
|
||||
(common-handler/show-custom-context-menu!
|
||||
e
|
||||
(block-context-menu-content target (uuid block-id))))
|
||||
|
||||
:else
|
||||
nil))))))
|
||||
[id {:keys [hiccup]}]
|
||||
[:div {:id id}
|
||||
(if hiccup
|
||||
|
||||
Reference in New Issue
Block a user