diff --git a/packages/shared/src/components/post/PostContent.tsx b/packages/shared/src/components/post/PostContent.tsx index ccc3bac80d..17e4a1f73a 100644 --- a/packages/shared/src/components/post/PostContent.tsx +++ b/packages/shared/src/components/post/PostContent.tsx @@ -27,6 +27,7 @@ import { PostClickbaitShield } from './common/PostClickbaitShield'; import { useSmartTitle } from '../../hooks/post/useSmartTitle'; import { PostTagList } from './tags/PostTagList'; import PostSourceInfo from './PostSourceInfo'; +import { useReaderInstallPromptGate } from '../../hooks/useReaderInstallPromptGate'; type PostContentRawProps = Omit & { post: Post }; @@ -43,9 +44,12 @@ const ArticleLink = ({ onClick, children, ...props -}: ComponentProps<'a'> & { href?: string; onClick?: () => void }) => { +}: ComponentProps<'a'> & { + href?: string; + onClick?: (event: React.MouseEvent) => void; +}) => { const clickHandlers = onClick - ? combinedClicks(() => onClick()) + ? combinedClicks(onClick) : undefined; return ( (onClose as (event?: unknown) => void)() + : undefined, + }, + ); + const handleImageClick = (event: React.MouseEvent) => { + if (onReaderInstallGateClick(event)) { + return; + } + onReadArticle(); + }; const onSendViewPost = useViewPost(); const showCodeSnippets = useFeature(feature.showCodeSnippets); const { title } = useSmartTitle(post); @@ -220,7 +238,7 @@ export function PostContentRaw({ {!isVideoType && (