diff --git a/src/components/markdown/markdown.tsx b/src/components/markdown/markdown.tsx index d355a130..8ba27587 100644 --- a/src/components/markdown/markdown.tsx +++ b/src/components/markdown/markdown.tsx @@ -11,6 +11,7 @@ import useIsMobile from '../../hooks/use-is-mobile'; import CommentMedia from '../comment-media'; import styles from './markdown.module.css'; import { useLocation, useParams } from 'react-router-dom'; +import { canEmbed } from '../embed'; interface ContentLinkEmbedProps { children: any; @@ -86,13 +87,15 @@ const ContentLinkEmbed = ({ children, href, linkMediaInfo }: ContentLinkEmbedPro )} - - {isOpen && !isMobile && ( -
- -
- )} -
+ {getHasThumbnail(linkMediaInfo, href) && ( + + {isOpen && !isMobile && ( +
+ +
+ )} +
+ )} ); }; @@ -172,7 +175,8 @@ const Markdown = ({ content, title }: MarkdownProps) => { a: ({ href, children }) => { if (href && !isInCatalogView) { const linkMediaInfo = getLinkMediaInfo(href); - if (getHasThumbnail(linkMediaInfo, href)) { + const embedUrl = new URL(href); + if (canEmbed(embedUrl) || getHasThumbnail(linkMediaInfo, href)) { return ; } else { return (