Fix rendering mistakes in textarea instances following corrections

This commit is contained in:
Aljaž Grilc 2024-04-29 08:57:20 +02:00
parent 2192845cae
commit f6ee559065

View File

@ -300,18 +300,20 @@ class BesService {
matches: matches
})
const dataToChange = this
let observer = new MutationObserver(function (mutations) {
mutations.forEach(mutation => {
if (mutation.type === 'characterData') {
const el = dataToChange.children?.find(
child => child.element === mutation.target
)
if (el) el.isProofed = false
}
if (!this.textAreaService) {
const dataToChange = this
let observer = new MutationObserver(function (mutations) {
mutations.forEach(mutation => {
if (mutation.type === 'characterData') {
const el = dataToChange.children?.find(
child => child.element === mutation.target
)
if (el) el.isProofed = false
}
})
})
})
observer.observe(el, { characterData: true, subtree: true })
observer.observe(el, { characterData: true, subtree: true })
}
}
/**
@ -322,6 +324,7 @@ class BesService {
clearMistakeMarkup(el) {
let child = this.children?.find(child => child.element === el)
if (!child) return
if (this.textAreaService) child.isProofed = false
child.matches.forEach(match => {
if (match?.highlights) {
match.highlights.forEach(h => h.remove())