perf: run on nextTick only if necessary

This commit is contained in:
Julien Calixte
2025-07-12 17:39:00 +02:00
parent 1918ebc921
commit b93dfbd824
3 changed files with 14 additions and 16 deletions

View File

@@ -84,11 +84,20 @@ watch([content, mode], () => {
nextTick(() => {
listenToClick()
useImages(props.sha)
generateTweets()
mermaid.run({
querySelector: `.note-${sha.value} .mermaid`,
})
if (/\!\[.*?\]\(.*?\)/.test(rawContent.value)) {
useImages(props.sha)
}
if (rawContent.value.includes("@[tweet]")) {
generateTweets()
}
if (rawContent.value.includes("```mermaid")) {
mermaid.run({
querySelector: `.note-${sha.value} .mermaid`,
})
}
})
})