Rename popupCorrectionPanel to preparePopup and update parameter names for clarity

This commit is contained in:
Aljaž Grilc 2025-02-27 09:28:40 +01:00
parent 54c0307d9b
commit 53fc05a2f8

View File

@ -676,17 +676,16 @@ class BesService {
} }
/** /**
* Displays correction panel. * Prepares and displays popup.
* *
* @param {*} el Block element/paragraph containing grammar checking rule match * @param {*} elMatch Array containing block element/paragraph containing grammar checking rule match and a match
* @param {*} match Grammar checking rule match
* @param {PointerEvent} source Click event source * @param {PointerEvent} source Click event source
*/ */
popupCorrectionPanel(pointsInRect, source) { preparePopup(elMatch, source) {
this.dismissPopup() this.dismissPopup()
const popup = document.querySelector('bes-popup-el') const popup = document.querySelector('bes-popup-el')
BesPopup.clearReplacements() BesPopup.clearReplacements()
pointsInRect.forEach(({ el, match }) => { elMatch.forEach(({ el, match }) => {
popup.setContent(el, match, this, this.isContentEditable()) popup.setContent(el, match, this, this.isContentEditable())
this.highlightMistake(match) this.highlightMistake(match)
}) })
@ -1133,7 +1132,7 @@ class BesTreeService extends BesService {
} }
} }
this.dismissPopup() this.dismissPopup()
if (pointsInRect.length) this.popupCorrectionPanel(pointsInRect, source) if (pointsInRect.length) this.preparePopup(pointsInRect, source)
} }
} }
@ -1797,7 +1796,7 @@ class BesPlainTextService extends BesService {
} }
} }
this.dismissPopup() this.dismissPopup()
if (pointsInRect.length) this.popupCorrectionPanel(pointsInRect, source) if (pointsInRect.length) this.preparePopup(pointsInRect, source)
} }
/** /**