This commit is contained in:
Simon Rozman 2024-04-02 16:05:31 +02:00
parent 4a23cc057e
commit fbfb8b419f

View File

@ -579,8 +579,11 @@ class BesService {
if (this.textAreaService) {
let text = this.textAreaService.textAreaEl.value
this.textAreaService.textAreaEl.value =
text.substring(0, match.match.offset) + replacement + text.substring(match.match.offset + match.match.length)
this.textAreaService.textAreaEl.selectionStart = this.textAreaService.textAreaEl.selectionEnd = match.match.offset
text.substring(0, match.match.offset) +
replacement +
text.substring(match.match.offset + match.match.length)
this.textAreaService.textAreaEl.selectionStart =
this.textAreaService.textAreaEl.selectionEnd = match.match.offset
}
this.clearMistakeMarkup(el)
// In my opinion, this approach provides the most straightforward solution for repositioning mistakes after a change.