From 407b821aca7da2b6525d40e4a9e17f7beb4ef015 Mon Sep 17 00:00:00 2001 From: Molunerfinn Date: Sun, 14 Apr 2019 22:07:33 +0800 Subject: [PATCH] :sparkles: Feature: add gui-api for remove event ISSUES CLOSED: #201 --- src/main/index.js | 18 ++++++++++-------- src/main/utils/picgoCoreIPC.js | 4 +++- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/src/main/index.js b/src/main/index.js index e9c528a43..95dc8cf88 100644 --- a/src/main/index.js +++ b/src/main/index.js @@ -540,15 +540,17 @@ app.on('ready', () => { globalShortcut.register(db.read().get('settings.shortKey.upload').value(), () => { uploadClipboardFiles() }) - let files = getUploadFiles() - if (files.length > 0) { // 如果有文件列表作为参数,说明是命令行启动 - let win - if (miniWindow && miniWindow.isVisible()) { - win = miniWindow - } else { - win = settingWindow || window || createSettingWindow() + if (process.env.NODE_ENV !== 'development') { + let files = getUploadFiles() + if (files.length > 0) { // 如果有文件列表作为参数,说明是命令行启动 + let win + if (miniWindow && miniWindow.isVisible()) { + win = miniWindow + } else { + win = settingWindow || window || createSettingWindow() + } + uploadChoosedFiles(win.webContents, files) } - uploadChoosedFiles(win.webContents, files) } }) diff --git a/src/main/utils/picgoCoreIPC.js b/src/main/utils/picgoCoreIPC.js index 89190b2d0..ecb6fe5d1 100644 --- a/src/main/utils/picgoCoreIPC.js +++ b/src/main/utils/picgoCoreIPC.js @@ -181,7 +181,9 @@ const handleRemoveFiles = (ipcMain, CONFIG_PATH) => { ipcMain.on('removeFiles', (event, files) => { const picgo = new PicGo(CONFIG_PATH) const guiApi = new GuiApi(ipcMain, event.sender, picgo) - picgo.emit('remove', files, guiApi) + setTimeout(() => { + picgo.emit('remove', files, guiApi) + }, 500) }) }