From 2978695b80413de7e0ba4549f9c75da4f45f0318 Mon Sep 17 00:00:00 2001 From: "Hung-Han (Henry) Chen" Date: Thu, 2 Sep 2021 13:49:48 +0300 Subject: [PATCH] Make back/forward/refresh work the same as the arrow button in topbar Signed-off-by: Hung-Han (Henry) Chen --- src/main/menu.ts | 4 ++-- src/main/window-manager.ts | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/menu.ts b/src/main/menu.ts index 34bd724d0a..92782cd3d0 100644 --- a/src/main/menu.ts +++ b/src/main/menu.ts @@ -188,14 +188,14 @@ export function buildMenu(windowManager: WindowManager) { label: "Back", accelerator: "CmdOrCtrl+[", click() { - webContents.getFocusedWebContents()?.goBack(); + webContents.getAllWebContents().filter(wc => wc.getType() === "window").forEach(wc => wc.goBack()); } }, { label: "Forward", accelerator: "CmdOrCtrl+]", click() { - webContents.getFocusedWebContents()?.goForward(); + webContents.getAllWebContents().filter(wc => wc.getType() === "window").forEach(wc => wc.goForward()); } }, { diff --git a/src/main/window-manager.ts b/src/main/window-manager.ts index 0822ed331a..b0014eac47 100644 --- a/src/main/window-manager.ts +++ b/src/main/window-manager.ts @@ -243,8 +243,10 @@ export class WindowManager extends Singleton { if (frameInfo) { this.sendToView({ channel: IpcRendererNavigationEvents.RELOAD_PAGE, frameInfo }); } else { - webContents.getFocusedWebContents()?.reload(); - webContents.getFocusedWebContents()?.clearHistory(); + webContents.getAllWebContents().filter(wc => wc.getType() === "window").forEach(wc => { + wc.reload(); + wc.clearHistory(); + }); } }