From e1b4bfb2c0727f02500e9ac2c577c8d7d17fb77d Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Thu, 13 Jun 2024 10:03:57 +0200 Subject: [PATCH] Move repositionAllMarkup() upstream --- service2.js | 45 +++++++++++++++------------------------------ 1 file changed, 15 insertions(+), 30 deletions(-) diff --git a/service2.js b/service2.js index b441026..37a8258 100644 --- a/service2.js +++ b/service2.js @@ -308,6 +308,21 @@ class BesService { popup.show(source.clientX, source.clientY) } + /** + * Updates all grammar mistake markup positions. + */ + repositionAllMarkup() { + this.results.forEach(result => { + result.matches.forEach(match => { + if (match.highlights) match.highlights.forEach(h => h.remove()) + match.highlights = this.addMistakeMarkup( + match.range, + match.match.rule.id + ) + }) + }) + } + /** * Replaces grammar checking match with a suggestion provided by grammar checking service. * @@ -563,21 +578,6 @@ class BesTreeService extends BesService { ) } - /** - * Updates all grammar mistake markup positions. - */ - repositionAllMarkup() { - this.results.forEach(result => { - result.matches.forEach(match => { - if (match.highlights) match.highlights.forEach(h => h.remove()) - match.highlights = this.addMistakeMarkup( - match.range, - match.match.rule.id - ) - }) - }) - } - /** * Clears given block element grammar mistake markup. * @@ -1318,21 +1318,6 @@ class BesPlainTextService extends BesService { ) } - /** - * Updates all grammar mistake markup positions. - */ - repositionAllMarkup() { - this.results.forEach(result => { - result.matches.forEach(match => { - if (match.highlights) match.highlights.forEach(h => h.remove()) - match.highlights = this.addMistakeMarkup( - match.range, - match.match.rule.id - ) - }) - }) - } - /** * Clears given paragraph grammar mistake markup. *