Skip to content

Commit e3ab235

Browse files
committed
JBDS-3834 Install fail - what next?
1 parent 277942d commit e3ab235

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

browser/bootstrap.js

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,32 @@ import mainModule from './main';
33
angular.element(document).ready(function() {
44
angular.bootstrap(document, [mainModule.name], { strictDi: true });
55
});
6+
7+
// Importing this adds a right-click menu with 'Inspect Element' option
8+
const { remote } = require('electron');
9+
const { Menu, MenuItem } = remote;
10+
11+
let rightClickPosition = null;
12+
13+
const menu = new Menu();
14+
const toggleDevToolsItem = new MenuItem({
15+
label: 'Toggle Development Tools',
16+
accelerator: process.platform === 'darwin' ? 'Alt+Command+I' : 'Ctrl+Shift+I',
17+
click: () => {
18+
remote.getCurrentWindow().toggleDevTools();
19+
}
20+
});
21+
const inspectElementItem = new MenuItem({
22+
label: 'Inspect Element',
23+
click: () => {
24+
remote.getCurrentWindow().inspectElement(rightClickPosition.x, rightClickPosition.y);
25+
}
26+
});
27+
menu.append(toggleDevToolsItem);
28+
menu.append(inspectElementItem);
29+
30+
window.addEventListener('contextmenu', (e) => {
31+
e.preventDefault();
32+
rightClickPosition = {x: e.x, y: e.y};
33+
menu.popup(remote.getCurrentWindow());
34+
}, false);

0 commit comments

Comments
 (0)