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

View File

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

View File

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