Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions app/main/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ function getToolsSubmenu(): MenuItemConstructorOptions[] {
accelerator:
process.platform === "darwin" ? "Alt+Command+I" : "Ctrl+Shift+I",
click(_item, focusedWindow) {
if (focusedWindow) {
if (focusedWindow && focusedWindow instanceof BrowserWindow) {
focusedWindow.webContents.openDevTools({mode: "undocked"});
}
},
Expand Down Expand Up @@ -222,7 +222,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
{
label: t.__("Toggle Tray Icon"),
click(_item, focusedWindow) {
if (focusedWindow) {
if (focusedWindow && focusedWindow instanceof BrowserWindow) {
send(focusedWindow.webContents, "toggletray");
}
},
Expand All @@ -231,7 +231,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
label: t.__("Toggle Sidebar"),
accelerator: "CommandOrControl+Shift+S",
click(_item, focusedWindow) {
if (focusedWindow) {
if (focusedWindow && focusedWindow instanceof BrowserWindow) {
const newValue = !ConfigUtil.getConfigItem("showSidebar", true);
send(focusedWindow.webContents, "toggle-sidebar", newValue);
ConfigUtil.setConfigItem("showSidebar", newValue);
Expand All @@ -243,7 +243,7 @@ function getViewSubmenu(): MenuItemConstructorOptions[] {
checked: ConfigUtil.getConfigItem("autoHideMenubar", false),
visible: process.platform !== "darwin",
click(_item, focusedWindow) {
if (focusedWindow) {
if (focusedWindow && focusedWindow instanceof BrowserWindow) {
const newValue = !ConfigUtil.getConfigItem("autoHideMenubar", false);
focusedWindow.autoHideMenuBar = newValue;
focusedWindow.setMenuBarVisibility(!newValue);
Expand Down
13 changes: 8 additions & 5 deletions app/renderer/js/components/webview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ export default class WebView {
}

back(): void {
if (this.getWebContents().canGoBack()) {
this.getWebContents().goBack();
if (this.getWebContents().navigationHistory.canGoBack()) {
this.getWebContents().navigationHistory.goBack();
this.focus();
}
}
Expand All @@ -194,12 +194,15 @@ export default class WebView {
const $backButton = document.querySelector(
"#actions-container #back-action",
)!;
$backButton.classList.toggle("disable", !this.getWebContents().canGoBack());
$backButton.classList.toggle(
"disable",
!this.getWebContents().navigationHistory.canGoBack(),
);
}

forward(): void {
if (this.getWebContents().canGoForward()) {
this.getWebContents().goForward();
if (this.getWebContents().navigationHistory.canGoForward()) {
this.getWebContents().navigationHistory.goForward();
}
}

Expand Down
Loading