From 70ee1ca957c07082a651d92653eb62de1c6316eb Mon Sep 17 00:00:00 2001 From: Thylane <69613663+Thylane@users.noreply.github.com> Date: Fri, 7 Jun 2024 05:49:52 +0800 Subject: [PATCH] fix performance issue in dataview plugin --- src/main.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main.ts b/src/main.ts index 86beda9..b3e7984 100644 --- a/src/main.ts +++ b/src/main.ts @@ -19,6 +19,12 @@ export default class MarkdownAttributes extends Plugin { if (!child) return; let str: string; + /** + * A quick test to avoid causing performance issue in plugin. + * Keypoint: use `textContent` instead of `innerText`. + */ + if (!topElement.textContent.contains("{")) return; + /** Code blocks have to be handled separately because Obsidian does not * include any text past the language. *