mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-11-11 07:41:04 +00:00
Implement navigating backward and forward from the application menu
This commit is contained in:
parent
eabe6de892
commit
e0de7bf463
@ -43,7 +43,7 @@ function createMainWindow(options, onAppQuit, setDockBadge) {
|
||||
mainWindow.webContents.send('change-zoom', currentZoom);
|
||||
};
|
||||
|
||||
createMenu(options.nativefierVersion, onAppQuit, onZoomIn, onZoomOut);
|
||||
createMenu(options.nativefierVersion, onAppQuit, mainWindow.webContents.goBack, mainWindow.webContents.goForward, onZoomIn, onZoomOut);
|
||||
|
||||
if (options.userAgent) {
|
||||
mainWindow.webContents.setUserAgent(options.userAgent);
|
||||
|
@ -6,10 +6,12 @@ var shell = electron.shell;
|
||||
*
|
||||
* @param {string} nativefierVersion
|
||||
* @param {electron.app.quit} onQuit should be from app.quit
|
||||
* @param {function} onGoBack
|
||||
* @param {electron} onGoForward
|
||||
* @param {function} onZoomIn
|
||||
* @param {function} onZoomOut
|
||||
*/
|
||||
function createMenu(nativefierVersion, onQuit, onZoomIn, onZoomOut) {
|
||||
function createMenu(nativefierVersion, onQuit, onGoBack, onGoForward, onZoomIn, onZoomOut) {
|
||||
if (Menu.getApplicationMenu())
|
||||
return;
|
||||
|
||||
@ -55,6 +57,18 @@ function createMenu(nativefierVersion, onQuit, onZoomIn, onZoomOut) {
|
||||
{
|
||||
label: 'View',
|
||||
submenu: [
|
||||
{
|
||||
label: 'Back',
|
||||
click: function () {
|
||||
onGoBack();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Forward',
|
||||
click: function () {
|
||||
onGoForward();
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Reload',
|
||||
accelerator: 'CmdOrCtrl+R',
|
||||
@ -63,6 +77,9 @@ function createMenu(nativefierVersion, onQuit, onZoomIn, onZoomOut) {
|
||||
focusedWindow.reload();
|
||||
}
|
||||
},
|
||||
{
|
||||
type: 'separator'
|
||||
},
|
||||
{
|
||||
label: 'Toggle Full Screen',
|
||||
accelerator: (function () {
|
||||
|
Loading…
Reference in New Issue
Block a user