Skip to content

Commit

Permalink
Closes RocketChat#133; Open DevTools for active server
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigok committed Mar 5, 2016
1 parent 4505664 commit 9777ec2
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
22 changes: 20 additions & 2 deletions app/scripts/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,17 @@ if (process.platform === 'darwin') {
}
},
{
label: 'Toggle DevTools',
label: 'Toggle DevTools - current server',
accelerator: 'Command+Alt+I',
click: function() {
const activeWebview = webview.getActive();
if (activeWebview) {
activeWebview.openDevTools();
}
}
},
{
label: 'Toggle DevTools - application',
click: function() {
remote.getCurrentWindow().toggleDevTools();
}
Expand Down Expand Up @@ -251,8 +260,17 @@ if (process.platform === 'darwin') {
}
},
{
label: 'Toggle DevTools',
label: 'Toggle DevTools - current server',
accelerator: 'Ctrl+Shift+I',
click: function() {
const activeWebview = webview.getActive();
if (activeWebview) {
activeWebview.openDevTools();
}
}
},
{
label: 'Toggle DevTools - application',
click: function() {
remote.getCurrentWindow().toggleDevTools();
}
Expand Down
5 changes: 2 additions & 3 deletions app/scripts/sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,7 @@ var selectedInstance = null;
var instanceMenu = remote.Menu.buildFromTemplate([{
label: 'Reload server',
click: function() {
const activeWebview = webview.getByUrl(selectedInstance.dataset.host);
activeWebview.reload();
webview.getByUrl(selectedInstance.dataset.host).reload();
}
}, {
label: 'Remove server',
Expand All @@ -247,7 +246,7 @@ var instanceMenu = remote.Menu.buildFromTemplate([{
}, {
label: 'Open DevTools',
click: function() {
document.querySelector(`webview[server="${selectedInstance.dataset.host}"]`).openDevTools();
webview.getByUrl(selectedInstance.dataset.host).openDevTools();
}
}]);

Expand Down

0 comments on commit 9777ec2

Please sign in to comment.