From 25b2724ab94e775229fe40e32d9409f0f5dd10c4 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 22 Jun 2016 10:29:49 -0700 Subject: [PATCH] Add menu item role defaults --- filenames.gypi | 1 + lib/browser/api/menu-item-roles.js | 65 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+) create mode 100644 lib/browser/api/menu-item-roles.js diff --git a/filenames.gypi b/filenames.gypi index af70808..6b086e1 100644 --- a/filenames.gypi +++ b/filenames.gypi @@ -21,6 +21,7 @@ 'lib/browser/api/ipc-main.js', 'lib/browser/api/menu.js', 'lib/browser/api/menu-item.js', + 'lib/browser/api/menu-item-roles.js', 'lib/browser/api/navigation-controller.js', 'lib/browser/api/power-monitor.js', 'lib/browser/api/power-save-blocker.js', diff --git a/lib/browser/api/menu-item-roles.js b/lib/browser/api/menu-item-roles.js new file mode 100644 index 0000000..13484e5 --- /dev/null +++ b/lib/browser/api/menu-item-roles.js @@ -0,0 +1,65 @@ +module.exports = { + undo: { + label: 'Undo', + accelerator: 'CmdOrCtrl+Z', + method: 'undo' + }, + redo: { + label: 'Redo', + accelerator: 'Shift+CmdOrCtrl+Z', + method: 'redo' + }, + cut: { + label: 'Cut', + accelerator: 'CmdOrCtrl+X', + method: 'cut' + }, + copy: { + label: 'Copy', + accelerator: 'CmdOrCtrl+C', + method: 'copy' + }, + paste: { + label: 'Paste', + accelerator: 'CmdOrCtrl+V', + method: 'paste' + }, + pasteandmatchstyle: { + label: 'Paste and Match Style', + accelerator: 'Shift+Command+V', + method: 'pasteAndMatchStyle' + }, + selectall: { + label: 'Select All', + accelerator: 'CmdOrCtrl+A', + method: 'selectAll' + }, + minimize: { + label: 'Minimize', + accelerator: 'CmdOrCtrl+M', + method: 'minimize' + }, + close: { + label: 'Close', + accelerator: 'CmdOrCtrl+W', + method: 'close' + }, + delete: { + label: 'Delete', + accelerator: 'Delete', + method: 'delete' + }, + quit: { + get label () { + const {app} = require('electron') + return process.platform === 'win32' ? 'Exit' : `Quit ${app.getName()}` + }, + accelerator: process.platform === 'win32' ? null : 'Command+Q', + method: 'quit' + }, + togglefullscreen: { + label: 'Toggle Full Screen', + accelerator: process.platform === 'darwin' ? 'Ctrl+Command+F' : 'F11', + method: 'toggleFullScreen' + } +} -- 2.7.4