@@ -172,19 +172,21 @@ const mainMenuTemplate = (win) => [
172
172
} ,
173
173
} ,
174
174
{ 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" } ,
188
190
{
189
191
label : "Edit config.json" ,
190
192
click : ( ) => {
@@ -198,41 +200,12 @@ const mainMenuTemplate = (win) => [
198
200
{
199
201
label : "View" ,
200
202
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" } ,
213
205
{ 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" } ,
236
209
] ,
237
210
} ,
238
211
{
@@ -261,12 +234,7 @@ const mainMenuTemplate = (win) => [
261
234
app . quit ( ) ;
262
235
} ,
263
236
} ,
264
- {
265
- label : "Quit App" ,
266
- click : ( ) => {
267
- app . quit ( ) ;
268
- } ,
269
- } ,
237
+ { role : "quit" } ,
270
238
] ,
271
239
} ,
272
240
] ;
0 commit comments