mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-28 09:51:06 -06:00
ELECTRON-337: remove dev tools menu item and map the behaviour to global shortcut (#331)
This commit is contained in:
parent
923bd3ba1a
commit
e449ece7bf
@ -80,15 +80,6 @@ const template = [{
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Toggle Developer Tools',
|
||||
accelerator: isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I',
|
||||
click(item, focusedWindow) {
|
||||
if (focusedWindow) {
|
||||
focusedWindow.webContents.toggleDevTools();
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Set Downloads Directory',
|
||||
click() {
|
||||
|
@ -3,6 +3,7 @@
|
||||
const fs = require('fs');
|
||||
const electron = require('electron');
|
||||
const app = electron.app;
|
||||
const globalShortcut = electron.globalShortcut;
|
||||
const crashReporter = electron.crashReporter;
|
||||
const BrowserWindow = electron.BrowserWindow;
|
||||
const path = require('path');
|
||||
@ -224,6 +225,7 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
||||
});
|
||||
});
|
||||
|
||||
registerShortcuts();
|
||||
handlePermissionRequests(mainWindow.webContents);
|
||||
|
||||
addWindowKey(key, mainWindow);
|
||||
@ -505,7 +507,25 @@ function doCreateMainWindow(initialUrl, initialBounds, isCustomTitleBar) {
|
||||
});
|
||||
});
|
||||
|
||||
// ELECTRON-323: Handle session permission requests
|
||||
/**
|
||||
* Register shortcuts for the app
|
||||
*/
|
||||
function registerShortcuts() {
|
||||
|
||||
// Register dev tools shortcut
|
||||
globalShortcut.register(isMac ? 'Alt+Command+I' : 'Ctrl+Shift+I', () => {
|
||||
let focusedWindow = BrowserWindow.getFocusedWindow();
|
||||
if (focusedWindow && !focusedWindow.isDestroyed()) {
|
||||
focusedWindow.webContents.toggleDevTools();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets permission requests for the window
|
||||
* @param webContents Web contents of the window
|
||||
*/
|
||||
function handlePermissionRequests(webContents) {
|
||||
|
||||
let session = webContents.session;
|
||||
|
@ -138,9 +138,9 @@ describe('Tests for Always on top', () => {
|
||||
robot.setMouseDelay(200);
|
||||
robot.moveMouse(190, 0);
|
||||
robot.mouseClick();
|
||||
// Key tap 10 times as "Always on Top" is in the
|
||||
// 10th position under view menu item
|
||||
for (let i = 0; i < 10; i++) {
|
||||
// Key tap 9 times as "Always on Top" is in the
|
||||
// 9th position under view menu item
|
||||
for (let i = 0; i < 9; i++) {
|
||||
robot.keyTap('down');
|
||||
}
|
||||
robot.keyTap('enter');
|
||||
|
@ -105,9 +105,9 @@ describe('Tests for Full screen', () => {
|
||||
robot.mouseClick();
|
||||
robot.setKeyboardDelay(100);
|
||||
|
||||
// Key tap 8 times as "Enter Full Screen" is in the
|
||||
// 8th position under view menu item
|
||||
for (let i = 0; i < 8; i++) {
|
||||
// Key tap 7 times as "Enter Full Screen" is in the
|
||||
// 7th position under view menu item
|
||||
for (let i = 0; i < 7; i++) {
|
||||
robot.keyTap('down');
|
||||
}
|
||||
robot.keyTap('enter');
|
||||
|
@ -119,9 +119,9 @@ describe('Tests for Minimize on Close', () => {
|
||||
robot.mouseClick();
|
||||
robot.setKeyboardDelay(100);
|
||||
|
||||
// Key tap 9 times as "Minimize on Close" is in the
|
||||
// 9th position under view menu item
|
||||
for (let i = 0; i < 9; i++) {
|
||||
// Key tap 10 times as "Minimize on Close" is in the
|
||||
// 10th position under view menu item
|
||||
for (let i = 0; i < 10; i++) {
|
||||
robot.keyTap('down');
|
||||
}
|
||||
robot.keyTap('enter');
|
||||
|
Loading…
Reference in New Issue
Block a user