Given I have a ckeditor where a user could type rich text and insert many custom built widgets. One of the widgets represents HTML form where the textareas allows the user to write richtext too. Those textareas components integrate inline ckeditor as well. That ckeditor is configured with just a few plugins (font, bold, italic, lists, color) and is actually being nested in the outer one. The outer editor is configured with much more editor plugins. Now to the problem. When the user focuses the inner editor it's toolbar show up and can be used for text formatting, but in the same time, the outer editor's toolbar is visible as well, so the user could potentially try to apply formatting or insert widgets which are not applicable in the nested editor thus resulting in errors. So I wonder if there is a way to prevent nested editors to interfere with its ancestor ckeditor. Any thoughts on a different approach are appreciated as well.
0
votes
1 Answers
0
votes
I managed to do what I needed by making the parent editor readonly thus preventing using its toolbar when an inner editor is focused.
let parentEditorId = $(currentChildEditor).closest(parentEditor).attr('id');
if (parentEditorId) {
this.editor.on('focus', () => {
CKEDITOR.instances[parentEditorId].setReadOnly(true);
});
this.editor.on('blur', () => {
CKEDITOR.instances[parentEditorId].setReadOnly(false);
});
}
editor.on( 'elementsPathUpdate', function( evt ) {// Code to hide toolbars here})
will be useful to you... – José L.