Revert "Implement debouncing to optimize text error handling"

It provided partial implementation only: for BesDOMService. What about
CKEditor?

This was optimizing something that users could "potentially" experience.
I didn't experience any performance problems on texts with hundreds of
grammar mistakes. Let alone a typical text users would have.

Skipping repositionAllMarkup() provides temporary misalignment between
markup and text. Performance vs. aesthetics?

Not convinced.

Reverts: 32f4360de9a5d2654a338ecf590d8f5f5cae2fec
This commit is contained in:
Simon Rozman 2024-06-10 15:44:32 +02:00
parent f1bd0a2416
commit 43d7198b74

View File

@ -26,7 +26,6 @@ class BesService {
this.hostElement = hostElement
this.results = [] // Results of grammar-checking, one per each block/paragraph of text
this.createCorrectionPanel()
this.firstCall = true
// Disable browser built-in spell-checker to prevent collision with our grammar markup.
this.originalSpellcheck = this.hostElement.spellcheck
@ -778,16 +777,7 @@ class BesDOMService extends BesTreeService {
*/
onInput() {
// Now that the text is done changing, we can correctly calculate markup position.
// This is a way to resolve lagginess in repositioning markup with many mistakes.
if (this.firstCall) {
this.repositionAllMarkup()
this.firstCall = false
}
clearTimeout(this.debounceTimer)
this.debounceTimer = setTimeout(() => {
this.repositionAllMarkup()
this.firstCall = true
}, 300)
this.repositionAllMarkup()
// Defer grammar-checking to reduce stress on grammar-checking server.
this.timer = setTimeout(() => {