Skip to content

Commit 397aa91

Browse files
committedDec 28, 2022
SDA-4018 Enabling copy/paste in clipboard
1 parent b4d5f6d commit 397aa91

File tree

1 file changed

+14
-5
lines changed

1 file changed

+14
-5
lines changed
 

‎src/app/window-actions.ts

+14-5
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ enum Permissions {
2929
const PERMISSIONS_NAMESPACE = 'Permissions';
3030

3131
const saveWindowSettings = async (): Promise<void> => {
32-
const browserWindow = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
32+
const browserWindow =
33+
BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
3334
const mainWebContents = windowHandler.getMainWebContents();
3435

3536
if (browserWindow && windowExists(browserWindow)) {
@@ -86,7 +87,8 @@ const saveWindowSettings = async (): Promise<void> => {
8687
};
8788

8889
const windowMaximized = async (): Promise<void> => {
89-
const browserWindow = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
90+
const browserWindow =
91+
BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
9092
if (browserWindow && windowExists(browserWindow)) {
9193
const isMaximized = browserWindow.isMaximized();
9294
const isFullScreen = browserWindow.isFullScreen();
@@ -216,7 +218,8 @@ export const updateAlwaysOnTop = async (
216218
logger.info(
217219
`window-actions: Should we set always on top? ${shouldSetAlwaysOnTop}!`,
218220
);
219-
const browserWins: ICustomBrowserWindow[] = BrowserWindow.getAllWindows() as ICustomBrowserWindow[];
221+
const browserWins: ICustomBrowserWindow[] =
222+
BrowserWindow.getAllWindows() as ICustomBrowserWindow[];
220223
if (shouldUpdateUserConfig) {
221224
await config.updateUserConfig({
222225
alwaysOnTop: shouldSetAlwaysOnTop
@@ -264,7 +267,8 @@ export const handleKeyPress = (key: number): void => {
264267
if (isMac || isLinux) {
265268
return;
266269
}
267-
const browserWin = BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
270+
const browserWin =
271+
BrowserWindow.getFocusedWindow() as ICustomBrowserWindow;
268272
if (
269273
browserWin &&
270274
windowExists(browserWin) &&
@@ -476,6 +480,11 @@ export const handlePermissionRequests = (webContents: WebContents): void => {
476480
return;
477481
}
478482

483+
const allowedPermissions = new Set([
484+
'clipboard-read',
485+
'clipboard-sanitized-write',
486+
]);
487+
479488
session.setPermissionRequestHandler(
480489
(_webContents, permission, callback, details) => {
481490
switch (permission) {
@@ -550,7 +559,7 @@ export const handlePermissionRequests = (webContents: WebContents): void => {
550559
callback,
551560
);
552561
default:
553-
return callback(false);
562+
return callback(allowedPermissions.has(permission));
554563
}
555564
},
556565
);

0 commit comments

Comments
 (0)
Please sign in to comment.