From 3d841ef8fe762c3747522ed9146181a55a6e3037 Mon Sep 17 00:00:00 2001 From: Jan Prochazka Date: Thu, 16 Dec 2021 15:41:34 +0100 Subject: [PATCH] removed dependencies on electron remote --- app/src/electron.js | 18 +++++++ .../web/src/appobj/DatabaseAppObject.svelte | 2 +- .../web/src/commands/CommandPalette.svelte | 6 +-- .../commands/changeDatabaseStatusCommand.ts | 3 +- packages/web/src/commands/stdCommands.ts | 47 +++++++++---------- .../forms/FormElectronFileSelectorRaw.svelte | 4 +- .../web/src/impexp/ElectronFilesInput.svelte | 4 +- packages/web/src/modals/FavoriteModal.svelte | 4 +- packages/web/src/modals/SaveFileModal.svelte | 4 +- .../web/src/query/RunnerOutputFiles.svelte | 6 +-- .../web/src/utility/exportElectronFile.ts | 6 +-- packages/web/src/utility/getElectron.ts | 25 +++++++++- packages/web/src/utility/openArchiveFolder.ts | 2 +- packages/web/src/utility/openElectronFile.ts | 4 +- packages/web/src/widgets/TabsPanel.svelte | 6 +-- 15 files changed, 87 insertions(+), 54 deletions(-) diff --git a/app/src/electron.js b/app/src/electron.js index 2c3deb64..72b6b6e2 100644 --- a/app/src/electron.js +++ b/app/src/electron.js @@ -148,6 +148,24 @@ ipcMain.on('update-commands', async (event, arg) => { menu.enabled = command.enabled; } }); +ipcMain.on('close-window', async (event, arg) => { + mainWindow.close(); +}); + +ipcMain.handle('showOpenDialog', async (event, options) => { + const res = electron.dialog.showOpenDialogSync(mainWindow, options); + return res; +}); +ipcMain.handle('showSaveDialog', async (event, options) => { + const res = electron.dialog.showSaveDialogSync(mainWindow, options); + return res; +}); +ipcMain.handle('showItemInFolder', async (event, path) => { + electron.shell.showItemInFolder(path); +}); +ipcMain.handle('openExternal', async (event, url) => { + electron.shell.openExternal(url); +}); function createWindow() { const bounds = store.get('winBounds'); diff --git a/packages/web/src/appobj/DatabaseAppObject.svelte b/packages/web/src/appobj/DatabaseAppObject.svelte index 218ea76b..e0122233 100644 --- a/packages/web/src/appobj/DatabaseAppObject.svelte +++ b/packages/web/src/appobj/DatabaseAppObject.svelte @@ -1,6 +1,5 @@