Improve popup positioning based on rect's postion and not on click's X,Y coordiantes.

Closes #3
This commit is contained in:
2025-06-11 10:01:40 +02:00
parent 3cd86bf4c3
commit d3deb4cb11

View File

@@ -1145,8 +1145,14 @@ class BesService {
hits.forEach(({ el, match }) => {
popup.setContent(el, match, this, this.isContentEditable())
this.highlightMistake(match)
const containerRect = this.hostElement.getBoundingClientRect()
match.highlights.forEach(rect => {
const clientX = rect.x + containerRect.left
const clientY =
rect.y + containerRect.top + rect.height - this.hostElement.scrollTop
popup.show(clientX, clientY, this)
})
})
popup.show(source.clientX, source.clientY, this)
}
/**