Move repositionAllMarkup() upstream

This commit is contained in:
Simon Rozman 2024-06-13 10:03:57 +02:00
parent 6b92aeb11a
commit e1b4bfb2c0

View File

@ -308,6 +308,21 @@ class BesService {
popup.show(source.clientX, source.clientY) popup.show(source.clientX, source.clientY)
} }
/**
* Updates all grammar mistake markup positions.
*/
repositionAllMarkup() {
this.results.forEach(result => {
result.matches.forEach(match => {
if (match.highlights) match.highlights.forEach(h => h.remove())
match.highlights = this.addMistakeMarkup(
match.range,
match.match.rule.id
)
})
})
}
/** /**
* Replaces grammar checking match with a suggestion provided by grammar checking service. * Replaces grammar checking match with a suggestion provided by grammar checking service.
* *
@ -563,21 +578,6 @@ class BesTreeService extends BesService {
) )
} }
/**
* Updates all grammar mistake markup positions.
*/
repositionAllMarkup() {
this.results.forEach(result => {
result.matches.forEach(match => {
if (match.highlights) match.highlights.forEach(h => h.remove())
match.highlights = this.addMistakeMarkup(
match.range,
match.match.rule.id
)
})
})
}
/** /**
* Clears given block element grammar mistake markup. * Clears given block element grammar mistake markup.
* *
@ -1318,21 +1318,6 @@ class BesPlainTextService extends BesService {
) )
} }
/**
* Updates all grammar mistake markup positions.
*/
repositionAllMarkup() {
this.results.forEach(result => {
result.matches.forEach(match => {
if (match.highlights) match.highlights.forEach(h => h.remove())
match.highlights = this.addMistakeMarkup(
match.range,
match.match.rule.id
)
})
})
}
/** /**
* Clears given paragraph grammar mistake markup. * Clears given paragraph grammar mistake markup.
* *