feat: 聊天文件

This commit is contained in:
CrescentLeaf
2025-10-02 18:37:25 +08:00
parent 2771503b6f
commit 020fd63c97
3 changed files with 26 additions and 2 deletions

View File

@@ -36,8 +36,8 @@ const markedInstance = new marked.Marked({
if (/uploaded_files\/[A-Za-z0-9]+$/.test(href)) {
return ({
Image: `<chat-image src="${href}" alt="${text}"></chat-image>`,
Video: `<chat-video src="${href}" alt="${text}"></chat-video>`,
File: `<chat-file src="${href}" alt="${text}"></chat-file>`,
Video: `<chat-video src="${href}"></chat-video>`,
File: `<chat-file href="${href}" name="${/^Video|File=(.*)/.exec(text)?.[1] || 'Unnamed file'}"></chat-file>`,
})?.[type] || ``
}
return ``
@@ -280,6 +280,7 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
'src',
'alt',
'href',
'name',
],
}).replaceAll('\n', '<br>')
const lastDate = date