Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace all words at one time. #85

Merged
merged 8 commits into from
May 23, 2018
Merged

Conversation

leafOfTree
Copy link
Contributor

@leafOfTree leafOfTree commented Apr 3, 2018

As #78 mentioned, words with any chars in '<mark style="background-color:'+ color +';">' + encodedMatch + '</mark>' elements could cause wrong replacement if replacing word one by one.

To fix this. all words are joined as one regexp to replace text at one time.

Ex:

words: [
  {
    color: '#ADF0FF',
    words: ['abc']
  },
  {
    color: 'blue',
    words: ['-']
  }
],

image

@garysieling garysieling merged commit 707dfe4 into garysieling:master May 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants