This example shows how to create a simple plugin. See more about how to create plugins.
<!-- element -->
<textarea id="entry">...</textarea>
<!-- call -->
<script>
// plugin code
Redactor.add('plugin', 'myplugin', {
start() {
this.app.toolbar.add('mybutton', {
title: 'My Button',
icon: '<svg...>',
command: 'myplugin.toggle'
});
},
toggle(params, button) {
alert('Button Toggle');
}
});
let app = Redactor('#entry', {
plugins: ['myplugin']
});
</script>