zombiebox-extension-emoji

0.1.0-beta.1 • Public • Published

zombiebox-extension-emoji

ZombieBox extension for emojis support.

About

This extension detects emojis in a text using the regex provided by emoji-regex, that based on data from Unicode Technical Report #51.

George Douros' free font Symbola is used to display detected emojis in a black-and-white presentation.

Usage

goog.require('zb.emoji.emojify');
 
zb.emoji.emojify('Text and 😀'); // Output: 'Text and <span class="zb-emoji">😀</span>'

You can define emojis that you don't want to display by specifying emoji.blacklist in project config. Note, that a value should be sequence of escaped UTF-16 code units:

{
    emoji: {
        blacklist: [
            '\\ud83d\\udd95' // Confused face emoji
        ]
    }
}

By default a blacklisted emoji will be replaced by "•", but you can customize it:

zb.emoji.emojify('😕'); // Output: '<span class="zb-emoji">•</span>'
zb.emoji.emojify('😕', {stub: '😀'}); // Output: '<span class="zb-emoji">😀</span>'

Also, you can replace all emojis in a text:

zb.emoji.emojify('😀😕', {shouldOnlyStub: true}); // Output: '<span class="zb-emoji">•</span><span class="zb-emoji">•</span>'

Package Sidebar

Install

npm i zombiebox-extension-emoji

Weekly Downloads

0

Version

0.1.0-beta.1

License

MIT

Unpacked Size

2.45 MB

Total Files

8

Last publish

Collaborators

  • reefridge
  • lacki
  • kirilldronkin