Skip to main content

Migration from CKEditor 4

CKEditor 4 has been one of the most widely used WYSIWYG HTML editors on the web since its launch in 2012, and many applications and CMSs still run it. It reached its end of life (EOL) on June 30, 2023, and its open-source edition is no longer maintained.

Editor42 is a maintained alternative: a WYSIWYG HTML editor under the MIT license, free for any project, with no license key and no account. It is a different editor, a fork of TinyMCE 6, so moving to it means porting your integration rather than replacing a file. The two editors are built the same way, though: a configuration object, a toolbar of named buttons, plugins, and an editing area that writes its HTML back into your form. Most of the work is translating names, and this guide has a table for each part.

CKEditor 4 end of life (EOL)​

CKEditor 4's makers announced its end of life in 2018, and it came on June 30, 2023 with 4.22.1, the last open-source release of CKEditor 4. Since then no open-source version of CKEditor 4 gets updates, security fixes included.

"This CKEditor 4.22.1 version is not secure"​

Since 4.22, CKEditor 4 asks its makers' server for the latest secure version when it starts. When a newer one exists, it says so in a notice inside the editor, in the browser console and in its About dialog:

This CKEditor 4.22.1 version is not secure. Consider upgrading to the latest one, 4.25.2-lts.

The latest one it names, 4.25.2-lts in November 2026, is a release of CKEditor 4 LTS. versionCheck: false in the configuration turns the check off: it removes the notice and leaves the editor at 4.22.1. Versions before 4.22 have no version check and show no notice.

Security updates after the end of life​

CKEditor 4's makers continue it as CKEditor 4 LTS ("Long Term Support"), a commercial edition with security updates and critical bug fixes until December 2029; its releases, 4.23.0-lts and later, need a license key. The other way forward is another editor, and the rest of this guide moves a CKEditor 4 integration to Editor42.

Step by Step​

Load Editor42​

Replace the CKEditor 4 script with Editor42's, from the CDN or from your own server:

- <script src="/ckeditor/ckeditor.js"></script>
+ <script src="https://cdn.editor42.com/editor42/latest/editor42.min.js"></script>

If your project installs packages with npm, the package is editor42.

Start the editor​

- CKEDITOR.replace('editor1');
+ editor42.init({ selector: '#editor1' });

CKEDITOR.replace() takes the id or the name of a textarea, while selector is a CSS selector: #editor1 or textarea[name=editor1]. For inline editing, CKEDITOR.inline() becomes inline: true on a div. Like CKEditor 4, Editor42 writes its content back into the textarea when the form is submitted, so your server receives the same field as before (form integration).

Translate the configuration​

Most CKEditor 4 options have an Editor42 counterpart under another name:

CKEditor 4Editor42Reference
toolbar, toolbarGroups, removeButtonstoolbar, and menubar for the menu above itToolbar
extraPlugins, removePluginsplugins: one list of the plugins to loadIntegration
extraPlugins: 'image2', captioned imagesimage_caption: trueImage
height, widthheight, width, which measure the whole editor, its toolbar and status bar includedEditor size
autoGrow_minHeight, autoGrow_maxHeightmin_height, max_height with the autoresize pluginAutoresize
languagelanguage, with language_url pointing to the language fileIntegration
contentsCss, bodyClass, bodyIdcontent_css, body_class, body_idAppearance
format_tags, stylesSetblock_formats, style_formatsFormatting
font_names, fontSize_sizesfont_family_formats, font_size_formatsFonts
colorButton_colorscolor_mapColors
enterMode: CKEDITOR.ENTER_DIVforced_root_block: 'div'Content behavior
enterMode: CKEDITOR.ENTER_BRnewline_behavior: 'linebreak'Content behavior
entities: falseentity_encoding: 'raw'Entity encoding
extraAllowedContent, disallowedContentextended_valid_elements, invalid_elementsContent filtering
allowedContent: trueextended_valid_elements, with the elements and attributes your content usesContent filtering
readOnly, startupFocusreadonly, auto_focusIntegration
contentsLangDirectiondirectionalityDirectionality
baseHrefdocument_base_urlURL handling
disableNativeSpellChecker: falsebrowser_spellcheck: true, the browser's own spellcheckerSpellcheck
filebrowserBrowseUrlfile_picker_callbackFiles and uploads
filebrowserUploadUrl, uploadUrl, imageUploadUrlimages_upload_urlFiles and uploads

Rebuild the toolbar​

CKEditor 4 lists its toolbar as groups of button names. Editor42 takes one string, with | between the groups, and a button that comes from a plugin needs that plugin in plugins:

- CKEDITOR.replace('editor1', {
- toolbar: [
- ['Format', 'Bold', 'Italic'],
- ['NumberedList', 'BulletedList', 'Link', 'Image'],
- ['Source']
- ]
- });
+ editor42.init({
+ selector: '#editor1',
+ plugins: 'lists link image code',
+ toolbar: 'blocks bold italic | numlist bullist link image | code',
+ menubar: false
+ });
CKEditor 4 buttonEditor42 buttonPlugin
Bold, Italic, Underline, Strikebold, italic, underline, strikethroughbuilt in
Subscript, Superscript, RemoveFormatsubscript, superscript, removeformatbuilt in
Format, Styles, Font, FontSizeblocks, styles, fontfamily, fontsizebuilt in
TextColor, BGColorforecolor, backcolorbuilt in
JustifyLeft, JustifyCenter, JustifyRight, JustifyBlockalignleft, aligncenter, alignright, alignjustifybuilt in
Outdent, Indent, Blockquoteoutdent, indent, blockquotebuilt in
Undo, Redoundo, redobuilt in
HorizontalRule, PasteText, Printhr, pastetext, printbuilt in
NumberedList, BulletedListnumlist, bullistlists
Link, Unlinklink, unlinklink
Anchoranchoranchor
Imageimageimage
Tabletabletable
Iframemediamedia
SpecialChar, Smileycharmap, emoticonscharmap, emoticons
Sourcecodecode
Maximize, ShowBlocks, Previewfullscreen, visualblocks, previewfullscreen, visualblocks, preview
Find, Replacesearchreplacesearchreplace
CodeSnippetcodesamplecodesample
BidiLtr, BidiRtlltr, rtldirectionality
PageBreak, Templatespagebreak, templatepagebreak, template

Every plugin has a page of its own under Plugins. Content pasted from Word arrives as HTML and goes through the same content filter as any other paste, with the options on Copy and paste; the pastetext button pastes plain text.

Files and uploads​

Browsing. CKEditor 4 opened your file browser at filebrowserBrowseUrl, and the browser handed the chosen file back with window.opener.CKEDITOR.tools.callFunction(). Editor42 calls your file_picker_callback instead: open the same file browser from it and pass the file's URL to the callback.

editor42.init({
selector: '#editor1',
file_picker_callback: (callback, value, meta) => {
// meta.filetype is file, image or media
window.onFilePicked = (url) => callback(url);
window.open('/browser/browse.php?type=' + meta.filetype, 'browser');
}
});

In the file browser, replace the call to window.opener.CKEDITOR.tools.callFunction(funcNum, url) with window.opener.onFilePicked(url).

Uploading. images_upload_url receives the images your authors paste, drop or upload in the image dialog (image upload). Your upload script changes in two places: Editor42 posts the image in the form field file, where CKEditor 4 used upload, and it reads the image's address from location in the answer:

// The answer CKEditor 4 reads
{ "uploaded": 1, "fileName": "cat.jpg", "url": "/uploads/cat.jpg" }

// The answer Editor42 reads
{ "location": "/uploads/cat.jpg" }

Other files are linked through your file browser, as above.

Framework components​

Each of the CKEditor 4 framework packages has an Editor42 counterpart. Your configuration moves from the config prop to init:

CKEditor 4Editor42
ckeditor4-react: <CKEditor initData config>@editor42/editor42-react: <Editor initialValue init>React
ckeditor4-vue: <ckeditor v-model :config>@editor42/editor42-vue: <Editor v-model :init>Vue
ckeditor4-angular: CKEditorModule, <ckeditor [config]>@editor42/editor42-angular: EditorComponent, <editor [init]>Angular
The jQuery adapter: $('textarea').ckeditor()@editor42/editor42-jquery: $('textarea').editor42()jQuery

Your existing content​

Editor42 opens the HTML that CKEditor 4 saved as it is, and like CKEditor 4's Advanced Content Filter, it keeps the elements and attributes its schema allows. This is what we saw when we opened content written by CKEditor 4 in Editor42 42.0.0:

  • Captioned images of CKEditor 4's Enhanced Image plugin, <figure class="image"> with a <figcaption>, are the markup Editor42's image plugin writes.
  • Colors, alignment and other inline styles are kept, and so are classes and data- attributes.
  • Code snippets, <pre><code class="language-…">, load unchanged. Code blocks made with Editor42's codesample plugin carry the language class on the <pre> instead.
  • Text with line breaks but no paragraphs, as enterMode: CKEDITOR.ENTER_BR saved it, gets a <p> around it when it opens.
  • An <iframe> from a host other than the common video and music sites (YouTube, Vimeo, Dailymotion, Spotify and a few more) gets an empty sandbox attribute, Editor42's protection against CVE-2024-29203 (security options).

To check your own content, open a sample of real documents in Editor42, save them without edits and compare how they look. The HTML itself differs in form only: Editor42 writes <img> where CKEditor 4 wrote <img />, and orders the attributes in its own way.

The code around the editor​

CKEditor 4Editor42
CKEDITOR.instances.editor1editor42.get('editor1')
editor.getData(), editor.setData(html)editor.getContent(), editor.setContent(html)
editor.insertHtml(html)editor.insertContent(html)
editor.updateElement()editor.save()
editor.checkDirty(), editor.resetDirty()editor.isDirty(), editor.setDirty(false)
editor.setReadOnly(true)editor.mode.set('readonly')
editor.destroy()editor.remove()
the instanceReady eventthe init event
the change eventchange, on each undo step, and input, on each keystroke

Editor42's events are subscribed to in setup, which runs before the editor starts:

editor42.init({
selector: '#editor1',
setup: (editor) => {
editor.on('init', () => {
// what ran on instanceReady
});
editor.on('change input', () => {
// what ran on change
});
}
});

The full API is in the Editor API and Events references.

Your own plugins​

A plugin written for CKEditor 4 is ported to the TinyMCE 6 plugin API that Editor42 runs. Its parts map one to one:

CKEditor 4Editor42
CKEDITOR.plugins.add('name', { init: (editor) => … })editor42.PluginManager.add('name', (editor, url) => …)
CKEDITOR.plugins.addExternal('name', '/path/')the external_plugins option
editor.addCommand('name', { exec: … })editor.addCommand('name', () => …)
editor.ui.addButton('Name', { label, command })editor.ui.registry.addButton('name', { text, icon, onAction })
CKEDITOR.dialog.add()editor.windowManager.open()

Buttons, menus and dialogs are on UI components.

Beyond this guide​

Editor42 runs TinyMCE 6's API, options and plugins, and sets window.tinymce as an alias of window.editor42, so code and answers written for TinyMCE 6 apply to it as well. What it renames, and why, is in Technical Details & Compatibility.