fix: copied text in linux will be treated as a file

This commit is contained in:
Tienson Qin
2021-01-28 18:44:16 +08:00
parent f83cfd15fa
commit 00a99391aa

View File

@@ -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))))]