-
Notifications
You must be signed in to change notification settings - Fork 40
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
URLs get processed too #1
Comments
Hi @akx! I use with react-autolink in my case, so first convert url to link, then convert if it matches with emoji annotation or emoticon. mixins: [
ReactAutolink,
ReactEmoji
],
renderMessage: function(contents) {
return _.flatten(
this.autolink(contents, {target: "_blank"}).map(function(content) {
if (React.isValidElement(content)) {
return content;
} else {
return this.emojify(content);
}
}.bind(this))
);
},
render: function() {
return this.renderMessage(this.props.text));
} Aside from this solution, I feel I may remove What do you think? |
For the time being, I ended up just disabling emoticons altogether, which is fine for my use case -- I really only need support for annotations anyway. function formatText(text) {
var content = [];
if(!_.isString(text)) return [];
_.each(text.split("\n"), function(line, index) {
line = _.trim(line);
if(line && line.length) {
content.push(_.map(ReactEmoji.emojify(line, {useEmoticon: false}), function(bit, index) {
if(_.isString(bit)) {
if(urlRegexp.test(bit)) {
bit = <a href={bit} target="_blank" key={"u" + index}>{ellipsize(bit, 40)}</a>;
}
}
return bit;
}));
content.push(<br key={index}/>);
}
});
return content;
} And thanks for your work on react-emoji! |
is there a way to remove |
The
:/
pattern is matched in "http://foo", so the output is something like "http 😦 /foo".Would there be an easy way to fix this?
The text was updated successfully, but these errors were encountered: