Selaa lähdekoodia

fix(editor): paste url handling

Andelf 3 vuotta sitten
vanhempi
sitoutus
30d3b6183d
1 muutettua tiedostoa jossa 6 lisäystä ja 4 poistoa
  1. 6 4
      src/main/frontend/handler/editor.cljs

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

@@ -2891,7 +2891,9 @@
     (util/format "{{twitter %s}}" url)
     (util/format "{{twitter %s}}" url)
 
 
     :else
     :else
-    (notification/show! (util/format "No macro is available for %s" url) :warning)))
+    (do
+      (notification/show! (util/format "No macro is available for %s" url) :warning)
+      nil)))
 
 
 (defn- paste-copied-blocks-or-text
 (defn- paste-copied-blocks-or-text
   [initial-text text e]
   [initial-text text e]
@@ -2968,9 +2970,9 @@
   (utils/getClipText
   (utils/getClipText
    (fn [clipboard-data]
    (fn [clipboard-data]
      (when-let [_ (state/get-input)]
      (when-let [_ (state/get-input)]
-       (let [data (if (gp-util/url? clipboard-data)
-                        (wrap-macro-url clipboard-data)
-                        clipboard-data)]
+       (let [data (or (when (gp-util/url? clipboard-data)
+                        (wrap-macro-url clipboard-data))
+                      clipboard-data)]
          (insert data true))))
          (insert data true))))
    (fn [error]
    (fn [error]
      (js/console.error error))))
      (js/console.error error))))