From de886dcfcccb4f4865d300dae1c2259c2111bcda Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Thu, 2 Oct 2025 21:27:52 +0800 Subject: [PATCH] =?UTF-8?q?ui:=20=E4=BF=AE=E6=AD=A3=20chat-file=20?= =?UTF-8?q?=E7=82=BA=20=E8=B6=85=E9=8F=88=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/custom-elements/chat-file.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/client/ui/custom-elements/chat-file.ts b/client/ui/custom-elements/chat-file.ts index 4fea0eb..5eb0e94 100644 --- a/client/ui/custom-elements/chat-file.ts +++ b/client/ui/custom-elements/chat-file.ts @@ -7,16 +7,24 @@ customElements.define('chat-file', class extends HTMLElement { connectedCallback() { this.style.display = 'block' const e = new DOMParser().parseFromString(` -
+ -
`, 'text/html').body.firstChild as HTMLElement + `, 'text/html').body.firstChild as HTMLElement $(e).find('span').text($(this).attr("name")) const href = $(this).attr('href') + $(e).attr('href', href) + $(e).attr('target', '_blank') + $(e).attr('download', href) + e.style.textDecoration = 'none' + e.style.color = 'inherit' // deno-lint-ignore no-window - e.onclick = () => window.open(href, '_blank') + e.onclick = (e) => { + e.stopPropagation() + window.open(href, '_blank') + } this.appendChild(e) } })