Merge pull request #404 from mistydemeo/emoji
Display native emoji on browsers which support itmain
commit
c3c9879b5e
@ -1,9 +1,18 @@
|
||||
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) {
|
||||
return emojione.toImage(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);
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in new issue