From a1c6eb177a46079b1e5cd03fd5f4b0446824c41d Mon Sep 17 00:00:00 2001 From: jialin Date: Wed, 16 Jul 2025 14:37:29 +0800 Subject: [PATCH] chore: remove autoplay for audio and video --- src/components/markdown-viewer/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/markdown-viewer/index.tsx b/src/components/markdown-viewer/index.tsx index a722ee9c..fc815d65 100644 --- a/src/components/markdown-viewer/index.tsx +++ b/src/components/markdown-viewer/index.tsx @@ -19,7 +19,7 @@ interface MarkdownViewerProps { const dompurifyOptions = { FORBID_TAGS: ['meta', 'style', 'script', 'iframe'], - FORBID_ATTR: ['onerror', 'onclick', 'onload', 'style'] + FORBID_ATTR: ['onerror', 'onclick', 'onload', 'style', 'autoplay'] }; const cleanHtml = (html: string): string => { @@ -81,6 +81,7 @@ const MarkdownViewer: React.FC = ({ if (token.type === 'script' || token.type === 'style') { return null; } + if (!reDefineTypes.includes(token.type)) { return (