Add back/forward features for the current tab

Close #245
This commit is contained in:
Yuya Ochiai
2016-09-03 18:01:05 +09:00
parent d19df3fc29
commit 93e419b488
4 changed files with 74 additions and 0 deletions

View File

@@ -161,6 +161,37 @@ var createTemplate = function(mainWindow, config) {
}
}]
});
template.push({
label: '&History',
submenu: [{
label: 'Back',
accelerator: process.platform === 'darwin' ? 'Cmd+[' : 'Alt+Left',
click: (item, focusedWindow) => {
if (focusedWindow === mainWindow) {
mainWindow.webContents.send('go-back');
}
else {
if (focusedWindow.webContents.canGoBack()) {
focusedWindow.goBack();
}
}
}
}, {
label: 'Forward',
accelerator: process.platform === 'darwin' ? 'Cmd+]' : 'Alt+Right',
click: (item, focusedWindow) => {
if (focusedWindow === mainWindow) {
mainWindow.webContents.send('go-forward');
}
else {
if (focusedWindow.webContents.canGoForward()) {
focusedWindow.goForward();
}
}
}
}]
});
const window_menu = {
label: '&Window',