Add a comment about possible performance issues

This commit is contained in:
Aljaž Grilc 2024-04-10 09:50:41 +02:00
parent cf8bc8afbd
commit 6aaa8c4472

View File

@ -254,8 +254,7 @@ class BesService {
BesService.getNodesInRange(range).forEach(el => {
if (
el === hostElement ||
Array.from(hostElement.childNodes).includes(el) ||
hostElement.contains(el)
Array.from(hostElement.childNodes).includes(el)
) {
blockElements.add(service.getBlockParent(el))
}
@ -266,6 +265,8 @@ class BesService {
service.removeChild(block)
})
// Not a nice way to do it, but it works for now the repositionMistakes function is called before the DOM updates are finished.
// If users will experience performance issues, we can consider debouncing this function.
// The lagginess becomes noticeable if the text is long and has many grammar mistakes.
setTimeout(() => {
service.repositionMistakes()
}, 0)