From d6d66682f62d30be641d9c7f53143590aaebbeeb Mon Sep 17 00:00:00 2001 From: chh <1474479+chenhunghan@users.noreply.github.com> Date: Thu, 2 Sep 2021 14:21:36 +0300 Subject: [PATCH] Make back/forward/refresh work the same as the arrow button in topbar (#3720) 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(); + }); } }