fix hashtag links opening in new tabs (#2373)

This commit is contained in:
Edward Kung 2025-07-31 10:58:58 -07:00 committed by GitHub
parent c77d10dad2
commit 0299bbe4bc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -133,9 +133,9 @@ export default memo(function Text ({ rel = UNKNOWN_LINK_REL, imgproxyUrls, child
if (outlawed) { if (outlawed) {
return href return href
} }
const isHashLink = href.startsWith('#')
// eslint-disable-next-line // eslint-disable-next-line
return <Link id={props.id} target='_blank' rel={rel} href={href}>{children}</Link> return <Link id={props.id} target={isHashLink ? undefined : '_blank'} rel={rel} href={href}>{children}</Link>
}, },
img: TextMediaOrLink, img: TextMediaOrLink,
embed: (props) => <Embed {...props} topLevel={topLevel} /> embed: (props) => <Embed {...props} topLevel={topLevel} />