mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
18 lines
464 B
JavaScript
18 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);
|
|
}
|
|
};
|