Push ruleType into matches object, since it is needed later to correctly reposition markup

This commit is contained in:
Aljaž Grilc 2024-06-05 09:47:57 +02:00
parent 81d60bd37e
commit 54ba1dea33

View File

@ -484,7 +484,8 @@ class BesTreeService extends BesService {
rects: clientRects, rects: clientRects,
highlights: highlights, highlights: highlights,
range: range, range: range,
match: match match: match,
ruleType: ruleType
}) })
}) })
this.markProofed(node, matches) this.markProofed(node, matches)
@ -549,7 +550,10 @@ class BesTreeService extends BesService {
repositionAllMarkup() { repositionAllMarkup() {
this.results.forEach(result => { this.results.forEach(result => {
result.matches.forEach(match => { result.matches.forEach(match => {
const { clientRects, highlights } = this.addMistakeMarkup(match.range) const { clientRects, highlights } = this.addMistakeMarkup(
match.range,
match.ruleType
)
match.rects = clientRects match.rects = clientRects
if (match.highlights) match.highlights.forEach(h => h.remove()) if (match.highlights) match.highlights.forEach(h => h.remove())
match.highlights = highlights match.highlights = highlights
@ -1287,7 +1291,10 @@ class BesPlainTextService extends BesService {
repositionAllMarkup() { repositionAllMarkup() {
this.results.forEach(result => { this.results.forEach(result => {
result.matches.forEach(match => { result.matches.forEach(match => {
const { clientRects, highlights } = this.addMistakeMarkup(match.range) const { clientRects, highlights } = this.addMistakeMarkup(
match.range,
match.ruleType
)
match.rects = clientRects match.rects = clientRects
if (match.highlights) match.highlights.forEach(h => h.remove()) if (match.highlights) match.highlights.forEach(h => h.remove())
match.highlights = highlights match.highlights = highlights