mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
SDA-4018 Enabling copy/paste in clipboard
This commit is contained in:
parent
b4d5f6d038
commit
397aa91f8a
@ -29,7 +29,8 @@ enum Permissions {
|
|||||||
const PERMISSIONS_NAMESPACE = 'Permissions';
|
const PERMISSIONS_NAMESPACE = 'Permissions';
|
||||||
|
|
||||||
const saveWindowSettings = async (): Promise<void> => {
|
const saveWindowSettings = async (): Promise<void> => {
|
||||||
const browserWindow = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
|
const browserWindow =
|
||||||
|
BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
|
||||||
const mainWebContents = windowHandler.getMainWebContents();
|
const mainWebContents = windowHandler.getMainWebContents();
|
||||||
|
|
||||||
if (browserWindow && windowExists(browserWindow)) {
|
if (browserWindow && windowExists(browserWindow)) {
|
||||||
@ -86,7 +87,8 @@ const saveWindowSettings = async (): Promise<void> => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const windowMaximized = async (): Promise<void> => {
|
const windowMaximized = async (): Promise<void> => {
|
||||||
const browserWindow = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
|
const browserWindow =
|
||||||
|
BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
|
||||||
if (browserWindow && windowExists(browserWindow)) {
|
if (browserWindow && windowExists(browserWindow)) {
|
||||||
const isMaximized = browserWindow.isMaximized();
|
const isMaximized = browserWindow.isMaximized();
|
||||||
const isFullScreen = browserWindow.isFullScreen();
|
const isFullScreen = browserWindow.isFullScreen();
|
||||||
@ -216,7 +218,8 @@ export const updateAlwaysOnTop = async (
|
|||||||
logger.info(
|
logger.info(
|
||||||
`window-actions: Should we set always on top? ${shouldSetAlwaysOnTop}!`,
|
`window-actions: Should we set always on top? ${shouldSetAlwaysOnTop}!`,
|
||||||
);
|
);
|
||||||
const browserWins: ICustomBrowserWindow[] = BrowserWindow.getAllWindows() as ICustomBrowserWindow[];
|
const browserWins: ICustomBrowserWindow[] =
|
||||||
|
BrowserWindow.getAllWindows() as ICustomBrowserWindow[];
|
||||||
if (shouldUpdateUserConfig) {
|
if (shouldUpdateUserConfig) {
|
||||||
await config.updateUserConfig({
|
await config.updateUserConfig({
|
||||||
alwaysOnTop: shouldSetAlwaysOnTop
|
alwaysOnTop: shouldSetAlwaysOnTop
|
||||||
@ -264,7 +267,8 @@ export const handleKeyPress = (key: number): void => {
|
|||||||
if (isMac || isLinux) {
|
if (isMac || isLinux) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const browserWin = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
|
const browserWin =
|
||||||
|
BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
|
||||||
if (
|
if (
|
||||||
browserWin &&
|
browserWin &&
|
||||||
windowExists(browserWin) &&
|
windowExists(browserWin) &&
|
||||||
@ -476,6 +480,11 @@ export const handlePermissionRequests = (webContents: WebContents): void => {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const allowedPermissions = new Set([
|
||||||
|
'clipboard-read',
|
||||||
|
'clipboard-sanitized-write',
|
||||||
|
]);
|
||||||
|
|
||||||
session.setPermissionRequestHandler(
|
session.setPermissionRequestHandler(
|
||||||
(_webContents, permission, callback, details) => {
|
(_webContents, permission, callback, details) => {
|
||||||
switch (permission) {
|
switch (permission) {
|
||||||
@ -550,7 +559,7 @@ export const handlePermissionRequests = (webContents: WebContents): void => {
|
|||||||
callback,
|
callback,
|
||||||
);
|
);
|
||||||
default:
|
default:
|
||||||
return callback(false);
|
return callback(allowedPermissions.has(permission));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user