fix: select only the current block when open its context-menu

pull/8878/head
Tienson Qin 2023-03-21 14:08:50 +08:00
parent de9ab536fe
commit 147de5e305
1 changed files with 4 additions and 1 deletions

View File

@ -18,6 +18,7 @@
[frontend.state :as state]
[frontend.ui :as ui]
[frontend.util :as util]
[frontend.modules.shortcut.core :as shortcut]
[logseq.graph-parser.util :as gp-util]
[logseq.graph-parser.util.block-ref :as block-ref]
[frontend.util.url :as url-util]
@ -83,6 +84,7 @@
#(swap! *template-including-parent? not))])
(rum/defcs block-template < rum/reactive
(shortcut/disable-all-shortcuts)
(rum/local false ::edit?)
(rum/local "" ::input)
{:will-unmount (fn [state]
@ -389,7 +391,8 @@
(and block-id (parse-uuid block-id))
(let [block (.closest target ".ls-block")]
(when block
(util/select-highlight! [block]))
(state/clear-selection!)
(state/conj-selection-block! block :down))
(common-handler/show-custom-context-menu!
e
(block-context-menu-content target (uuid block-id))))