fix(core): use openExternal in electron (#8323)
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
import { DebugLogger } from '@affine/debug';
|
||||||
|
import { apis } from '@affine/electron-api';
|
||||||
|
|
||||||
|
const logger = new DebugLogger('popup');
|
||||||
|
|
||||||
export function popupWindow(target: string) {
|
export function popupWindow(target: string) {
|
||||||
target = /^https?:\/\//.test(target)
|
target = /^https?:\/\//.test(target)
|
||||||
? target
|
? target
|
||||||
@@ -14,5 +19,11 @@ export function popupWindow(target: string) {
|
|||||||
url = builder.toString();
|
url = builder.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
return window.open(url, '_blank', `noreferrer noopener`);
|
if (BUILD_CONFIG.isElectron) {
|
||||||
|
apis?.ui.openExternal(url).catch(e => {
|
||||||
|
logger.error('Failed to open external URL', e);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
window.open(url, '_blank', `noreferrer noopener`);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user