Reinstate setTimeout function in CKEditor to ensure proper handling of instances where a specific height value is assigned to the editable element

This commit is contained in:
Aljaž Grilc 2024-05-22 14:22:16 +02:00
parent afd9709ef5
commit 06513cab05
2 changed files with 17 additions and 6 deletions

View File

@ -15,3 +15,7 @@
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
line-height: 20px; line-height: 20px;
} }
.ck-editor__editable {
height: 400px;
}

View File

@ -813,12 +813,19 @@ class BesCKService extends BesTreeService {
this.clearProofing(domElement) this.clearProofing(domElement)
} }
this.repositionAllMarkup() // TODO: Research if input event or any other event that is called *after* the change is completed
// Defer grammar-checking to reduce stress on grammar-checking server. // is possible with CKEditor, and move the code below this line there.
this.timer = setTimeout(() => { // SetTimeout is in fact necessary, because if we set specific height to the editable CKeditor element, it will not be updated immediately.
this.proofAll() setTimeout(() => {
delete this.timer // Now that the text is done changing, we can correctly calculate markup position.
}, 1000) this.repositionAllMarkup()
// Defer grammar-checking to reduce stress on grammar-checking server.
this.timer = setTimeout(() => {
this.proofAll()
delete this.timer
}, 1000)
}, 0)
} }
/** /**