What is @ckeditor/ckeditor5-core?
@ckeditor/ckeditor5-core is a core package for CKEditor 5, a modern JavaScript rich text editor. It provides essential functionalities and utilities for building and customizing CKEditor 5 editors.
What are @ckeditor/ckeditor5-core's main functionalities?
Editor Creation
This feature allows you to create and initialize a CKEditor 5 instance. The code sample demonstrates how to create a classic editor and attach it to a DOM element.
const ClassicEditor = require('@ckeditor/ckeditor5-editor-classic/src/classiceditor');
const Editor = require('@ckeditor/ckeditor5-core/src/editor/editor');
ClassicEditor.create(document.querySelector('#editor'))
.then(editor => {
console.log('Editor was initialized', editor);
})
.catch(error => {
console.error(error.stack);
});
Plugin Management
This feature allows you to create and manage plugins for CKEditor 5. The code sample demonstrates how to create a custom plugin and include it in the editor configuration.
const Plugin = require('@ckeditor/ckeditor5-core/src/plugin');
class MyPlugin extends Plugin {
init() {
console.log('MyPlugin was initialized');
}
}
ClassicEditor.create(document.querySelector('#editor'), {
plugins: [ MyPlugin ]
})
.then(editor => {
console.log('Editor with MyPlugin was initialized', editor);
})
.catch(error => {
console.error(error.stack);
});
Command Management
This feature allows you to create and manage commands in CKEditor 5. The code sample demonstrates how to create a custom command and execute it within the editor.
const Command = require('@ckeditor/ckeditor5-core/src/command');
class MyCommand extends Command {
execute() {
console.log('MyCommand executed');
}
}
ClassicEditor.create(document.querySelector('#editor'))
.then(editor => {
editor.commands.add('myCommand', new MyCommand(editor));
editor.execute('myCommand');
})
.catch(error => {
console.error(error.stack);
});
Other packages similar to @ckeditor/ckeditor5-core
tinymce
TinyMCE is another popular rich text editor that provides a wide range of features and plugins. It is similar to CKEditor 5 in terms of functionality but has a different API and plugin system.
quill
Quill is a modern WYSIWYG editor built for compatibility and extensibility. It offers a simpler API compared to CKEditor 5 and is highly customizable through its modular architecture.
draft-js
Draft.js is a JavaScript rich text editor framework developed by Facebook. It provides a set of React components and an immutable model for managing editor state, making it different from CKEditor 5's approach.