diff --git a/packages/pl-fe/src/components/hashtag-link.tsx b/packages/pl-fe/src/components/hashtag-link.tsx index 1f571b7e7b..5cb71c656e 100644 --- a/packages/pl-fe/src/components/hashtag-link.tsx +++ b/packages/pl-fe/src/components/hashtag-link.tsx @@ -7,7 +7,7 @@ interface IHashtagLink { } const HashtagLink: React.FC = ({ hashtag }) => ( - + e.stopPropagation()}> #{hashtag} ); diff --git a/packages/pl-fe/src/components/status-content.tsx b/packages/pl-fe/src/components/status-content.tsx index b69973db62..c6b4db5a49 100644 --- a/packages/pl-fe/src/components/status-content.tsx +++ b/packages/pl-fe/src/components/status-content.tsx @@ -23,6 +23,9 @@ import type { MinifiedStatus } from 'pl-fe/reducers/statuses'; const MAX_HEIGHT = 322; // 20px * 16 (+ 2px padding at the top) const BIG_EMOJI_LIMIT = 10; +const nodesToText = (nodes: Array): string => + nodes.map(node => node.type === 'text' ? node.data : node.type === 'tag' ? nodesToText(node.children as Array) : '').join(''); + interface IReadMoreButton { onClick: React.MouseEventHandler; quote?: boolean; @@ -148,10 +151,9 @@ const StatusContent: React.FC = React.memo(({ } if (classes?.includes('hashtag')) { - const child = domToReact(domNode.children as DOMNode[]); - const hashtag = typeof child === 'string' ? child.replace(/^#/, '') : undefined; + const hashtag = nodesToText(domNode.children as Array); if (hashtag) { - return ; + return ; } }