Editor
Leylim have customizable editor, you can filter buttons, add or customize that editor.
Full example
new Leylim({
//
customEditorButtons: {
merge: true,
filter(buttons) {
return buttons;
// Should return Array<Button>
},
buttons:
[
{
command: 'bold',
icon: 'fa fa-bold',
},
{
command: 'my-command',
icon: 'fa fa-my-command',
handler(selection) {
// My command handler
}
}
]
}
//
});
Without Handler helper
Adding a editor button without handler
new Leylim({
//....
customEditorButtons: {
buttons: [
{
command: 'bold',
icon: 'fa fa-bold',
}
]
},
//....
});
This buttons shown list right of screen, when user click this button, selected text will be wrapping <b>
tag. See Command List
With Handler helper
Some cases, you want to handle click event independent leylim core. In this case you can use handler
helper;
new Leylim({
//....
customEditorButtons: {
buttons: [
{
command: 'bold',
icon: 'fa fa-bold',
handler(selection) {
// Do this
}
}
]
}
//....
});
Filter
new Leylim({
//....
customEditorButtons: [
filter(buttons) {
// Filter then return
return buttons;
}
]
//....
});
Merge
new Leylim({
//....
customEditorButtons: [
merge: false,
buttons: [
// Your buttons
]
]
//....
});