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);
|
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) {
|
if (options.userAgent) {
|
||||||
mainWindow.webContents.setUserAgent(options.userAgent);
|
mainWindow.webContents.setUserAgent(options.userAgent);
|
||||||
|
@ -6,10 +6,12 @@ var shell = electron.shell;
|
|||||||
*
|
*
|
||||||
* @param {string} nativefierVersion
|
* @param {string} nativefierVersion
|
||||||
* @param {electron.app.quit} onQuit should be from app.quit
|
* @param {electron.app.quit} onQuit should be from app.quit
|
||||||
|
* @param {function} onGoBack
|
||||||
|
* @param {electron} onGoForward
|
||||||
* @param {function} onZoomIn
|
* @param {function} onZoomIn
|
||||||
* @param {function} onZoomOut
|
* @param {function} onZoomOut
|
||||||
*/
|
*/
|
||||||
function createMenu(nativefierVersion, onQuit, onZoomIn, onZoomOut) {
|
function createMenu(nativefierVersion, onQuit, onGoBack, onGoForward, onZoomIn, onZoomOut) {
|
||||||
if (Menu.getApplicationMenu())
|
if (Menu.getApplicationMenu())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -55,6 +57,18 @@ function createMenu(nativefierVersion, onQuit, onZoomIn, onZoomOut) {
|
|||||||
{
|
{
|
||||||
label: 'View',
|
label: 'View',
|
||||||
submenu: [
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Back',
|
||||||
|
click: function () {
|
||||||
|
onGoBack();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Forward',
|
||||||
|
click: function () {
|
||||||
|
onGoForward();
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Reload',
|
label: 'Reload',
|
||||||
accelerator: 'CmdOrCtrl+R',
|
accelerator: 'CmdOrCtrl+R',
|
||||||
@ -63,6 +77,9 @@ function createMenu(nativefierVersion, onQuit, onZoomIn, onZoomOut) {
|
|||||||
focusedWindow.reload();
|
focusedWindow.reload();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
type: 'separator'
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: 'Toggle Full Screen',
|
label: 'Toggle Full Screen',
|
||||||
accelerator: (function () {
|
accelerator: (function () {
|
||||||
|
Loading…
Reference in New Issue
Block a user