CKEditor 5 Rich Text Editor
CKEditor 5 is a modern, highly extensible rich text editor framework designed for building custom WYSIWYG editing experiences, with a strong emphasis on real-time collaborative editing. It is not a single product but a collection of features, plugins, and builds that can be combined. The current stable major version is v48.0.0, released in April 2026. However, v47.x is designated as the Long-term Support (LTS) edition for licensed customers, receiving security and compatibility fixes, while v48.x introduces new features and significant updates. CKEditor 5 is characterized by its MVC architecture, custom data model, and support for operational transformation (OT) to power real-time collaboration. It typically follows a regular release cadence for minor and patch versions, with major versions introducing significant architectural changes or deprecations, requiring users to stay updated with release notes. Its modular design allows developers to create highly customized editor instances tailored to specific application needs, ranging from simple document editors to complex collaborative writing environments.
Common errors
-
Editor failed to load: The license key is invalid or does not grant access to the requested product edition.
cause Attempting to use a CKEditor 5 Long-term Support (LTS) version without a valid LTS license key or an expired key.fixEnsure a valid CKEditor 5 LTS license key is provided in the editor configuration (`config.licenseKey`). Alternatively, if LTS is not required, use a non-LTS version of CKEditor 5. -
AWSTextAdapter cannot be used as the Amazon Bedrock integration has been removed.
cause Attempting to use the `AWSTextAdapter` class from the legacy AI Assistant plugin, which had its built-in Amazon Bedrock integration removed in v47.6.2.fixThis integration is deprecated and removed. If this specific integration is critical, revert to a version prior to v47.6.2, or migrate to the current CKEditor AI solution and its recommended adapters. -
TypeError: ClassicEditor is not a constructor (or) Module not found: Can't resolve '@ckeditor/ckeditor5-build-classic'
cause Incorrect import path or module resolution issues, often when mixing CommonJS `require` with ESM `import` or trying to import a build from the core `ckeditor5` package.fixEnsure you are using `import ClassicEditor from '@ckeditor/ckeditor5-build-classic';` and that your build tools (e.g., Webpack, Vite) are configured for ESM. For custom builds, import `ClassicEditor` from `@ckeditor/ckeditor5-editor-classic`. -
Uncaught TypeError: editor.create is not a function
cause Attempting to call `create` directly on the `ckeditor5` package instead of a specific editor build (e.g., `ClassicEditor`). The `ckeditor5` package is a meta-package and does not export `create` directly for instantiating editors.fixImport a specific editor build, such as `ClassicEditor` from `@ckeditor/ckeditor5-build-classic`, and then call `ClassicEditor.create(...)`.
Warnings
- breaking CKEditor 5 Long-term Support (LTS) Edition requires license verification. If your license key does not include LTS access, the editor will fail to load.
- breaking CKEditor 5 v48.0.0 completes the sunset of old installation methods, potentially breaking existing custom build workflows.
- breaking The `Export to PDF` converter API version has changed in v48.0.0.
- breaking The built-in Amazon Bedrock AI integration in the legacy AI Assistant plugin was removed. The `AWSTextAdapter` class now throws an error when used.
- breaking A Cross-Site Scripting (XSS) vulnerability (CVE-2026-28343) was discovered in the General HTML Support feature, which could lead to unauthorized JavaScript execution with unsafe configurations.
- gotcha Minor breaking changes to the CSS for the CKEditor AI integration in a sidebar mode (`config.ai.container`) were introduced.
Install
-
npm install ckeditor5 -
yarn add ckeditor5 -
pnpm add ckeditor5
Imports
- ClassicEditor
const ClassicEditor = require('ckeditor5');import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
- Paragraph
import { Paragraph } from 'ckeditor5';import Paragraph from '@ckeditor/ckeditor5-paragraph/src/paragraph';
- EditorConfig
import { EditorConfig } from 'ckeditor5';import type { EditorConfig } from '@ckeditor/ckeditor5-core';
Quickstart
import ClassicEditor from '@ckeditor/ckeditor5-build-classic';
import type { EditorConfig } from '@ckeditor/ckeditor5-core';
// This is a minimal example. In a real application, you might use a framework component.
// Ensure a div with id="editor" exists in your HTML.
// Example CKEditor 5 configuration
const editorConfiguration: EditorConfig = {
toolbar: [ 'heading', '|', 'bold', 'italic', 'link', 'bulletedList', 'numberedList', 'blockQuote', '|', 'undo', 'redo' ],
language: 'en',
// Example of a potentially sensitive configuration, though basic editor doesn't need it.
// For LTS versions or specific features (like AI), a license key might be required.
// process.env.CKEDITOR_LICENSE_KEY is illustrative.
licenseKey: process.env.CKEDITOR_LICENSE_KEY ?? '' // Example: For LTS or specific premium features
};
document.addEventListener('DOMContentLoaded', () => {
const editorElement = document.querySelector('#editor');
if (editorElement) {
ClassicEditor
.create( editorElement, editorConfiguration )
.then( editor => {
console.log( 'Editor was initialized', editor );
// Access editor data: editor.getData();
})
.catch( error => {
console.error( 'There was a problem initializing the editor.', error );
});
} else {
console.error('Editor target element #editor not found.');
}
});