소스 검색

fix: click can't create block reference

Resolved #1337
Tienson Qin 5 년 전
부모
커밋
b9fd0ef7ab
2개의 변경된 파일3개의 추가작업 그리고 5개의 파일을 삭제
  1. 2 4
      src/main/frontend/components/editor.cljs
  2. 1 1
      src/main/frontend/handler/editor.cljs

+ 2 - 4
src/main/frontend/components/editor.cljs

@@ -150,10 +150,8 @@
              @editor-handler/*selected-text
              @editor-handler/*selected-text
              (when (> (count edit-content) current-pos)
              (when (> (count edit-content) current-pos)
                (subs edit-content pos current-pos)))
                (subs edit-content pos current-pos)))
-          _ (p/let [matched-blocks (when-not (string/blank? q)
-                                     (editor-handler/get-matched-blocks q (:block/uuid edit-block)))]
-              (state/set-search-result! matched-blocks))
-          matched-blocks (state/sub :search/result)]
+          matched-blocks (when-not (string/blank? q)
+                           (editor-handler/get-matched-blocks q (:block/uuid edit-block)))]
       (when input
       (when input
         (let [chosen-handler (fn [chosen _click?]
         (let [chosen-handler (fn [chosen _click?]
                                (state/set-editor-show-block-search! false)
                                (state/set-editor-show-block-search! false)

+ 1 - 1
src/main/frontend/handler/editor.cljs

@@ -1776,7 +1776,7 @@
                                                       99)
                                                       99)
                                 (map (comp str :block/uuid))))
                                 (map (comp str :block/uuid))))
         current-and-parents (set/union #{(str (:block/uuid current-block))} block-parents)]
         current-and-parents (set/union #{(str (:block/uuid current-block))} block-parents)]
-    (p/let [result (search/block-search q 10)]
+    (let [result (search/block-search q 10)]
       (remove
       (remove
        (fn [h]
        (fn [h]
          (contains? current-and-parents (:block/uuid h)))
          (contains? current-and-parents (:block/uuid h)))