summaryrefslogtreecommitdiffstats
path: root/webapp/utils/text_formatting.jsx
diff options
context:
space:
mode:
authorHarrison Healey <harrisonmhealey@gmail.com>2016-05-09 03:17:26 -0400
committerCorey Hulen <corey@hulen.com>2016-05-09 00:17:26 -0700
commit761f59645dfcb55f13570ba0b05cf22c5333b084 (patch)
tree0b4e800172f4960c2f52908e1db79d6b20cf2b21 /webapp/utils/text_formatting.jsx
parente8b3e0a7bc0e51df0532280f56d4fd9a97f138cc (diff)
downloadchat-761f59645dfcb55f13570ba0b05cf22c5333b084.tar.gz
chat-761f59645dfcb55f13570ba0b05cf22c5333b084.tar.bz2
chat-761f59645dfcb55f13570ba0b05cf22c5333b084.zip
PLT-2816 Fixed handling of Unicode 8 emojis (#2924)
* Updated twemoji to properly recognize Unicode 8.0 emojis * Updated unicode emoji parser to only render emojis we support as images * Corrected filename for South African flag emoji * Added Mattermost emoticons! * Added additional emoticons to test files
Diffstat (limited to 'webapp/utils/text_formatting.jsx')
-rw-r--r--webapp/utils/text_formatting.jsx16
1 files changed, 12 insertions, 4 deletions
diff --git a/webapp/utils/text_formatting.jsx b/webapp/utils/text_formatting.jsx
index cb61ecc8d..96b51d632 100644
--- a/webapp/utils/text_formatting.jsx
+++ b/webapp/utils/text_formatting.jsx
@@ -60,17 +60,25 @@ export function doFormatText(text, options) {
output = highlightCurrentMentions(output, tokens);
}
- // reinsert tokens with formatted versions of the important words and phrases
- output = replaceTokens(output, tokens);
-
if (!('emoticons' in options) || options.emoticon) {
output = twemoji.parse(output, {
className: 'emoticon',
base: '',
- folder: Constants.EMOJI_PATH
+ folder: Constants.EMOJI_PATH,
+ callback: (icon, twemojiOptions) => {
+ if (!Emoticons.getEmoticonsByCodePoint().has(icon)) {
+ // just leave the unicode characters and hope the browser can handle it
+ return null;
+ }
+
+ return ''.concat(twemojiOptions.base, twemojiOptions.size, '/', icon, twemojiOptions.ext);
+ }
});
}
+ // reinsert tokens with formatted versions of the important words and phrases
+ output = replaceTokens(output, tokens);
+
return output;
}