Browse Source

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

Tienson Qin 3 years ago
parent
commit
147de5e305
1 changed files with 4 additions and 1 deletions
  1. 4 1
      src/main/frontend/components/content.cljs

+ 4 - 1
src/main/frontend/components/content.cljs

@@ -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))))