Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 14 additions & 9 deletions packages/desktop/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})

Expand Down