Prechádzať zdrojové kódy

fix: don't open link in editing mode

Tienson Qin 3 rokov pred
rodič
commit
ca9cecc7d5
1 zmenil súbory, kde vykonal 8 pridanie a 9 odobranie
  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