pl-fe: fix hashtag bar behavior

Signed-off-by: nicole mikołajczyk <git@mkljczk.pl>
This commit is contained in:
nicole mikołajczyk
2025-10-17 21:08:03 +02:00
parent 071acc314c
commit 4fa2860721

View File

@ -181,7 +181,7 @@ function parseContent({
// Quote posting
if (hasQuote) selectors.push('quote-inline');
const hashtags: Array<string> = [];
let hashtags: Array<string> = [];
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;
}
}