You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
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 < 6.1) {
|
|
|
|
return emojione.toImage(text);
|
|
|
|
// Convert short codes into native emoji
|
|
|
|
} else {
|
|
|
|
return emojione.shortnameToUnicode(text);
|
|
|
|
}
|
|
|
|
};
|