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

[FIX] Emoji are rendered in URL #15516

Merged
merged 2 commits into from
Oct 9, 2019

Conversation

ogustavo-pereira
Copy link
Contributor

@ogustavo-pereira ogustavo-pereira commented Oct 4, 2019

Closes #15050
Closes #6770
Closes #12321
Captura de tela de 2019-10-04 20-10-45

Copy link
Member

@ggazzo ggazzo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hey @oguhpereira thanks for your contribution, but your change "skips" the others parsers (like mentions or emojis).

The method we developed to solve this is using tokens

use the replaceFn argument Autolinker.link(msgPart, {replaceFn ....}, to return a token instead of the original html AND insert on message.tokens like:

message.tokens.push({ token, text: tag.toAnchorString() })

look how we protect the code parse here app/markdown/lib/parser/original/code.js

@@ -59,7 +59,7 @@ const renderMessage = (message) => {
regexTokens = new RegExp(`(${ (message.tokens || []).map(({ token }) => RegExp.escape(token)) })`, 'g');
msgParts = message.html.split(regexTokens);
} else {
msgParts = [message.html];
msgParts = [message.msg];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
msgParts = [message.msg];
msgParts = [message.html];

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank's for feedback @ggazzo,

I had not realized, sorry. I rollback my changes and added your changes in my commit

@rgembalik
Copy link

Will this merge affect this issue? #7741

@rodrigok rodrigok mentioned this pull request Oct 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants