How to define your own shortcuts
In our demo versions we have some pre-defined shortcuts already implemented, but you can define them however you like.
In the following code you find the keybindings that are already in the keybindings.js
file:
createKeyBindingsConfig: function(editor) {
var inlineFormat = editor.getPlugin('inlineformat');
return [
"xeditor.default",
{
trigger: "Ctrl+B",
handler: inlineFormat.onTriggerFormat.bind(inlineFormat, "bold")
},
{
trigger: "Ctrl+I",
handler: inlineFormat.onTriggerFormat.bind(inlineFormat, "italic")
},
{
trigger: "Ctrl+U",
handler: inlineFormat.onTriggerFormat.bind(inlineFormat, "underline")
}
];
}
The example above triggers the inlineformat plugin and inserts an inline element at the cursor position, like italic, underline or bold.
You could add in here every logic you can think of. For example you could trigger the comment plugin and insert a comment at the current position. Or you could trigger a custom plugin. If you want to learn how to implement a custom plugin please see here.