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) {
|
function extractHeadingsFromStaticHtml(el: HTMLElement | null) {
|
||||||
if (!el) return [];
|
if (!el) return [];
|
||||||
|
|
||||||
|
const { color: defaultColor, backgroundColor: defaultBackgroundColor } = getComputedStyle(el);
|
||||||
|
|
||||||
const walker = document.createTreeWalker(
|
const walker = document.createTreeWalker(
|
||||||
el,
|
el,
|
||||||
NodeFilter.SHOW_TEXT,
|
NodeFilter.SHOW_TEXT,
|
||||||
@ -197,7 +199,8 @@ function extractHeadingsFromStaticHtml(el: HTMLElement | null) {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
el.closest('strong, em, u') ||
|
el.closest('strong, em, u') ||
|
||||||
style.color || style.backgroundColor
|
style.color !== defaultColor ||
|
||||||
|
style.backgroundColor !== defaultBackgroundColor
|
||||||
) {
|
) {
|
||||||
const attrs: RawHighlight["attrs"] = {
|
const attrs: RawHighlight["attrs"] = {
|
||||||
bold: !!el.closest("strong"),
|
bold: !!el.closest("strong"),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user