Merge pull request #2318 from craigshoemaker/patch-1
📝 Windows/Linux compatibility changes
This commit is contained in:
commit
f485a9894c
1 changed files with 15 additions and 13 deletions
|
@ -29,6 +29,8 @@ window.addEventListener('contextmenu', function (e) {
|
||||||
|
|
||||||
Another example of creating the application menu with the simple template API:
|
Another example of creating the application menu with the simple template API:
|
||||||
|
|
||||||
|
**Note to Window and Linux users** the `selector` member of each menu item is a Mac-only [Accelerator option](https://github.com/atom/electron/blob/master/docs/api/accelerator.md).
|
||||||
|
|
||||||
```html
|
```html
|
||||||
<!-- index.html -->
|
<!-- index.html -->
|
||||||
<script>
|
<script>
|
||||||
|
@ -54,12 +56,12 @@ var template = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Hide Electron',
|
label: 'Hide Electron',
|
||||||
accelerator: 'Command+H',
|
accelerator: 'CmdOrCtrl+H',
|
||||||
selector: 'hide:'
|
selector: 'hide:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Hide Others',
|
label: 'Hide Others',
|
||||||
accelerator: 'Command+Shift+H',
|
accelerator: 'CmdOrCtrl+Shift+H',
|
||||||
selector: 'hideOtherApplications:'
|
selector: 'hideOtherApplications:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -71,7 +73,7 @@ var template = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Quit',
|
label: 'Quit',
|
||||||
accelerator: 'Command+Q',
|
accelerator: 'CmdOrCtrl+Q',
|
||||||
selector: 'terminate:'
|
selector: 'terminate:'
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -81,12 +83,12 @@ var template = [
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Undo',
|
label: 'Undo',
|
||||||
accelerator: 'Command+Z',
|
accelerator: 'CmdOrCtrl+Z',
|
||||||
selector: 'undo:'
|
selector: 'undo:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Redo',
|
label: 'Redo',
|
||||||
accelerator: 'Shift+Command+Z',
|
accelerator: 'Shift+CmdOrCtrl+Z',
|
||||||
selector: 'redo:'
|
selector: 'redo:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -94,22 +96,22 @@ var template = [
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Cut',
|
label: 'Cut',
|
||||||
accelerator: 'Command+X',
|
accelerator: 'CmdOrCtrl+X',
|
||||||
selector: 'cut:'
|
selector: 'cut:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Copy',
|
label: 'Copy',
|
||||||
accelerator: 'Command+C',
|
accelerator: 'CmdOrCtrl+C',
|
||||||
selector: 'copy:'
|
selector: 'copy:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Paste',
|
label: 'Paste',
|
||||||
accelerator: 'Command+V',
|
accelerator: 'CmdOrCtrl+V',
|
||||||
selector: 'paste:'
|
selector: 'paste:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Select All',
|
label: 'Select All',
|
||||||
accelerator: 'Command+A',
|
accelerator: 'CmdOrCtrl+A',
|
||||||
selector: 'selectAll:'
|
selector: 'selectAll:'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -119,12 +121,12 @@ var template = [
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Reload',
|
label: 'Reload',
|
||||||
accelerator: 'Command+R',
|
accelerator: 'CmdOrCtrl+R',
|
||||||
click: function() { remote.getCurrentWindow().reload(); }
|
click: function() { remote.getCurrentWindow().reload(); }
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Toggle DevTools',
|
label: 'Toggle DevTools',
|
||||||
accelerator: 'Alt+Command+I',
|
accelerator: 'Alt+CmdOrCtrl+I',
|
||||||
click: function() { remote.getCurrentWindow().toggleDevTools(); }
|
click: function() { remote.getCurrentWindow().toggleDevTools(); }
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
@ -134,12 +136,12 @@ var template = [
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Minimize',
|
label: 'Minimize',
|
||||||
accelerator: 'Command+M',
|
accelerator: 'CmdOrCtrl+M',
|
||||||
selector: 'performMiniaturize:'
|
selector: 'performMiniaturize:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Close',
|
label: 'Close',
|
||||||
accelerator: 'Command+W',
|
accelerator: 'CmdOrCtrl+W',
|
||||||
selector: 'performClose:'
|
selector: 'performClose:'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue