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:
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 https://github.com/emojione/emojione/issues/537