From d18ac0c6139f8a241ee49282e7a5f16602486bc4 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Thu, 18 Dec 2025 13:33:08 +0200 Subject: [PATCH] fix(highlights_list): displaying non-highlighted attributes --- .../src/widgets/sidebar/HighlightsList.tsx | 30 +++++++++++-------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/apps/client/src/widgets/sidebar/HighlightsList.tsx b/apps/client/src/widgets/sidebar/HighlightsList.tsx index a575f2f1a..755071cab 100644 --- a/apps/client/src/widgets/sidebar/HighlightsList.tsx +++ b/apps/client/src/widgets/sidebar/HighlightsList.tsx @@ -191,7 +191,7 @@ function extractHeadingsFromStaticHtml(el: HTMLElement | null) { let node: Node | null; while ((node = walker.nextNode())) { const el = node.parentElement; - if (!el || !node.textContent?.trim()) continue; + if (!el || !node.textContent) continue; const style = getComputedStyle(el); @@ -199,18 +199,22 @@ function extractHeadingsFromStaticHtml(el: HTMLElement | null) { el.closest('strong, em, u') || style.color || style.backgroundColor ) { - highlights.push({ - id: crypto.randomUUID(), - text: node.textContent, - element: el, - attrs: { - bold: !!el.closest("strong"), - italic: !!el.closest("em"), - underline: !!el.closest("u"), - background: el.style.backgroundColor, - color: el.style.color - } - }); + const attrs: RawHighlight["attrs"] = { + bold: !!el.closest("strong"), + italic: !!el.closest("em"), + underline: !!el.closest("u"), + background: el.style.backgroundColor, + color: el.style.color + }; + + if (Object.values(attrs).some(Boolean)) { + highlights.push({ + id: crypto.randomUUID(), + text: node.textContent, + element: el, + attrs + }); + } } }