Hi keenthemes,
I followed the docto implement classic CKEditor,
I init all CKEditor necesseray files in my modal template:
<script type="text/javascript">
KTApp.createInstances();
KTMenu.createInstances();
</script>
<script src="assets/plugins/custom/ckeditor/ckeditor-classic.bundle.js"></script>
<script>
ClassicEditor
.create(document.querySelector('#kt_docs_ckeditor_classic'))
.then(editor => {
console.log(editor);
})
.catch(error => {
console.error(error);
});
</script>
on click to show the ajax modal, it will through an error :
>>>Uncaught ReferenceError: ClassicEditor is not defined
and there just a vanilla text area, not CKEditor on it
After the second click to show the same ajax modal, the textarea initialize and the CKEditir init on the textarea, wich is good, but it throw an error in console :
>>>Uncaught CKEditorError: ckeditor-duplicated-modules
Read more: https://ckeditor.com/docs/ckeditor5/latest/support/error-codes.html#error-ckeditor-duplicated-modules
Is initializing CKEditor different from regular MPA page (no ajax) ??, if so thank you for supplying the fix.
NB : Tried also : Quill, TinyMCE, samething ...
Thank you guys.
Hi,
Initializing CKEditor for Ajax would be similar as for classic pages as long as the CKEditor js/css files are loaded before the ajax call. Probably you can include it globally in advance. Otherwise during the ajax call need to handle the required CKEditor resources loading and only after that you will need to initialize the CKEditor instances.
Regards.
Thank you Sean,
after 1 day of hustling, I ended-up include it globally in advance.
Glad that it worked. Thanks for the update
Just to let you know,
I tried it in MPA way, a flat html page and it works great.
thank you