CKEditor how to add plugins
I added this code in gulp.config.js
...
ckeditorclassic: {
src: {
scripts: [
"{$config.path.node_modules}/@ckeditor/ckeditor5-build-classic/build/ckeditor.js",
"{$config.path.node_modules}/@ckeditor/ckeditor5-alignment/build/alignment.js"
]
},
dist: {
scripts: "{$config.dist}/plugins/custom/ckeditor/ckeditor-classic.bundle.js"
}
},
... This is the handler I made
const handleCKEDITOR = (selector) => {
ClassicEditor
.create(document.querySelector(selector), {
plugins: [Alignment],
toolbar: {
items: [
"heading",
"|",
"bold",
"italic",
"underline",
"strikethrough",
"|",
"alignment",
"|",
"numberedList",
"bulletedList",
"|",
"link",
"blockQuote",
"insertTable",
"imageUpload",
"mediaEmbed",
"|",
"undo",
"redo"
],
shouldNotGroupWhenFull: true
},
language: "en"
})
.then(editor => {
console.log("Editor was initialized", editor);
})
.catch(error => {
console.error(error.stack);
});
} It errors out : Uncaught ReferenceError: CKEditor5 is not defined
Replies (6)
Sorry for late reply, I've upgraded to v8.2.0 still getting the CKEditor5 with same configuration from previous snippet
We forgot to mentioned. After removing it, you need to rebuild the assets using gulp. Have you done it?
We will include the fix soon.
Thanks
Hi,
We are aware of the issue with CKEditor5 not being defined. We are currently working on a fix for this. In the meantime, as a workaround, you can remove the following part from your code:
Navigate to the /tools/gulp/helpers.js file in your project
.pipe(() => {
return gulpif(!jsSourcemaps, removeSourcemaps());
}) This workaround should resolve the issue. We apologize for any inconvenience this may have caused, and we appreciate your patience. If you have any further questions or need assistance, please let us know.
Thanks
Thanks for the reply,
Removing didn't help me so I switch to the downloadable CKEditor for the meantime and will wait for the update fix. Thanks once again cheers