mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-11-21 16:38:41 -06:00
SDA-3516 (Refocus to main webContents when title bar action buttons are clicked) (#1326)
* SDA-3516 - Refocus to main webContents when title bar action button are clicked * SDA-3516 - Add getMainWebContents mock function
This commit is contained in:
parent
3d2bdbc23b
commit
5bcf36e7bd
@ -46,6 +46,7 @@ jest.mock('../src/app/window-handler', () => {
|
||||
isOnline: false,
|
||||
updateVersionInfo: jest.fn(),
|
||||
isMana: false,
|
||||
getMainWebContents: jest.fn(),
|
||||
appMenu: {
|
||||
buildMenu: jest.fn(),
|
||||
},
|
||||
|
@ -83,6 +83,7 @@ ipcMain.on(
|
||||
);
|
||||
return;
|
||||
}
|
||||
const mainWebContents = windowHandler.getMainWebContents();
|
||||
logApiCallParams(arg);
|
||||
switch (arg.cmd) {
|
||||
case apiCmds.isOnline:
|
||||
@ -178,7 +179,6 @@ ipcMain.on(
|
||||
showPopupMenu({ window: browserWin });
|
||||
// Give focus back to main webContents so that
|
||||
// cut, copy & paste from edit menu works as expected
|
||||
const mainWebContents = windowHandler.getMainWebContents();
|
||||
if (mainWebContents && !mainWebContents.isDestroyed()) {
|
||||
mainWebContents.focus();
|
||||
}
|
||||
@ -337,13 +337,25 @@ ipcMain.on(
|
||||
}
|
||||
break;
|
||||
case apiCmds.closeMainWindow:
|
||||
// Give focus back to main webContents
|
||||
if (mainWebContents && !mainWebContents.isDestroyed()) {
|
||||
mainWebContents.focus();
|
||||
}
|
||||
windowHandler.getMainWindow()?.close();
|
||||
break;
|
||||
case apiCmds.minimizeMainWindow:
|
||||
// Give focus back to main webContents
|
||||
if (mainWebContents && !mainWebContents.isDestroyed()) {
|
||||
mainWebContents.focus();
|
||||
}
|
||||
windowHandler.getMainWindow()?.minimize();
|
||||
break;
|
||||
case apiCmds.maximizeMainWindow:
|
||||
windowHandler.getMainWindow()?.maximize();
|
||||
// Give focus back to main webContents
|
||||
if (mainWebContents && !mainWebContents.isDestroyed()) {
|
||||
mainWebContents.focus();
|
||||
}
|
||||
break;
|
||||
case apiCmds.unmaximizeMainWindow:
|
||||
const mainWindow = windowHandler.getMainWindow();
|
||||
@ -352,6 +364,10 @@ ipcMain.on(
|
||||
? mainWindow.setFullScreen(false)
|
||||
: mainWindow.unmaximize();
|
||||
}
|
||||
// Give focus back to main webContents
|
||||
if (mainWebContents && !mainWebContents.isDestroyed()) {
|
||||
mainWebContents.focus();
|
||||
}
|
||||
break;
|
||||
case apiCmds.setPodUrl:
|
||||
await config.updateUserConfig({ url: arg.newPodUrl });
|
||||
|
@ -260,6 +260,15 @@ export class WindowHandler {
|
||||
app.getLocale()) as LocaleType;
|
||||
i18n.setLocale(locale);
|
||||
|
||||
logger.info(`window handler: env details`, {
|
||||
contextIsolation: this.contextIsolation,
|
||||
isNodeEnv,
|
||||
isDevEnv,
|
||||
isMac,
|
||||
isWindowsOS,
|
||||
isLinux,
|
||||
});
|
||||
|
||||
this.listenForLoad();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user