Fix highlight not working after first highlight insert #1098 #1099
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The highlight did not work correctly after the first highlight happened. Most likely it would only highlight the first letter.
Newer version of the highlight function have added a removeHighlight() function that allows to reset the strings between each highlights and then getting a good result.
Problem, that version does not use Regexp to match the highlight anymore and their file does not pass the strict mode as is so it can't be commited to selectize.
It's a bit weird to have that contrib commited into the repo. I don't know if it's wise to edit it in our code or not or to update it or to remove it, or... So I've just made the minimal changes to fix the issue without changing much. I've copied their removeHighlight() fn and edited it to pass strict mode.
From issue #1098