Skip to content

Commit 16086d1

Browse files
committed
feat: markdown disable iframe auto play
1 parent f3eea81 commit 16086d1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

client/web/src/components/Markdown/render.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,20 @@ export const Markdown: React.FC<{
4444
preview={true}
4545
/>
4646
),
47+
iframe: (props) => {
48+
let src = props.src;
49+
if (src && src.includes('?')) {
50+
src += '&autoplay=0'; // make sure media autoplay is false
51+
}
52+
return <iframe {...props} src={src} />;
53+
},
4754
style: () => <div>{t('不支持自定义样式')}</div>,
4855
meta: () => <div>{t('不支持自定义Meta')}</div>,
4956
}),
5057
[]
5158
);
52-
59+
// [md]<iframe src="//player.bilibili.com/player.html?isOutside=true&aid=113350126076732&bvid=BV1ZpyHYkEQ3&cid=26409569922&p=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>[/md]
60+
// <iframe src="//player.bilibili.com/player.html?isOutside=true&aid=113350126076732&bvid=BV1ZpyHYkEQ3&cid=26409569922&p=1" scrolling="no" border="0" frameborder="no" framespacing="0" allowfullscreen="true"></iframe>
5361
return (
5462
<ReactMarkdown
5563
className="tailchat-markdown"

0 commit comments

Comments
 (0)