feat(wip): 支持視頻和文件
This commit is contained in:
@@ -33,10 +33,17 @@ const markedInstance = new marked.Marked({
|
|||||||
return `<span>${text}</span>`
|
return `<span>${text}</span>`
|
||||||
},
|
},
|
||||||
image({ text, href }) {
|
image({ text, href }) {
|
||||||
if (/uploaded_files\/[A-Za-z0-9]+$/.test(href))
|
const type = /^(Video|File)=.*/.exec(text)?.[1] || 'Image'
|
||||||
return `<chat-image src="${href}" alt="${text}"></chat-image>`
|
|
||||||
return ``
|
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>`,
|
||||||
|
})?.[type] || ``
|
||||||
}
|
}
|
||||||
|
return ``
|
||||||
|
},
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -178,6 +185,8 @@ export default function ChatFragment({ target, showReturnButton, onReturnButtonC
|
|||||||
cachedFileNamesCount.current[name] = 1
|
cachedFileNamesCount.current[name] = 1
|
||||||
if (type.startsWith('image/'))
|
if (type.startsWith('image/'))
|
||||||
insertText(``)
|
insertText(``)
|
||||||
|
else if (type.startsWith('video/'))
|
||||||
|
insertText(``)
|
||||||
else
|
else
|
||||||
insertText(``)
|
insertText(``)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user