This commit is contained in:
John Cummings 2025-12-23 15:42:48 +08:00 committed by GitHub
commit 3e58f51079
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -12,6 +12,7 @@ import {
type Component,
} from "solid-js"
import { Dynamic } from "solid-js/web"
import open from "open"
import path from "path"
import { useRoute, useRouteData } from "@tui/context/route"
import { useSync } from "@tui/context/sync"
@ -71,6 +72,14 @@ import { DialogSubagent } from "./dialog-subagent.tsx"
addDefaultParsers(parsers.parsers)
/**
* Handle alt+click or ctrl+click on links in markdown content
* Opens URLs in the default browser
*/
function handleLinkClick(url: string) {
open(url).catch(() => {})
}
class CustomSpeedScroll implements ScrollAcceleration {
constructor(private speed: number) {}
@ -1347,6 +1356,7 @@ function ReasoningPart(props: { last: boolean; part: ReasoningPart; message: Ass
content={"_Thinking:_ " + content()}
conceal={ctx.conceal()}
fg={theme.textMuted}
onLinkClick={handleLinkClick}
/>
</box>
</Show>
@ -1367,6 +1377,7 @@ function TextPart(props: { last: boolean; part: TextPart; message: AssistantMess
content={props.part.text.trim()}
conceal={ctx.conceal()}
fg={theme.text}
onLinkClick={handleLinkClick}
/>
</box>
</Show>
@ -1600,6 +1611,7 @@ ToolRegistry.register<typeof WriteTool>({
filetype={filetype(props.input.filePath!)}
syntaxStyle={syntax()}
content={code()}
onLinkClick={handleLinkClick}
/>
</line_number>
</Show>