mirror of
https://github.com/finos/SymphonyElectron.git
synced 2025-02-25 18:55:29 -06:00
ELECTRON-1173: open browser tab for same host url (#654)
* ELECTRON-1173: add support for opening main window url links in the default browser * ELECTRON-1173: refactor code and logging * ELECTRON-1173: remove extra comma * ELECTRON-1173: remove hooks * ELECTRON-1173: reformat code * ELECTRON-1173: reformat code
This commit is contained in:
parent
586e0f0f25
commit
559dc9fa75
@ -37,7 +37,7 @@ const getParsedUrl = (configURL: string): Url => {
|
||||
parsedUrl.slashes = true;
|
||||
}
|
||||
const finalParsedUrl = parse(format(parsedUrl));
|
||||
logger.info(`child-window-handler: The original url ${configURL} is finally parsed as ${finalParsedUrl}`);
|
||||
logger.info(`child-window-handler: The original url ${configURL} is finally parsed as ${JSON.stringify(finalParsedUrl)}`);
|
||||
return finalParsedUrl;
|
||||
};
|
||||
|
||||
@ -70,10 +70,10 @@ export const handleChildWindow = (webContents: WebContents): void => {
|
||||
const dispositionWhitelist = ['new-window', 'foreground-tab'];
|
||||
|
||||
const fullMainUrl = `${mainWinParsedUrl.protocol}//${mainWinParsedUrl.host}/`;
|
||||
logger.info(`child-window-handler: full main url is ${fullMainUrl}!`);
|
||||
logger.info(`child-window-handler: full main url is ${fullMainUrl}`);
|
||||
// If the main url and new window url are the same,
|
||||
// we open that in a browser rather than a separate window
|
||||
if (newWinUrl === fullMainUrl) {
|
||||
if (newWinUrl.startsWith(fullMainUrl)) {
|
||||
event.preventDefault();
|
||||
logger.info(`child-window-handler: the new window url ${newWinUrl} and the main url ${fullMainUrl}
|
||||
are the same, so, redirecting to be opened in the default browser!`);
|
||||
|
@ -4,7 +4,6 @@ import * as path from 'path';
|
||||
import { format, parse } from 'url';
|
||||
|
||||
import { buildNumber, clientVersion, version } from '../../package.json';
|
||||
import DesktopCapturerSource = Electron.DesktopCapturerSource;
|
||||
import { apiName, WindowTypes } from '../common/api-interface';
|
||||
import { isDevEnv, isMac, isWindowsOS } from '../common/env';
|
||||
import { i18n } from '../common/i18n';
|
||||
@ -26,6 +25,7 @@ import {
|
||||
preventWindowNavigation,
|
||||
windowExists,
|
||||
} from './window-utils';
|
||||
import DesktopCapturerSource = Electron.DesktopCapturerSource;
|
||||
|
||||
interface ICustomBrowserWindowConstructorOpts extends Electron.BrowserWindowConstructorOptions {
|
||||
winKey: string;
|
||||
@ -505,7 +505,7 @@ export class WindowHandler {
|
||||
logger.info(`window-handler: loading screen failed ${error}!`);
|
||||
this.loadingWindow.webContents.send('loading-screen-data', { error });
|
||||
}
|
||||
logger.info(`window-handler: loading screen started ${error}!`);
|
||||
logger.info(`window-handler: loading screen started!`);
|
||||
});
|
||||
|
||||
ipcMain.once('reload-symphony', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user