mirror of
https://github.com/zadam/trilium.git
synced 2025-12-20 22:34:23 +01:00
fix(highlights_list): displaying non-highlighted attributes
This commit is contained in:
parent
cd9654cd5f
commit
d18ac0c613
@ -191,7 +191,7 @@ function extractHeadingsFromStaticHtml(el: HTMLElement | null) {
|
|||||||
let node: Node | null;
|
let node: Node | null;
|
||||||
while ((node = walker.nextNode())) {
|
while ((node = walker.nextNode())) {
|
||||||
const el = node.parentElement;
|
const el = node.parentElement;
|
||||||
if (!el || !node.textContent?.trim()) continue;
|
if (!el || !node.textContent) continue;
|
||||||
|
|
||||||
const style = getComputedStyle(el);
|
const style = getComputedStyle(el);
|
||||||
|
|
||||||
@ -199,20 +199,24 @@ function extractHeadingsFromStaticHtml(el: HTMLElement | null) {
|
|||||||
el.closest('strong, em, u') ||
|
el.closest('strong, em, u') ||
|
||||||
style.color || style.backgroundColor
|
style.color || style.backgroundColor
|
||||||
) {
|
) {
|
||||||
highlights.push({
|
const attrs: RawHighlight["attrs"] = {
|
||||||
id: crypto.randomUUID(),
|
|
||||||
text: node.textContent,
|
|
||||||
element: el,
|
|
||||||
attrs: {
|
|
||||||
bold: !!el.closest("strong"),
|
bold: !!el.closest("strong"),
|
||||||
italic: !!el.closest("em"),
|
italic: !!el.closest("em"),
|
||||||
underline: !!el.closest("u"),
|
underline: !!el.closest("u"),
|
||||||
background: el.style.backgroundColor,
|
background: el.style.backgroundColor,
|
||||||
color: el.style.color
|
color: el.style.color
|
||||||
}
|
};
|
||||||
|
|
||||||
|
if (Object.values(attrs).some(Boolean)) {
|
||||||
|
highlights.push({
|
||||||
|
id: crypto.randomUUID(),
|
||||||
|
text: node.textContent,
|
||||||
|
element: el,
|
||||||
|
attrs
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return highlights;
|
return highlights;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user