Special Characters

Adds a toolbar button for inserting special characters and HTML entities from a configurable grid.

Click Special Characters in the toolbar and pick a character from the grid. The character is inserted at the caret.

Load the bundle

<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/special-chars/special-chars.js"></script>

Initialization

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

Options

  • context (boolean)
    • default true
    • When true, adds the button to the context toolbar as well.
  • icon (string)
    • SVG icon HTML for the toolbar button.
  • items (string[])
    • Characters or HTML entities shown in the dropdown grid. See SpecialCharsPlugin.defaultOptions.items for the built-in set.
Redactor('#entry', {
    plugins: ['specialChars'],
    specialChars: {
        items: ['&copy;', '&reg;', '&trade;', '&mdash;', '&bull;', '&rarr;']
    }
});

Language strings

en: {
    specialChars: {
        'special-chars': 'Special Characters'
    }
}

Events

This plugin does not emit events.

API

insert

Inserts a special character at the caret and closes the dropdown.

Parameters:

  • character (string) — HTML entity or character string to insert.
app.specialChars.insert({ character: '&copy;' });