ft-interactive / starter-kit

A template for IG pages
65 stars 15 forks source link

Fix text highlight ordering bug #348

Closed sdl60660 closed 3 months ago

sdl60660 commented 3 months ago

Fixes a text highlight issue with the offset when highlights are not listed in order in config. This caused problems like this...

Screenshot 2024-07-10 at 9 31 02 AM

Screenshot 2024-07-10 at 9 31 13 AM 866)

...because the reduce function was processing later highlights first, adding to the offset and then placing earlier highlights in the wrong spot, sometimes even inserting them mid-span tag. By just sorting on start index, this problem is avoided.