Procházet zdrojové kódy

fix: copy paste inside logseq

related to #5522, #5533
Tienson Qin před 3 roky
rodič
revize
10d2adc0ec
2 změnil soubory, kde provedl 5 přidání a 4 odebrání
  1. 4 4
      src/main/frontend/handler/editor.cljs
  2. 1 0
      yarn.lock

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

@@ -2888,7 +2888,7 @@
     (notification/show! (util/format "No macro is available for %s" url) :warning)))
     (notification/show! (util/format "No macro is available for %s" url) :warning)))
 
 
 (defn- paste-copied-blocks-or-text
 (defn- paste-copied-blocks-or-text
-  [text e]
+  [initial-text text e]
   (let [copied-blocks (state/get-copied-blocks)
   (let [copied-blocks (state/get-copied-blocks)
         copied-block-ids (:copy/block-ids copied-blocks)
         copied-block-ids (:copy/block-ids copied-blocks)
         copied-graph (:copy/graph copied-blocks)
         copied-graph (:copy/graph copied-blocks)
@@ -2900,9 +2900,9 @@
        (= copied-graph (state/get-current-repo))
        (= copied-graph (state/get-current-repo))
        (or (seq copied-block-ids)
        (or (seq copied-block-ids)
            (seq (:copy/full-blocks copied-blocks)))
            (seq (:copy/full-blocks copied-blocks)))
-       text
+       initial-text
        ;; not copied from the external clipboard
        ;; not copied from the external clipboard
-       (= (string/replace (string/trim text) "\r" "")
+       (= (string/replace (string/trim initial-text) "\r" "")
           (string/replace (string/trim (or (:copy/content copied-blocks) "")) "\r" "")))
           (string/replace (string/trim (or (:copy/content copied-blocks) "")) "\r" "")))
       (let [blocks (or
       (let [blocks (or
                     (:copy/full-blocks copied-blocks)
                     (:copy/full-blocks copied-blocks)
@@ -2976,7 +2976,7 @@
           (when-not (mobile-util/native-ios?)
           (when-not (mobile-util/native-ios?)
             (util/stop e)
             (util/stop e)
             (paste-text-in-one-block-at-point))
             (paste-text-in-one-block-at-point))
-          (paste-copied-blocks-or-text text e))
+          (paste-copied-blocks-or-text initial-text text e))
         (let [_handled
         (let [_handled
               (let [clipboard-data (gobj/get e "clipboardData")
               (let [clipboard-data (gobj/get e "clipboardData")
                     files (.-files clipboard-data)]
                     files (.-files clipboard-data)]

+ 1 - 0
yarn.lock

@@ -561,6 +561,7 @@
 
 
 "@capacitor/haptics@^1.1.4":
 "@capacitor/haptics@^1.1.4":
   version "1.1.4"
   version "1.1.4"
+  resolved "https://registry.yarnpkg.com/@capacitor/haptics/-/haptics-1.1.4.tgz#80d5bc4776740a227a8cb83c85fac4db1316db8e"
   integrity sha512-+pJIb5X7xAcbrWj6rJaV+cwBlv8aFwB1/Ob6EV4atydThuuVSSsAL4hI4ZYlPNOxM6H5s+ZDLj7Pa2os4eFmtg==
   integrity sha512-+pJIb5X7xAcbrWj6rJaV+cwBlv8aFwB1/Ob6EV4atydThuuVSSsAL4hI4ZYlPNOxM6H5s+ZDLj7Pa2os4eFmtg==
 
 
 "@capacitor/[email protected]":
 "@capacitor/[email protected]":