mirror of
https://github.com/zadam/trilium.git
synced 2025-12-22 15:24:24 +01:00
chore(highlights_list): improve performance by matching fewer elements
This commit is contained in:
parent
d18ac0c613
commit
751a874c51
@ -180,6 +180,8 @@ function ReadOnlyTextHighlightsList() {
|
||||
function extractHeadingsFromStaticHtml(el: HTMLElement | null) {
|
||||
if (!el) return [];
|
||||
|
||||
const { color: defaultColor, backgroundColor: defaultBackgroundColor } = getComputedStyle(el);
|
||||
|
||||
const walker = document.createTreeWalker(
|
||||
el,
|
||||
NodeFilter.SHOW_TEXT,
|
||||
@ -197,7 +199,8 @@ function extractHeadingsFromStaticHtml(el: HTMLElement | null) {
|
||||
|
||||
if (
|
||||
el.closest('strong, em, u') ||
|
||||
style.color || style.backgroundColor
|
||||
style.color !== defaultColor ||
|
||||
style.backgroundColor !== defaultBackgroundColor
|
||||
) {
|
||||
const attrs: RawHighlight["attrs"] = {
|
||||
bold: !!el.closest("strong"),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user