From f6ee55906548b80cf091a39db04c78202418f998 Mon Sep 17 00:00:00 2001 From: Aljaz Grilc Date: Mon, 29 Apr 2024 08:57:20 +0200 Subject: [PATCH] Fix rendering mistakes in textarea instances following corrections --- service.js | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/service.js b/service.js index 1edcb03..284782e 100644 --- a/service.js +++ b/service.js @@ -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())