Here's an example of adding a button to the toolbar in four different ways.
<!-- element -->
<textarea id="entry">...</textarea>
<!-- call -->
<script>
Redactor.add('plugin', 'myplugin', {
start() {
// 1) default button
this.app.toolbar.add('quote');
// 2) custom button
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'],
// 3) add with setting
toolbar: {
add: {
line: true
}
},
// 4) change toolbar layout
buttons: {
toolbar: ['add', 'html', 'format', 'bold', 'italic', 'deleted', 'moreinline', 'list', 'link', 'image', 'table']
}
});
</script>