Incorporate review feedback

This commit is contained in:
Kevin Sawicki 2016-06-22 15:26:17 -07:00
parent be642612c0
commit 6165908ba7

View file

@ -3,27 +3,26 @@ const {app} = require('electron')
const roles = { const roles = {
about: { about: {
get label () { get label () {
return `About ${app.getName()}` return process.platform === 'linux' ? 'About' : `About ${app.getName()}`
} }
}, },
close: { close: {
label: 'Close', label: 'Close',
accelerator: 'CmdOrCtrl+W', accelerator: 'CommandOrControl+W',
windowMethod: 'close' windowMethod: 'close'
}, },
copy: { copy: {
label: 'Copy', label: 'Copy',
accelerator: 'CmdOrCtrl+C', accelerator: 'CommandOrControl+C',
webContentsMethod: 'copy' webContentsMethod: 'copy'
}, },
cut: { cut: {
label: 'Cut', label: 'Cut',
accelerator: 'CmdOrCtrl+X', accelerator: 'CommandOrControl+X',
webContentsMethod: 'cut' webContentsMethod: 'cut'
}, },
delete: { delete: {
label: 'Delete', label: 'Delete',
accelerator: 'Delete',
webContentsMethod: 'delete' webContentsMethod: 'delete'
}, },
front: { front: {
@ -44,34 +43,38 @@ const roles = {
}, },
minimize: { minimize: {
label: 'Minimize', label: 'Minimize',
accelerator: 'CmdOrCtrl+M', accelerator: 'CommandOrControl+M',
windowMethod: 'minimize' windowMethod: 'minimize'
}, },
paste: { paste: {
label: 'Paste', label: 'Paste',
accelerator: 'CmdOrCtrl+V', accelerator: 'CommandOrControl+V',
webContentsMethod: 'paste' webContentsMethod: 'paste'
}, },
pasteandmatchstyle: { pasteandmatchstyle: {
label: 'Paste and Match Style', label: 'Paste and Match Style',
accelerator: 'Shift+Command+V', accelerator: 'Shift+CommandOrControl+V',
webContentsMethod: 'pasteAndMatchStyle' webContentsMethod: 'pasteAndMatchStyle'
}, },
quit: { quit: {
get label () { get label () {
return process.platform === 'win32' ? 'Exit' : `Quit ${app.getName()}` switch (process.platform) {
case 'darwin': return `Quit ${app.getName()}`
case 'win32': return 'Exit'
default: return 'Quit'
}
}, },
accelerator: process.platform === 'win32' ? null : 'Command+Q', accelerator: process.platform === 'win32' ? null : 'Command+Q',
appMethod: 'quit' appMethod: 'quit'
}, },
redo: { redo: {
label: 'Redo', label: 'Redo',
accelerator: 'Shift+CmdOrCtrl+Z', accelerator: 'Shift+CommandOrControl+Z',
webContentsMethod: 'redo' webContentsMethod: 'redo'
}, },
selectall: { selectall: {
label: 'Select All', label: 'Select All',
accelerator: 'CmdOrCtrl+A', accelerator: 'CommandOrControl+A',
webContentsMethod: 'selectAll' webContentsMethod: 'selectAll'
}, },
services: { services: {
@ -86,7 +89,7 @@ const roles = {
}, },
undo: { undo: {
label: 'Undo', label: 'Undo',
accelerator: 'CmdOrCtrl+Z', accelerator: 'CommandOrControl+Z',
webContentsMethod: 'undo' webContentsMethod: 'undo'
}, },
unhide: { unhide: {
@ -100,7 +103,7 @@ const roles = {
} }
} }
exports.getDefaultLabel = function (role) { exports.getDefaultLabel = (role) => {
if (roles.hasOwnProperty(role)) { if (roles.hasOwnProperty(role)) {
return roles[role].label return roles[role].label
} else { } else {
@ -108,11 +111,11 @@ exports.getDefaultLabel = function (role) {
} }
} }
exports.getDefaultAccelerator = function (role) { exports.getDefaultAccelerator = (role) => {
if (roles.hasOwnProperty(role)) return roles[role].accelerator if (roles.hasOwnProperty(role)) return roles[role].accelerator
} }
exports.execute = function (role, focusedWindow) { exports.execute = (role, focusedWindow) => {
if (!roles.hasOwnProperty(role)) return false if (!roles.hasOwnProperty(role)) return false
if (process.platform === 'darwin') return false if (process.platform === 'darwin') return false