Sfoglia il codice sorgente

enhance: highlight all blocks with the same id when pressing esc

Tienson Qin 3 anni fa
parent
commit
5bac3be317
1 ha cambiato i file con 3 aggiunte e 4 eliminazioni
  1. 3 4
      src/main/frontend/handler/editor.cljs

+ 3 - 4
src/main/frontend/handler/editor.cljs

@@ -1062,10 +1062,9 @@
 
 (defn select-block!
   [block-uuid]
-  (when-let [block (-> (str block-uuid)
-                       (js/document.getElementsByClassName)
-                       first)]
-    (state/exit-editing-and-set-selected-blocks! [block])))
+  (let [blocks (js/document.getElementsByClassName (str block-uuid))]
+    (when (seq blocks)
+      (state/exit-editing-and-set-selected-blocks! blocks))))
 
 (defn- blocks-with-level
   "Should be sorted already."