Refresh the inside of the current tab when reloading in the main window

For #213 and #223

As the side effect, this doesn't reload the settings page.
But it will not be problem in most cases.
This commit is contained in:
Yuya Ochiai
2016-07-28 22:44:42 +09:00
parent 6c071fd225
commit 3feb833537
2 changed files with 33 additions and 6 deletions

View File

@@ -99,18 +99,27 @@ var createTemplate = function(mainWindow, config) {
accelerator: 'CmdOrCtrl+R',
click: function(item, focusedWindow) {
if (focusedWindow) {
focusedWindow.reload();
if (focusedWindow === mainWindow) {
mainWindow.webContents.send('reload-tab');
}
else {
focusedWindow.reload();
}
}
}
}, {
label: 'Clear Cache and Reload',
accelerator: 'Shift+CmdOrCtrl+R',
click: function(item, focusedWindow) {
// TODO: should reload the selected tab only
if (focusedWindow) {
focusedWindow.webContents.session.clearCache(function() {
focusedWindow.reload();
});
if (focusedWindow === mainWindow) {
mainWindow.webContents.send('clear-cache-and-reload-tab');
}
else {
focusedWindow.webContents.session.clearCache(function() {
focusedWindow.reload();
});
}
}
}
}, {