Cleanup
This commit is contained in:
parent
2b54735175
commit
ef0d35ccee
18
service.js
18
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)
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user