Emoji

Adds a toolbar button and a : trigger for inserting emoji. The dropdown and command palette show grouped emoji grids (favorites, smileys, gestures, and more).

Click Emoji in the toolbar, or type : followed by a filter name to open the emoji palette.

Load the bundle

<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/emoji/emoji.js"></script>

Initialization

const app = Redactor('#entry', {
    plugins: ['emoji']
});

Options

  • context (boolean)
    • default true
    • When true, adds the button to the context toolbar as well.
  • trigger (string)
    • default ':'
    • Character that opens the emoji command palette while typing.
  • icon (string)
    • SVG icon HTML for the toolbar button.
  • items (object)
    • Grouped emoji map. Top-level keys are section names; each section maps keys to emoji characters. See EmojiPlugin.defaultOptions.items for the default set.
Redactor('#entry', {
    plugins: ['emoji'],
    emoji: {
        trigger: ':',
        items: {
            favorites: {
                thumbsUp: '👍',
                heart: '❤️',
                fire: '🔥'
            }
        }
    }
});

Language strings

en: {
    emoji: {
        emoji: 'Emoji',
        favorites: 'Favorites',
        smileys: 'Smileys',
        gestures: 'Gestures',
        animals: 'Animals',
        food: 'Food',
        activities: 'Activities',
        travel: 'Travel'
    }
}

Events

This plugin does not emit events.

API

insert

Inserts an emoji character at the caret and closes the dropdown.

Parameters:

  • value (string) — emoji character to insert.
app.emoji.insert({ value: '👍' });