From 00a99391aa77a9d6e1bdb1218fcfaeda8af46886 Mon Sep 17 00:00:00 2001 From: Tienson Qin Date: Thu, 28 Jan 2021 18:44:16 +0800 Subject: [PATCH] fix: copied text in linux will be treated as a file --- src/main/frontend/components/editor.cljs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/frontend/components/editor.cljs b/src/main/frontend/components/editor.cljs index 1bbcb023ee..843118e709 100644 --- a/src/main/frontend/components/editor.cljs +++ b/src/main/frontend/components/editor.cljs @@ -743,6 +743,13 @@ (fn [items] (if (util/electron?) (let [existed-file-path (js/window.apis.getFilePathFromClipboard) + existed-file-path (if (and + (string? existed-file-path) + (not util/mac?) + (not util/win32?)) ; FIXME: linuxcx + (when (re-find #"^(/[^/ ]*)+/?$" existed-file-path) + existed-file-path) + existed-file-path) has-file-path? (not (string/blank? existed-file-path)) has-image? (js/window.apis.isClipboardHasImage)] (if (or has-image? has-file-path?) @@ -758,7 +765,6 @@ items (or (.-items clipboard-data) (.-files clipboard-data)) picked (pick-one-allowed-item items)] - (js/console.log (get picked 1)) (if (get picked 1) (match picked [:asset file] (editor-handler/set-asset-pending-file file))))]