I have hidden my toolbar already but I want to prevent every type of shortcuts that allows formatting, e.g., `ctrl+b` to bold, `ctrl+r` to align on right. I need a configuration that disable everything, because the HTML content will be added from outside by `executeCommand` method.
Also, I want to submit my text when the user press `enter` and let the breaking lines with `shift+key`, but I can't find on documentation anything that allows me to do that. Is it possible?
One more problem: I have a emojipicker to insert content to editor but when I and chosing my emoji, the editor loses the focus, so the `insertHtml` command of `executeCommand`, inserts the emoji on the begining, not where the user had the cursor.
|
var defaultRTE = new ej.richtexteditor.RichTextEditor({
created: onCreate
});
function onCreate() {
this.keyboardModule.keyConfigs = '';
var editarea = document.querySelector('.e-richtexteditor .e-content');
editarea.addEventListener('keydown', docKeyDown); //Bind keydown event
}
// KeyDown event handler
function docKeyDown(e) {
if (e.ctrlKey == true || e.keyCode == 13) {
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
}
} |
|
// KeyDown event handler
function docKeyDown(e) {
if (e.keyCode == 13) {
// You can perform form submit action here
}
} |
|
function onCreate() {
customBtn.onclick = function (e) {
range = selection.getRange(document);
saveSelection = selection.save(range, document);
};
}
function onInsert() {
saveSelection.restore();
defaultRTE.executeCommand('insertText', activeEle.textContent);
defaultRTE.formatter.saveData();
} |