We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8d4cc6a commit ec7c630Copy full SHA for ec7c630
packages/frontend/core/src/utils/popup.ts
@@ -1,3 +1,8 @@
1
+import { DebugLogger } from '@affine/debug';
2
+import { apis } from '@affine/electron-api';
3
+
4
+const logger = new DebugLogger('popup');
5
6
export function popupWindow(target: string) {
7
target = /^https?:\/\//.test(target)
8
? target
@@ -14,5 +19,11 @@ export function popupWindow(target: string) {
14
19
url = builder.toString();
15
20
}
16
21
17
- return window.open(url, '_blank', `noreferrer noopener`);
22
+ if (BUILD_CONFIG.isElectron) {
23
+ apis?.ui.openExternal(url).catch(e => {
24
+ logger.error('Failed to open external URL', e);
25
+ });
26
+ } else {
27
+ window.open(url, '_blank', `noreferrer noopener`);
28
+ }
18
29
0 commit comments