Skip to content

Commit

Permalink
Reload current view properly [WIP]
Browse files Browse the repository at this point in the history
  • Loading branch information
akashnimare committed Oct 10, 2017
1 parent 5d98885 commit 40e3ed0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/main/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ function createMainWindow() {
function registerLocalShortcuts(page) {
// Somehow, reload action cannot be overwritten by the menu item
electronLocalshortcut.register(mainWindow, 'CommandOrControl+R', () => {
page.send('reload-viewer');
page.send('reload-current-viewer');
});

// Also adding these shortcuts because some users might want to use it instead of CMD/Left-Right
Expand Down
2 changes: 1 addition & 1 deletion app/main/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class AppMenu {
accelerator: 'CommandOrControl+R',
click(item, focusedWindow) {
if (focusedWindow) {
AppMenu.sendAction('reload-viewer');
AppMenu.sendAction('reload-current-viewer');
}
}
}, {
Expand Down
8 changes: 8 additions & 0 deletions app/renderer/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,12 @@ class ServerManagerView {
this.initTabs();
}

// This will trigger when pressed CTRL/CMD + R [WIP]
// It won't reload the current view properly when you add/delete a server.
reloadCurrentView() {
this.$reloadButton.click();
}

updateBadge() {
let messageCountAll = 0;
for (let i = 0; i < this.tabs.length; i++) {
Expand Down Expand Up @@ -324,6 +330,8 @@ class ServerManagerView {

ipcRenderer.on('reload-viewer', this.reloadView.bind(this, this.tabs[this.activeTabIndex].props.index));

ipcRenderer.on('reload-current-viewer', this.reloadCurrentView.bind(this));

ipcRenderer.on('hard-reload', () => {
ipcRenderer.send('reload-full-app');
});
Expand Down

0 comments on commit 40e3ed0

Please sign in to comment.