Skip to content

Commit

Permalink
fix: copied text in linux will be treated as a file
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Jan 28, 2021
1 parent f83cfd1 commit 00a9939
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/main/frontend/components/editor.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -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?)
Expand All @@ -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))))]
Expand Down

0 comments on commit 00a9939

Please sign in to comment.