Skip to content

Commit ec7c630

Browse files
committed
fix(core): use openExternal in electron (#8323)
1 parent 8d4cc6a commit ec7c630

File tree

1 file changed

+12
-1
lines changed
  • packages/frontend/core/src/utils

1 file changed

+12
-1
lines changed

packages/frontend/core/src/utils/popup.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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+
16
export function popupWindow(target: string) {
27
target = /^https?:\/\//.test(target)
38
? target
@@ -14,5 +19,11 @@ export function popupWindow(target: string) {
1419
url = builder.toString();
1520
}
1621

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+
}
1829
}

0 commit comments

Comments
 (0)