Skip to content

Commit 04479b4

Browse files
authored
Merge pull request electron#6012 from miniak/menu-item-roles
Document 'zoom' role + add missing menu items (Delete / Paste and Match Style / Zoom)
2 parents 33a69fe + f5699ad commit 04479b4

File tree

3 files changed

+51
-4
lines changed

3 files changed

+51
-4
lines changed

default_app/main.js

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ app.once('ready', () => {
8080
accelerator: 'CmdOrCtrl+V',
8181
role: 'paste'
8282
},
83+
{
84+
label: 'Paste and Match Style',
85+
accelerator: 'Shift+Command+V',
86+
role: 'pasteandmatchstyle'
87+
},
88+
{
89+
label: 'Delete',
90+
role: 'delete'
91+
},
8392
{
8493
label: 'Select All',
8594
accelerator: 'CmdOrCtrl+A',
@@ -210,15 +219,29 @@ app.once('ready', () => {
210219
}
211220
]
212221
})
213-
template[3].submenu.push(
222+
template[3].submenu = [
223+
{
224+
label: 'Close',
225+
accelerator: 'CmdOrCtrl+W',
226+
role: 'close'
227+
},
228+
{
229+
label: 'Minimize',
230+
accelerator: 'CmdOrCtrl+M',
231+
role: 'minimize'
232+
},
233+
{
234+
label: 'Zoom',
235+
role: 'zoom'
236+
},
214237
{
215238
type: 'separator'
216239
},
217240
{
218241
label: 'Bring All to Front',
219242
role: 'front'
220243
}
221-
)
244+
]
222245
}
223246

224247
const menu = Menu.buildFromTemplate(template)

docs/api/menu-item.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ On OS X `role` can also have following additional values:
5959
* `hideothers` - Map to the `hideOtherApplications` action
6060
* `unhide` - Map to the `unhideAllApplications` action
6161
* `front` - Map to the `arrangeInFront` action
62+
* `zoom` - Map to the `performZoom` action
6263
* `window` - The submenu is a "Window" menu
6364
* `help` - The submenu is a "Help" menu
6465
* `services` - The submenu is a "Services" menu

docs/api/menu.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,15 @@ const template = [
6666
accelerator: 'CmdOrCtrl+V',
6767
role: 'paste'
6868
},
69+
{
70+
label: 'Paste and Match Style',
71+
accelerator: 'Shift+Command+V',
72+
role: 'pasteandmatchstyle'
73+
},
74+
{
75+
label: 'Delete',
76+
role: 'delete'
77+
},
6978
{
7079
label: 'Select All',
7180
accelerator: 'CmdOrCtrl+A',
@@ -174,15 +183,29 @@ if (process.platform === 'darwin') {
174183
]
175184
});
176185
// Window menu.
177-
template[3].submenu.push(
186+
template[3].submenu = [
187+
{
188+
label: 'Close',
189+
accelerator: 'CmdOrCtrl+W',
190+
role: 'close'
191+
},
192+
{
193+
label: 'Minimize',
194+
accelerator: 'CmdOrCtrl+M',
195+
role: 'minimize'
196+
},
197+
{
198+
label: 'Zoom',
199+
role: 'zoom'
200+
},
178201
{
179202
type: 'separator'
180203
},
181204
{
182205
label: 'Bring All to Front',
183206
role: 'front'
184207
}
185-
);
208+
];
186209
}
187210

188211
const menu = Menu.buildFromTemplate(template);

0 commit comments

Comments
 (0)