summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAlex Yaroshuk <[email protected]>2026-01-27 00:57:49 +0800
committerGitHub <[email protected]>2026-01-26 10:57:49 -0600
commit984518b1c0cb74db0b8eb9f77bb15fb97224a4e2 (patch)
tree349598caece45500d1c811586cb019f42be5898c
parent7fcdbd155bf2fe65703a8aad0ac6a72761763405 (diff)
downloadopencode-984518b1c0cb74db0b8eb9f77bb15fb97224a4e2.tar.gz
opencode-984518b1c0cb74db0b8eb9f77bb15fb97224a4e2.zip
fix(app): restore external link opening in system browser (#10697)
-rw-r--r--packages/desktop/src/index.tsx23
1 files changed, 14 insertions, 9 deletions
diff --git a/packages/desktop/src/index.tsx b/packages/desktop/src/index.tsx
index fe9e3f92e..b0ac83307 100644
--- a/packages/desktop/src/index.tsx
+++ b/packages/desktop/src/index.tsx
@@ -328,18 +328,23 @@ render(() => {
const [serverPassword, setServerPassword] = createSignal<string | null>(null)
const platform = createPlatform(() => serverPassword())
- function handleClick(e: MouseEvent) {
- const link = (e.target as HTMLElement).closest("a.external-link") as HTMLAnchorElement | null
- if (link?.href) {
- e.preventDefault()
- platform.openLink(link.href)
+ onMount(() => {
+ // Handle external links - open in system browser instead of webview
+ const handleClick = (e: MouseEvent) => {
+ const target = e.target as HTMLElement
+ const link = target.closest("a") as HTMLAnchorElement | null
+
+ if (link?.href && !link.href.startsWith("javascript:") && !link.href.startsWith("#")) {
+ e.preventDefault()
+ e.stopPropagation()
+ e.stopImmediatePropagation()
+ void shellOpen(link.href).catch(() => undefined)
+ }
}
- }
- onMount(() => {
- document.addEventListener("click", handleClick)
+ document.addEventListener("click", handleClick, true)
onCleanup(() => {
- document.removeEventListener("click", handleClick)
+ document.removeEventListener("click", handleClick, true)
})
})