瀏覽代碼

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

Tienson Qin 3 年之前
父節點
當前提交
5bac3be317
共有 1 個文件被更改,包括 3 次插入4 次删除
  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."