CKEditor 5 Classic Editor Build is a production-ready, feature-rich WYSIWYG text editor for web applications. It provides essential editing features including text formatting, block quotes, headings, lists, tables, links, images, and media embedding through a comprehensive plugin system with a classic toolbar interface.
npm install @ckeditor/ckeditor5-build-classicimport ClassicEditor from "@ckeditor/ckeditor5-build-classic";For CommonJS:
const ClassicEditor = require("@ckeditor/ckeditor5-build-classic");For browser usage via script tag:
<script src="./node_modules/@ckeditor/ckeditor5-build-classic/build/ckeditor.js"></script>
<!-- ClassicEditor is now available globally -->import ClassicEditor from "@ckeditor/ckeditor5-build-classic";
// Create editor instance
ClassicEditor
.create(document.querySelector("#editor"), {
toolbar: {
items: [
'undo', 'redo',
'|', 'heading',
'|', 'bold', 'italic',
'|', 'link', 'uploadImage', 'insertTable', 'blockQuote', 'mediaEmbed',
'|', 'bulletedList', 'numberedList', 'outdent', 'indent'
]
}
})
.then(editor => {
window.editor = editor;
// Set initial content
editor.setData('<p>Hello <strong>world</strong>!</p>');
// Get editor content
const content = editor.getData();
console.log(content);
})
.catch(error => {
console.error('Editor initialization failed:', error);
});CKEditor 5 Classic Editor Build is built around several key components:
Core editor creation, destruction, state management, event system, and observable properties for initializing and controlling the editor instance.
class ClassicEditor extends ClassicEditorBase {
static create(
sourceElementOrData: HTMLElement | string,
config?: EditorConfig
): Promise<ClassicEditor>;
destroy(): Promise<unknown>;
focus(): void;
readonly state: 'initializing' | 'ready' | 'destroyed';
readonly id: string;
readonly isReadOnly: boolean;
}Comprehensive data input/output operations for getting and setting editor content with support for various data formats.
interface DataController {
setData(data: string | Record<string, string>): void;
getData(options?: { rootName?: string }): string;
}Centralized command execution system providing access to all editor operations including formatting, structure, and content manipulation.
interface CommandCollection {
get<TName extends string>(commandName: TName): Command | undefined;
execute<TName extends string>(commandName: TName, ...commandParams: any[]): unknown;
}
interface Command {
readonly value: unknown;
readonly isEnabled: boolean;
execute(...args: any[]): void;
}Extensive configuration options for customizing editor behavior, toolbar setup, plugin selection, and feature-specific settings.
interface EditorConfig {
plugins?: Array<PluginConstructor>;
extraPlugins?: Array<PluginConstructor>;
removePlugins?: Array<string | PluginConstructor>;
toolbar?: ToolbarConfig;
initialData?: string;
language?: string | LanguageConfig;
licenseKey?: string;
updateSourceElementOnDestroy?: boolean;
}Modular plugin architecture with 25+ built-in plugins providing text formatting, block elements, media support, and advanced editing features.
interface PluginCollection<TEditor extends Editor> {
get<TPlugin extends PluginInterface>(
PluginClassOrName: PluginClassConstructor<TPlugin> | string
): TPlugin;
has(PluginClassOrName: PluginClassConstructor | string): boolean;
}Comprehensive UI system with toolbar, buttons, dropdowns, and other interface components for building custom editor interfaces.
interface ClassicEditorUI {
readonly element: HTMLElement;
readonly view: ClassicEditorUIView;
readonly focusTracker: FocusTracker;
readonly componentFactory: ComponentFactory;
}Access to core editor subsystems and properties for advanced integrations and custom functionality.
interface CoreProperties {
readonly accessibility: Accessibility;
readonly conversion: Conversion;
readonly editing: EditingController;
readonly keystrokes: EditingKeystrokeHandler;
readonly locale: Locale;
readonly t: LocaleTranslate;
}The Classic Editor Build includes these essential plugins:
Text Formatting: Bold, Italic, Autoformat, TextTransformation
Block Elements: Paragraph, Heading, BlockQuote, List, Indent
Media: Image (with Caption, Style, Toolbar, Upload), MediaEmbed, EasyImage, PictureEditing
Links & Tables: Link, Table (with TableToolbar)
File Management: CKBox, CKFinder, CKFinderUploadAdapter
Office Integration: PasteFromOffice
Core Features: Essentials, CloudServices
interface EventInfo<TName, TReturn> {
readonly name: TName;
readonly path: object[];
readonly source: object;
return: TReturn;
stop(): void;
off(): void;
}Common editor events:
'ready' - Fired when editor is initialized and ready'destroy' - Fired when editor is being destroyed'change:state' - Fired when editor state changes'change:isReadOnly' - Fired when read-only mode changesThe editor can throw errors during:
All async operations return Promises for proper error handling:
ClassicEditor.create(element, config)
.then(editor => {
// Success
})
.catch(error => {
console.error('Editor failed to initialize:', error);
});Supports all modern browsers including Chrome, Firefox, Safari, and Edge. Requires ES6+ support. No Internet Explorer support in this version.