Fix order of corrections
This commit is contained in:
parent
bc9bf8cdec
commit
2b9d14222d
|
|
@ -17,7 +17,7 @@ describe('Spellcheck', () => {
|
|||
teaser: 'Die Berufsbildung ist ein neuer Lebensabschnit',
|
||||
intro: '\n <p>Sie stehen am Anfang eines neuen Lebensabschnitts. In Ihrer Rolle als Berufslernende oder Berufslernender haben Sie Verantwortung \u00fcbernommen.</p>\n <p>Wie erging es Ihnen am ersten Arbeits- und Schultag?</p>\n ',
|
||||
slug: 'lohn-und-budget',
|
||||
heroImage: 'https://hep-skillbox-files-prod.s3-eu-central-1.amazonaws.com/original_images/dummy_7bzqodY.jpg',
|
||||
heroImage: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mP8z/C/HgAGgwJ/lK3Q6wAAAABJRU5ErkJggg==',
|
||||
solutionsEnabled: false,
|
||||
bookmark: {note: null, '__typename': 'ModuleBookmarkNode'},
|
||||
__typename: 'ModuleNode',
|
||||
|
|
|
|||
|
|
@ -15,7 +15,9 @@
|
|||
}
|
||||
let parts = [];
|
||||
let index = 0;
|
||||
this.corrections.forEach(current => {
|
||||
[...this.corrections] // no side effects, as sort changes the source array
|
||||
.sort((e1, e2) => e1.offset - e2.offset)
|
||||
.forEach(current => {
|
||||
parts.push({
|
||||
correct: true,
|
||||
text: this.text.substring(index, current.offset)
|
||||
|
|
|
|||
Loading…
Reference in New Issue