Merge pull request #6765 from miniak/menu-speaking-roles

Add macOS specific speaking roles for MenuItem
This commit is contained in:
Kevin Sawicki 2016-08-08 11:06:45 -07:00 committed by GitHub
commit 59ffe35781
5 changed files with 43 additions and 0 deletions

View file

@ -35,6 +35,8 @@ Role kRolesMap[] = {
{ @selector(delete:), "delete" }, { @selector(delete:), "delete" },
{ @selector(pasteAndMatchStyle:), "pasteandmatchstyle" }, { @selector(pasteAndMatchStyle:), "pasteandmatchstyle" },
{ @selector(selectAll:), "selectall" }, { @selector(selectAll:), "selectall" },
{ @selector(startSpeaking:), "startspeaking" },
{ @selector(stopSpeaking:), "stopspeaking" },
{ @selector(performMiniaturize:), "minimize" }, { @selector(performMiniaturize:), "minimize" },
{ @selector(performClose:), "close" }, { @selector(performClose:), "close" },
{ @selector(performZoom:), "zoom" }, { @selector(performZoom:), "zoom" },

View file

@ -217,6 +217,22 @@ app.once('ready', () => {
} }
] ]
}) })
template[1].submenu.push(
{
type: 'separator'
},
{
label: 'Speech',
submenu: [
{
role: 'startspeaking'
},
{
role: 'stopspeaking'
}
]
}
)
template[3].submenu = [ template[3].submenu = [
{ {
role: 'close' role: 'close'

View file

@ -63,6 +63,8 @@ On macOS `role` can also have following additional values:
* `hide` - Map to the `hide` action * `hide` - Map to the `hide` action
* `hideothers` - Map to the `hideOtherApplications` action * `hideothers` - Map to the `hideOtherApplications` action
* `unhide` - Map to the `unhideAllApplications` action * `unhide` - Map to the `unhideAllApplications` action
* `startspeaking` - Map to the `startSpeaking` action
* `stopspeaking` - Map to the `stopSpeaking` action
* `front` - Map to the `arrangeInFront` action * `front` - Map to the `arrangeInFront` action
* `zoom` - Map to the `performZoom` action * `zoom` - Map to the `performZoom` action
* `window` - The submenu is a "Window" menu * `window` - The submenu is a "Window" menu

View file

@ -133,6 +133,23 @@ if (process.platform === 'darwin') {
} }
] ]
}) })
// Edit menu.
template[1].submenu.push(
{
type: 'separator'
},
{
label: 'Speech',
submenu: [
{
role: 'startspeaking'
},
{
role: 'stopspeaking'
}
]
}
)
// Window menu. // Window menu.
template[3].submenu = [ template[3].submenu = [
{ {

View file

@ -80,6 +80,12 @@ const roles = {
services: { services: {
label: 'Services' label: 'Services'
}, },
startspeaking: {
label: 'Start Speaking'
},
stopspeaking: {
label: 'Stop Speaking'
},
togglefullscreen: { togglefullscreen: {
label: 'Toggle Full Screen', label: 'Toggle Full Screen',
accelerator: process.platform === 'darwin' ? 'Control+Command+F' : 'F11', accelerator: process.platform === 'darwin' ? 'Control+Command+F' : 'F11',