|
@@ -26,11 +26,27 @@ class ChatMessage extends AbstractChatMessage<Props> {
|
26
|
26
|
const { message, t } = this.props;
|
27
|
27
|
const processedMessage = [];
|
28
|
28
|
|
29
|
|
- // content is an array of text and emoji components
|
30
|
|
- const content = toArray(this._getMessageText(), { className: 'smiley' });
|
|
29
|
+ const txt = this._getMessageText();
|
|
30
|
+
|
|
31
|
+ // Tokenize the text in order to avoid emoji substitution for URLs.
|
|
32
|
+ const tokens = txt.split(' ');
|
|
33
|
+
|
|
34
|
+ // Content is an array of text and emoji components
|
|
35
|
+ const content = [];
|
|
36
|
+
|
|
37
|
+ for (const token of tokens) {
|
|
38
|
+ if (token.includes('://')) {
|
|
39
|
+ // It contains a link, bypass the emojification.
|
|
40
|
+ content.push(token);
|
|
41
|
+ } else {
|
|
42
|
+ content.push(...toArray(token, { className: 'smiley' }));
|
|
43
|
+ }
|
|
44
|
+
|
|
45
|
+ content.push(' ');
|
|
46
|
+ }
|
31
|
47
|
|
32
|
48
|
content.forEach(i => {
|
33
|
|
- if (typeof i === 'string') {
|
|
49
|
+ if (typeof i === 'string' && i !== ' ') {
|
34
|
50
|
processedMessage.push(<Linkify key = { i }>{ i }</Linkify>);
|
35
|
51
|
} else {
|
36
|
52
|
processedMessage.push(i);
|