From d3b73be59698ee25e7041f05ba719ca117ca0c1e Mon Sep 17 00:00:00 2001 From: Vit Stanislav Date: Mon, 24 Apr 2017 11:08:37 +0200 Subject: [PATCH] Add more menu items to Electron wrapper #134 --- app/main.js | 106 ++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 91 insertions(+), 15 deletions(-) diff --git a/app/main.js b/app/main.js index 140a3c4e3..d58658762 100644 --- a/app/main.js +++ b/app/main.js @@ -36,11 +36,92 @@ function createWindow() { { role: 'paste', }, + { + role: 'pasteandmatchstyle', + }, + { + role: 'delete', + }, { role: 'selectall', }, ], }, + { + label: 'View', + submenu: [ + { + role: 'reload', + }, + { + type: 'separator', + }, + { + role: 'togglefullscreen', + }, + { + type: 'separator', + }, + { + role: 'resetzoom', + }, + { + role: 'zoomin', + }, + { + role: 'zoomout', + }, + ], + }, + { + label: 'Window', + submenu: [ + { + role: 'minimize', + }, + ], + }, + { + label: 'Help', + submenu: [ + { + label: 'Official Lisk Website', + click: function () { + electron.shell.openExternal('https://lisk.io'); + } + }, + { + type: 'separator', + }, + { + label: 'Lisk Chat', + click: function () { + electron.shell.openExternal('https://lisk.chat'); + } + }, + { + label: 'Lisk Forum', + click: function () { + electron.shell.openExternal('https://forum.lisk.io'); + } + }, + { + label: 'Report Issue', + click: function () { + electron.shell.openExternal('https://github.com/LiskHQ/lisk-nano/issues/new'); + } + }, + { + type: 'separator', + }, + { + label: 'What\'s new', + click: function () { + electron.shell.openExternal('https://github.com/LiskHQ/lisk-nano/releases'); + } + }, + ], + }, ]; if (process.platform === 'darwin') { @@ -60,23 +141,18 @@ function createWindow() { ], }); } else { - template.push({ - label: "Help", - submenu: [ - { - label: 'About', - click: function (item, focusedWindow) { - if (focusedWindow) { - const options = { - buttons: ['OK'], - icon: `${__dirname}/assets/lisk.png`, - message: `Lisk Nano\nVersion ${app.getVersion()}\nCopyright © 2017 Lisk Foundation`, - } - electron.dialog.showMessageBox(focusedWindow, options, function () {}) - } + template[template.length - 1].submenu.push({ + label: 'About', + click: function (item, focusedWindow) { + if (focusedWindow) { + const options = { + buttons: ['OK'], + icon: `${__dirname}/assets/lisk.png`, + message: `Lisk Nano\nVersion ${app.getVersion()}\nCopyright © 2017 Lisk Foundation`, } + electron.dialog.showMessageBox(focusedWindow, options, function () {}) } - ] + } }); }