fix: image paste

This commit is contained in:
Tienson Qin
2021-10-08 22:56:50 +08:00
parent a71fecdde7
commit 8823b624d9
2 changed files with 3 additions and 2 deletions

View File

@@ -115,7 +115,7 @@ contextBridge.exposeInMainWorld('apis', {
await fs.promises.mkdir(assetsRoot, { recursive: true })
from = decodeURIComponent(from || getFilePathFromClipboard())
from = from && decodeURIComponent(from || getFilePathFromClipboard())
if (from) {
// console.debug('copy file: ', from, dest)

View File

@@ -1505,7 +1505,8 @@
filename (str path "/" filename)]
;(js/console.debug "Write asset #" dir filename file)
(if (util/electron?)
(let [from (.-path file)]
(let [from (.-path file)
from (if (string/blank? from) nil from)]
(p/then (js/window.apis.copyFileToAssets dir filename from)
#(p/resolved [filename (if (string? %) (js/File. #js[] %) file) (.join util/node-path dir filename)])))
(p/then (fs/write-file! repo dir filename (.stream file) nil)