This repository has been archived on 2019-05-14. You can view files and clone it, but cannot push or open issues or pull requests.
mastodon/app/assets/javascripts/components/emoji.jsx
2017-01-04 22:47:51 -08:00

19 lines
464 B
JavaScript

import emojione from 'emojione';
import detectVersion from 'mojibaka';
emojione.imageType = 'png';
emojione.sprites = false;
emojione.imagePathPNG = '/emoji/';
let emoji_version = detectVersion();
export default function emojify(text) {
// Browser too old to support native emoji
if (emoji_version < 9.0) {
return emojione.toImage(text);
// Convert short codes into native emoji
} else {
return emojione.shortnameToUnicode(text);
}
};