restore menuItems roles that were fixed

This commit is contained in:
Araxeus
2021-05-15 17:24:01 +03:00
parent 090ca828c0
commit 541c7f34b7
3 changed files with 26 additions and 63 deletions

74
menu.js
View File

@ -172,19 +172,21 @@ const mainMenuTemplate = (win) => [
}, },
}, },
{ type: "separator" }, { type: "separator" },
{ is.macOS() ?
label: "Toggle DevTools", {
// Cannot use "toggleDevTools" role in MacOS label: "Toggle DevTools",
click: () => { // Cannot use "toggleDevTools" role in MacOS
const { webContents } = win; click: () => {
if (webContents.isDevToolsOpened()) { const { webContents } = win;
webContents.closeDevTools(); if (webContents.isDevToolsOpened()) {
} else { webContents.closeDevTools();
const devToolsOptions = {}; } else {
webContents.openDevTools(devToolsOptions); const devToolsOptions = {};
} webContents.openDevTools(devToolsOptions);
}, }
}, },
} :
{ role: "toggleDevTools" },
{ {
label: "Edit config.json", label: "Edit config.json",
click: () => { click: () => {
@ -198,41 +200,12 @@ const mainMenuTemplate = (win) => [
{ {
label: "View", label: "View",
submenu: [ submenu: [
{ { role: "reload" },
label: "Reload", { role: "forceReload" },
click: () => {
win.webContents.reload();
},
},
{
label: "Force Reload",
click: () => {
win.webContents.reloadIgnoringCache();
},
},
{ type: "separator" }, { type: "separator" },
{ { role: "zoomIn" },
label: "Zoom In", { role: "zoomOut" },
click: () => { { role: "resetZoom" },
win.webContents.setZoomLevel(
win.webContents.getZoomLevel() + 1
);
},
},
{
label: "Zoom Out",
click: () => {
win.webContents.setZoomLevel(
win.webContents.getZoomLevel() - 1
);
},
},
{
label: "Reset Zoom",
click: () => {
win.webContents.setZoomLevel(0);
},
},
], ],
}, },
{ {
@ -261,12 +234,7 @@ const mainMenuTemplate = (win) => [
app.quit(); app.quit();
}, },
}, },
{ { role: "quit" },
label: "Quit App",
click: () => {
app.quit();
},
},
], ],
}, },
]; ];

View File

@ -63,12 +63,7 @@ module.exports.setUpTray = (app, win) => {
app.quit(); app.quit();
}, },
}, },
{ { role: "quit" }
label: "Quit",
click: () => {
app.quit();
},
},
]; ];
const trayMenu = Menu.buildFromTemplate(template); const trayMenu = Menu.buildFromTemplate(template);

View File

@ -2877,10 +2877,10 @@ cssstyle@^2.2.0:
dependencies: dependencies:
cssom "~0.3.6" cssom "~0.3.6"
custom-electron-titlebar@^3.2.6: custom-electron-titlebar@^3.2.7:
version "3.2.6" version "3.2.7"
resolved "https://registry.yarnpkg.com/custom-electron-titlebar/-/custom-electron-titlebar-3.2.6.tgz#4cd064efa5020954c09732efa8c667a7ee3636e3" resolved "https://registry.yarnpkg.com/custom-electron-titlebar/-/custom-electron-titlebar-3.2.7.tgz#fb249d6180cbda074b1d392bea755fa0743012a8"
integrity sha512-P3ZGEr0eouUHqhdBBXllpuy2bFhfSmp+32HQBPcwzujjIsUhQxQj/nCpJiFa4SUGAEp1ifu/icuZdDKNNX72Tw== integrity sha512-KO/6e3r6YflfNUOzi5QHLwkLHBP+ICtHPo70u/kUIKR8UUkDTPb4a9i19q0uDZQcjkH6oqRvFCz9wEHeEpCgxw==
dashdash@^1.12.0: dashdash@^1.12.0:
version "1.14.1" version "1.14.1"