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
Этот коммит содержится в:
Harrison Healey
2016-05-09 03:17:26 -04:00
коммит произвёл Corey Hulen
родитель e8b3e0a7bc
Коммит 761f59645d
9 изменённых файлов: 57 добавлений и 18 удалений

Просмотреть файл

@@ -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;
}