Skip to content

Commit e516bd8

Browse files
author
Mark Moffat
committed
1 parent b743d34 commit e516bd8

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

electron.js

+23-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ const BrowserWindow = electron.BrowserWindow;
77
var express = require('./app.js');
88

99
const{dialog} = require('electron');
10+
const{Menu} = require('electron');
1011

1112
// Keep a global reference of the window object, if you don't, the window will
1213
// be closed automatically when the JavaScript object is garbage collected.
@@ -29,6 +30,28 @@ function createWindow(){
2930
// when you should delete the corresponding element.
3031
mainWindow = null;
3132
});
33+
34+
// Create the Application's main menu
35+
var template = [{
36+
label: 'Application',
37+
submenu: [
38+
{label: 'About Application', selector: 'orderFrontStandardAboutPanel:'},
39+
{type: 'separator'},
40+
{label: 'Quit', accelerator: 'Command+Q', click: function(){ app.quit(); }}
41+
]}, {
42+
label: 'Edit',
43+
submenu: [
44+
{label: 'Undo', accelerator: 'CmdOrCtrl+Z', selector: 'undo:'},
45+
{label: 'Redo', accelerator: 'Shift+CmdOrCtrl+Z', selector: 'redo:'},
46+
{type: 'separator'},
47+
{label: 'Cut', accelerator: 'CmdOrCtrl+X', selector: 'cut:'},
48+
{label: 'Copy', accelerator: 'CmdOrCtrl+C', selector: 'copy:'},
49+
{label: 'Paste', accelerator: 'CmdOrCtrl+V', selector: 'paste:'},
50+
{label: 'Select All', accelerator: 'CmdOrCtrl+A', selector: 'selectAll:'}
51+
]}
52+
];
53+
54+
Menu.setApplicationMenu(Menu.buildFromTemplate(template));
3255
}
3356

3457
// This method will be called when Electron has finished
@@ -41,7 +64,6 @@ app.on('ready', function (){
4164
});
4265
});
4366

44-
var errorOnStartup = false;
4567
express.on('errorAdminMongo', function (){
4668
dialog.showErrorBox('Error', 'Error starting adminMongo. Please ensure no other instances are running before trying again.');
4769
app.quit();

0 commit comments

Comments
 (0)