This repository has been archived by the owner on Jul 23, 2019. It is now read-only.
Allow to configure the HTML part of regexes #645
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.
Why is this change needed?
Emojione does not replace emojis that are inside an
<object>
or<span>
tag. This can be problematic in some scenarios. In our case this is problematic when processing content generated by an editor (TinyMCE), since the editor generates spans to format text.I don't understand the reasons for avoiding the content inside these tags, but in our case removing them does not cause any problem and solve these issues.
What's the change
The change makes the part of the regexes that match HTML configurable, so that by default it keeps the same behaviour but, if wanted, a new regex can be provided. In our case, the same regex without the part.
The ugly part is that when the HTML regex is changed, the other regexes need to be recomputed, that's why I added the
computeRegexes
method, so you would use it like:Making this more clean would require moving all the regexes inside methods and that's a bigger change.
The change allows to fix #537