From ef0d35cceeafc5e6658f33b4d688a5ef3b486607 Mon Sep 17 00:00:00 2001 From: Simon Rozman Date: Tue, 4 Mar 2025 10:49:12 +0100 Subject: [PATCH] Cleanup --- service.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/service.js b/service.js index 4073520..4e0c682 100644 --- a/service.js +++ b/service.js @@ -1040,14 +1040,14 @@ class BesService { /** * Prepares and displays popup. * - * @param {*} elMatch Array containing block element/paragraph containing grammar checking rule match and a match + * @param {*} hits Array containing block element/paragraph containing grammar checking rule match and a match * @param {PointerEvent} source Click event source */ - preparePopup(elMatch, source) { + preparePopup(hits, source) { this.dismissPopup() const popup = document.querySelector('bes-popup-el') BesPopup.clearReplacements() - elMatch.forEach(({ el, match }) => { + hits.forEach(({ el, match }) => { popup.setContent(el, match, this, this.isContentEditable()) this.highlightMistake(match) }) @@ -1521,19 +1521,19 @@ class BesTreeService extends BesService { const canvasPanelRect = this.canvasPanel.getBoundingClientRect() let x = source.clientX - canvasPanelRect.x let y = source.clientY - canvasPanelRect.y - const pointsInRect = [] + const hits = [] for (let result of this.results) { for (let m of result.matches) { for (let rect of m.highlights) { if (BesService.isPointInRect(x, y, rect, 5)) { - pointsInRect.push({ el, match: m }) + hits.push({ el, match: m }) break } } } } this.dismissPopup() - if (pointsInRect.length) this.preparePopup(pointsInRect, source) + if (hits.length) this.preparePopup(hits, source) } } @@ -2189,19 +2189,19 @@ class BesPlainTextService extends BesService { const canvasPanelRect = this.canvasPanel.getBoundingClientRect() let x = source.clientX - canvasPanelRect.x let y = source.clientY - canvasPanelRect.y - const pointsInRect = [] + const hits = [] for (let result of this.results) { for (let m of result.matches) { for (let rect of m.highlights) { if (BesService.isPointInRect(x, y, rect, 5)) { - pointsInRect.push({ el: result.range, match: m }) + hits.push({ el: result.range, match: m }) break } } } } this.dismissPopup() - if (pointsInRect.length) this.preparePopup(pointsInRect, source) + if (hits.length) this.preparePopup(hits, source) } /**