0.1.0-beta.1 • Published 6 years ago

zombiebox-extension-emoji v0.1.0-beta.1

Weekly downloads
-
License
MIT
Repository
-
Last release
6 years ago

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>'