зеркало из https://github.com/electron/electron.git
Add reload menu item role
This commit is contained in:
Родитель
28c39d5151
Коммит
0698b5f1be
|
@ -84,11 +84,7 @@ app.once('ready', () => {
|
||||||
label: 'View',
|
label: 'View',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
label: 'Reload',
|
role: 'reload'
|
||||||
accelerator: 'CmdOrCtrl+R',
|
|
||||||
click (item, focusedWindow) {
|
|
||||||
if (focusedWindow) focusedWindow.reload()
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
label: 'Toggle Developer Tools',
|
label: 'Toggle Developer Tools',
|
||||||
|
|
|
@ -72,6 +72,11 @@ const roles = {
|
||||||
accelerator: process.platform === 'win32' ? 'Control+Y' : 'Shift+CommandOrControl+Z',
|
accelerator: process.platform === 'win32' ? 'Control+Y' : 'Shift+CommandOrControl+Z',
|
||||||
webContentsMethod: 'redo'
|
webContentsMethod: 'redo'
|
||||||
},
|
},
|
||||||
|
reload: {
|
||||||
|
label: 'Reload',
|
||||||
|
accelerator: 'CmdOrCtrl+R',
|
||||||
|
windowMethod: 'reload'
|
||||||
|
},
|
||||||
resetzoom: {
|
resetzoom: {
|
||||||
label: 'Actual Size',
|
label: 'Actual Size',
|
||||||
accelerator: 'CommandOrControl+0',
|
accelerator: 'CommandOrControl+0',
|
||||||
|
@ -138,7 +143,7 @@ const canExecuteRole = (role) => {
|
||||||
if (!roles.hasOwnProperty(role)) return false
|
if (!roles.hasOwnProperty(role)) return false
|
||||||
if (process.platform !== 'darwin') return true
|
if (process.platform !== 'darwin') return true
|
||||||
// macOS handles all roles natively except the ones listed below
|
// macOS handles all roles natively except the ones listed below
|
||||||
return ['zoomin', 'zoomout', 'resetzoom'].includes(role)
|
return ['reload', 'resetzoom', 'zoomin', 'zoomout'].includes(role)
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.getDefaultLabel = (role) => {
|
exports.getDefaultLabel = (role) => {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче