From 4fa2860721284f5449f1c4d7305810561f5d546c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?nicole=20miko=C5=82ajczyk?= Date: Fri, 17 Oct 2025 21:08:03 +0200 Subject: [PATCH] pl-fe: fix hashtag bar behavior MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: nicole mikołajczyk --- .../pl-fe/src/components/parsed-content.tsx | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/packages/pl-fe/src/components/parsed-content.tsx b/packages/pl-fe/src/components/parsed-content.tsx index f9cd78863..2d502c541 100644 --- a/packages/pl-fe/src/components/parsed-content.tsx +++ b/packages/pl-fe/src/components/parsed-content.tsx @@ -181,7 +181,7 @@ function parseContent({ // Quote posting if (hasQuote) selectors.push('quote-inline'); - const hashtags: Array = []; + let hashtags: Array = []; let hasSuspiciousUrl = false; @@ -287,15 +287,26 @@ function parseContent({ for (const child of domNode.children) { switch (child.type) { case 'text': - if (child.data.trim().length) return; + if (child.data.trim().length) { + hashtags = []; + return; + } break; case 'tag': - if (child.name !== 'a') return; - if (!child.attribs.class?.split(' ').includes('hashtag')) return; + if (child.name !== 'a') { + hashtags = []; + return; + } + if (!child.attribs.class?.split(' ').includes('hashtag')) { + hashtags = []; + return; + } hashtags.push(normalizeHashtag(nodesToText([child]))); break; default: + hashtags = []; return; + } }