From 3b787c1aa451051dc239d5bf8d11c6cf9112e345 Mon Sep 17 00:00:00 2001 From: dragonwocky Date: Sun, 5 Dec 2021 17:54:29 +1100 Subject: [PATCH] menu: handle external links, force open new windows --- insert/api | 2 +- insert/repo | 2 +- insert/worker.cjs | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/insert/api b/insert/api index f6ba894..02d4357 160000 --- a/insert/api +++ b/insert/api @@ -1 +1 @@ -Subproject commit f6ba894c4ffe737aafd487013a46a589ee09fbac +Subproject commit 02d4357c85075bfbb3ddbb7fa0fde3600ee5cb60 diff --git a/insert/repo b/insert/repo index 6ab3013..8eb2810 160000 --- a/insert/repo +++ b/insert/repo @@ -1 +1 @@ -Subproject commit 6ab30139be95bca0d3cffdb8d5127da36624bab4 +Subproject commit 8eb2810a1bedb96ea82e20dadefdcd328b6978f9 diff --git a/insert/worker.cjs b/insert/worker.cjs index 03c8657..85e358c 100644 --- a/insert/worker.cjs +++ b/insert/worker.cjs @@ -49,6 +49,11 @@ module.exports.focusMenu = async () => { appQuit = true; }); + enhancerMenu.webContents.on('new-window', (e, url) => { + e.preventDefault(); + require('electron').shell.openExternal(url); + }); + const trayID = 'f96f4a73-21af-4e3f-a68f-ab4976b020da', runInBackground = (await registry.enabled(trayID)) && @@ -67,7 +72,7 @@ module.exports.focusNotion = () => { { BrowserWindow } = require('electron'), { createWindow } = env.notionRequire('main/createWindow.js'); let window = BrowserWindow.getAllWindows().find((win) => win.id !== enhancerMenu.id); - if (!window) window = createWindow(); + if (!window) window = createWindow('', null, true); window.show(); };