Skip to content

Commit 541c7f3

Browse files
committed
restore menuItems roles that were fixed
1 parent 090ca82 commit 541c7f3

File tree

3 files changed

+26
-63
lines changed

3 files changed

+26
-63
lines changed

menu.js

+21-53
Original file line numberDiff line numberDiff line change
@@ -172,19 +172,21 @@ const mainMenuTemplate = (win) => [
172172
},
173173
},
174174
{ type: "separator" },
175-
{
176-
label: "Toggle DevTools",
177-
// Cannot use "toggleDevTools" role in MacOS
178-
click: () => {
179-
const { webContents } = win;
180-
if (webContents.isDevToolsOpened()) {
181-
webContents.closeDevTools();
182-
} else {
183-
const devToolsOptions = {};
184-
webContents.openDevTools(devToolsOptions);
185-
}
186-
},
187-
},
175+
is.macOS() ?
176+
{
177+
label: "Toggle DevTools",
178+
// Cannot use "toggleDevTools" role in MacOS
179+
click: () => {
180+
const { webContents } = win;
181+
if (webContents.isDevToolsOpened()) {
182+
webContents.closeDevTools();
183+
} else {
184+
const devToolsOptions = {};
185+
webContents.openDevTools(devToolsOptions);
186+
}
187+
},
188+
} :
189+
{ role: "toggleDevTools" },
188190
{
189191
label: "Edit config.json",
190192
click: () => {
@@ -198,41 +200,12 @@ const mainMenuTemplate = (win) => [
198200
{
199201
label: "View",
200202
submenu: [
201-
{
202-
label: "Reload",
203-
click: () => {
204-
win.webContents.reload();
205-
},
206-
},
207-
{
208-
label: "Force Reload",
209-
click: () => {
210-
win.webContents.reloadIgnoringCache();
211-
},
212-
},
203+
{ role: "reload" },
204+
{ role: "forceReload" },
213205
{ type: "separator" },
214-
{
215-
label: "Zoom In",
216-
click: () => {
217-
win.webContents.setZoomLevel(
218-
win.webContents.getZoomLevel() + 1
219-
);
220-
},
221-
},
222-
{
223-
label: "Zoom Out",
224-
click: () => {
225-
win.webContents.setZoomLevel(
226-
win.webContents.getZoomLevel() - 1
227-
);
228-
},
229-
},
230-
{
231-
label: "Reset Zoom",
232-
click: () => {
233-
win.webContents.setZoomLevel(0);
234-
},
235-
},
206+
{ role: "zoomIn" },
207+
{ role: "zoomOut" },
208+
{ role: "resetZoom" },
236209
],
237210
},
238211
{
@@ -261,12 +234,7 @@ const mainMenuTemplate = (win) => [
261234
app.quit();
262235
},
263236
},
264-
{
265-
label: "Quit App",
266-
click: () => {
267-
app.quit();
268-
},
269-
},
237+
{ role: "quit" },
270238
],
271239
},
272240
];

tray.js

+1-6
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,7 @@ module.exports.setUpTray = (app, win) => {
6363
app.quit();
6464
},
6565
},
66-
{
67-
label: "Quit",
68-
click: () => {
69-
app.quit();
70-
},
71-
},
66+
{ role: "quit" }
7267
];
7368

7469
const trayMenu = Menu.buildFromTemplate(template);

yarn.lock

+4-4
Original file line numberDiff line numberDiff line change
@@ -2877,10 +2877,10 @@ cssstyle@^2.2.0:
28772877
dependencies:
28782878
cssom "~0.3.6"
28792879

2880-
custom-electron-titlebar@^3.2.6:
2881-
version "3.2.6"
2882-
resolved "https://registry.yarnpkg.com/custom-electron-titlebar/-/custom-electron-titlebar-3.2.6.tgz#4cd064efa5020954c09732efa8c667a7ee3636e3"
2883-
integrity sha512-P3ZGEr0eouUHqhdBBXllpuy2bFhfSmp+32HQBPcwzujjIsUhQxQj/nCpJiFa4SUGAEp1ifu/icuZdDKNNX72Tw==
2880+
custom-electron-titlebar@^3.2.7:
2881+
version "3.2.7"
2882+
resolved "https://registry.yarnpkg.com/custom-electron-titlebar/-/custom-electron-titlebar-3.2.7.tgz#fb249d6180cbda074b1d392bea755fa0743012a8"
2883+
integrity sha512-KO/6e3r6YflfNUOzi5QHLwkLHBP+ICtHPo70u/kUIKR8UUkDTPb4a9i19q0uDZQcjkH6oqRvFCz9wEHeEpCgxw==
28842884

28852885
dashdash@^1.12.0:
28862886
version "1.14.1"

0 commit comments

Comments
 (0)