Refine positioning of status icon within CKEditor

This commit is contained in:
Aljaž Grilc 2024-05-08 11:25:06 +02:00
parent d867346bbe
commit 7b2ae27649

View File

@ -778,8 +778,8 @@ class BesCKService extends BesService {
// 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.
service.repositionMistakes()
setTimeout(() => {
service.repositionMistakes()
window.dispatchEvent(new Event('resize'))
}, 100)
service.timer = setTimeout(function () {
@ -805,6 +805,7 @@ class BesCKService extends BesService {
this.proof(this.hostElement)
}, 500)
}
/**
* This function disables the CKEditor spellcheck.
*
@ -881,6 +882,13 @@ class BesCKService extends BesService {
this.abortController = new AbortController()
this.proofCKEditor()
}
setStatusDivPosition(hostElement, statusDiv) {
const hRects = hostElement.getBoundingClientRect()
const scrollTop = window.scrollY || document.documentElement.scrollTop
statusDiv.style.left = hRects.right - 50 + 'px'
statusDiv.style.top = hRects.top + hRects.height - 50 + scrollTop + 'px'
}
}
///