From f436f846966d6d852be7151adeb501243ec49d5a Mon Sep 17 00:00:00 2001 From: CrescentLeaf Date: Wed, 1 Oct 2025 01:08:52 +0800 Subject: [PATCH] =?UTF-8?q?feat(wip):=20=E6=94=AF=E6=8C=81=E8=A6=96?= =?UTF-8?q?=E9=A0=BB=E5=92=8C=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/ui/chat/ChatFragment.tsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/client/ui/chat/ChatFragment.tsx b/client/ui/chat/ChatFragment.tsx index 0ab20df..4ee3fec 100644 --- a/client/ui/chat/ChatFragment.tsx +++ b/client/ui/chat/ChatFragment.tsx @@ -33,10 +33,17 @@ const markedInstance = new marked.Marked({ return `${text}` }, image({ text, href }) { - if (/uploaded_files\/[A-Za-z0-9]+$/.test(href)) - return `` + const type = /^(Video|File)=.*/.exec(text)?.[1] || 'Image' + + if (/uploaded_files\/[A-Za-z0-9]+$/.test(href)) { + return ({ + Image: ``, + Video: ``, + File: ``, + })?.[type] || `` + } return `` - } + }, } }) @@ -178,6 +185,8 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC cachedFileNamesCount.current[name] = 1 if (type.startsWith('image/')) insertText(`![圖片](${name})`) + else if (type.startsWith('video/')) + insertText(`![Video=${name}](${name})`) else insertText(`![File=${name}](${name})`) }