How to use the emojilib/emojis.json function in emojilib

To help you get started, we’ve selected a few emojilib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github phpdish / phpdish / assets / modules / md-editor / emoji-plugin.js View on Github external
const emoji = function() {

    _.each(emojis, (emoji, name) => {
        emoji.keywords.unshift(name);
    });

    this.textComplete.register([
        {
            id: 'emoji',
            match: /(^|\s)[::]([a-z0-9+\-\_]*)$/,
            search: function (term, callback) {
                const emojiNames = [];
                 _.forEach(emojis, (emoji, name)=> {
                    if (emoji.keywords.join(' ').toLowerCase().indexOf(term.toLowerCase()) > -1) {
                        emojiNames.push(name);
                    }
                });
                callback(emojiNames);
            },