Merge pull request #6012 from miniak/menu-item-roles

Document 'zoom' role + add missing menu items (Delete / Paste and Match Style / Zoom)
This commit is contained in:
Cheng Zhao 2016-06-13 06:21:53 +00:00 committed by GitHub
commit 04479b40a7
3 changed files with 51 additions and 4 deletions

View file

@ -80,6 +80,15 @@ app.once('ready', () => {
accelerator: 'CmdOrCtrl+V', accelerator: 'CmdOrCtrl+V',
role: 'paste' role: 'paste'
}, },
{
label: 'Paste and Match Style',
accelerator: 'Shift+Command+V',
role: 'pasteandmatchstyle'
},
{
label: 'Delete',
role: 'delete'
},
{ {
label: 'Select All', label: 'Select All',
accelerator: 'CmdOrCtrl+A', accelerator: 'CmdOrCtrl+A',
@ -210,7 +219,21 @@ app.once('ready', () => {
} }
] ]
}) })
template[3].submenu.push( template[3].submenu = [
{
label: 'Close',
accelerator: 'CmdOrCtrl+W',
role: 'close'
},
{
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
role: 'minimize'
},
{
label: 'Zoom',
role: 'zoom'
},
{ {
type: 'separator' type: 'separator'
}, },
@ -218,7 +241,7 @@ app.once('ready', () => {
label: 'Bring All to Front', label: 'Bring All to Front',
role: 'front' role: 'front'
} }
) ]
} }
const menu = Menu.buildFromTemplate(template) const menu = Menu.buildFromTemplate(template)

View file

@ -59,6 +59,7 @@ On OS X `role` can also have following additional values:
* `hideothers` - Map to the `hideOtherApplications` action * `hideothers` - Map to the `hideOtherApplications` action
* `unhide` - Map to the `unhideAllApplications` action * `unhide` - Map to the `unhideAllApplications` action
* `front` - Map to the `arrangeInFront` action * `front` - Map to the `arrangeInFront` action
* `zoom` - Map to the `performZoom` action
* `window` - The submenu is a "Window" menu * `window` - The submenu is a "Window" menu
* `help` - The submenu is a "Help" menu * `help` - The submenu is a "Help" menu
* `services` - The submenu is a "Services" menu * `services` - The submenu is a "Services" menu

View file

@ -66,6 +66,15 @@ const template = [
accelerator: 'CmdOrCtrl+V', accelerator: 'CmdOrCtrl+V',
role: 'paste' role: 'paste'
}, },
{
label: 'Paste and Match Style',
accelerator: 'Shift+Command+V',
role: 'pasteandmatchstyle'
},
{
label: 'Delete',
role: 'delete'
},
{ {
label: 'Select All', label: 'Select All',
accelerator: 'CmdOrCtrl+A', accelerator: 'CmdOrCtrl+A',
@ -174,7 +183,21 @@ if (process.platform === 'darwin') {
] ]
}); });
// Window menu. // Window menu.
template[3].submenu.push( template[3].submenu = [
{
label: 'Close',
accelerator: 'CmdOrCtrl+W',
role: 'close'
},
{
label: 'Minimize',
accelerator: 'CmdOrCtrl+M',
role: 'minimize'
},
{
label: 'Zoom',
role: 'zoom'
},
{ {
type: 'separator' type: 'separator'
}, },
@ -182,7 +205,7 @@ if (process.platform === 'darwin') {
label: 'Bring All to Front', label: 'Bring All to Front',
role: 'front' role: 'front'
} }
); ];
} }
const menu = Menu.buildFromTemplate(template); const menu = Menu.buildFromTemplate(template);