Skip to content

Commit

Permalink
feat: markdown disable iframe auto play
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Oct 24, 2024
1 parent f3eea81 commit 16086d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion client/web/src/components/Markdown/render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,20 @@ export const Markdown: React.FC<{
preview={true}
/>
),
iframe: (props) => {
let src = props.src;
if (src && src.includes('?')) {
src += '&autoplay=0'; // make sure media autoplay is false
}
return <iframe {...props} src={src} />;
},
style: () => <div>{t('不支持自定义样式')}</div>,
meta: () => <div>{t('不支持自定义Meta')}</div>,
}),
[]
);

// [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]
// <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>
return (
<ReactMarkdown
className="tailchat-markdown"
Expand Down

0 comments on commit 16086d1

Please sign in to comment.