Skip to content

Commit

Permalink
fix: copy && paste file not working well on linux
Browse files Browse the repository at this point in the history
  • Loading branch information
tiensonqin committed Jan 28, 2021
1 parent 83fda19 commit f83cfd1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 4 additions & 2 deletions resources/js/preload.js
Expand Up @@ -9,9 +9,11 @@ function getFilePathFromClipboard () {
if (IS_WIN32) {
const rawFilePath = clipboard.read('FileNameW')
return rawFilePath.replace(new RegExp(String.fromCharCode(0), 'g'), '')
} else if (IS_MAC) {
return clipboard.read('public.file-url').replace('file://', '')
} else{
return clipboard.readText()
}

return clipboard.read('public.file-url').replace('file://', '')
}

function isClipboardHasImage () {
Expand Down
1 change: 0 additions & 1 deletion src/main/frontend/components/editor.cljs
Expand Up @@ -742,7 +742,6 @@
(let [pick-one-allowed-item
(fn [items]
(if (util/electron?)

(let [existed-file-path (js/window.apis.getFilePathFromClipboard)
has-file-path? (not (string/blank? existed-file-path))
has-image? (js/window.apis.isClipboardHasImage)]
Expand Down

0 comments on commit f83cfd1

Please sign in to comment.