瀏覽代碼

fix: don't open link in editing mode

Tienson Qin 3 年之前
父節點
當前提交
ca9cecc7d5
共有 1 個文件被更改,包括 8 次插入9 次删除
  1. 8 9
      src/main/frontend/handler/ui.cljs

+ 8 - 9
src/main/frontend/handler/ui.cljs

@@ -229,15 +229,14 @@
 
 (defn auto-complete-open-link
   [state e]
-  (let [[matched {:keys [on-chosen-open-link]}] (:rum/args state)
-        current-idx (get state :frontend.ui/current-idx)]
-    (util/stop e)
-    ;; FIXME: on-chosen-open-link might be nil
-    (when (and on-chosen-open-link
-               (seq matched)
-               (> (count matched)
-                  @current-idx))
-      (on-chosen-open-link (nth matched @current-idx) false))))
+  (let [[matched {:keys [on-chosen-open-link]}] (:rum/args state)]
+    (when (and on-chosen-open-link (not (state/editing?)))
+      (let [current-idx (get state :frontend.ui/current-idx)]
+        (util/stop e)
+        (when (and (seq matched)
+                   (> (count matched)
+                      @current-idx))
+          (on-chosen-open-link (nth matched @current-idx) false))))))
 
 ;; date-picker
 ;; TODO: find a better way