fix(app): restore external link opening in system browser (#10697)

This commit is contained in:
Alex Yaroshuk
2026-01-27 00:57:49 +08:00
committed by GitHub
parent 7fcdbd155b
commit 984518b1c0

View File

@@ -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(() => {
document.addEventListener("click", handleClick)
// 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)
}
}
document.addEventListener("click", handleClick, true)
onCleanup(() => {
document.removeEventListener("click", handleClick)
document.removeEventListener("click", handleClick, true)
})
})