chore: remove autoplay for audio and video

This commit is contained in:
jialin
2025-07-16 14:38:37 +08:00
parent 14d60264c7
commit a1c6eb177a
+2 -1
View File
@@ -19,7 +19,7 @@ interface MarkdownViewerProps {
const dompurifyOptions = { const dompurifyOptions = {
FORBID_TAGS: ['meta', 'style', 'script', 'iframe'], FORBID_TAGS: ['meta', 'style', 'script', 'iframe'],
FORBID_ATTR: ['onerror', 'onclick', 'onload', 'style'] FORBID_ATTR: ['onerror', 'onclick', 'onload', 'style', 'autoplay']
}; };
const cleanHtml = (html: string): string => { const cleanHtml = (html: string): string => {
@@ -81,6 +81,7 @@ const MarkdownViewer: React.FC<MarkdownViewerProps> = ({
if (token.type === 'script' || token.type === 'style') { if (token.type === 'script' || token.type === 'style') {
return null; return null;
} }
if (!reDefineTypes.includes(token.type)) { if (!reDefineTypes.includes(token.type)) {
return ( return (
<span <span