Adds a toolbar button for inserting inline SVG icons from a configurable grid. Icons can be wrapped in a custom HTML element before insertion.
Click Icons in the toolbar and pick an icon from the grid. The icon HTML is inserted at the caret.
<script src="/assets/redactor/redactor.js"></script>
<script src="/assets/redactor/plugins/icons/icons.js"></script>
const app = Redactor('#entry', {
plugins: ['icons']
});
boolean)
truetrue, adds the button to the context toolbar as well.string)
string)
'<span class="icon icon-text"></span>'string[])
IconsPlugin.defaultOptions.items for the built-in set.Redactor('#entry', {
plugins: ['icons'],
icons: {
wrapper: '<span class="my-icon"></span>',
items: [
'<svg>...</svg>',
'<svg>...</svg>'
]
}
});
en: {
icons: {
icons: 'Icons'
}
}
This plugin does not emit events.
Inserts an icon at the caret and closes the dropdown.
Parameters:
icon (string) — SVG HTML to insert (after optional wrapping).app.icons.insert({ icon: '<svg>...</svg>' });