Migrating from TinyMCE or CKEditor
VEditor reads existing HTML, but not byte for byte: when an article is loaded, the editor normalizes it to its content model (the same rules as HtmlSanitizer), so anything outside the model is removed already in the editor view and is gone from the stored HTML after the next save. This chapter maps common settings.
Before you switch
- Run your existing content through
HtmlSanitizerin a test script and compare the result. Classes and inline styles that your theme relies on need astylesentry (see HTML sanitizer). - Decide where images come from: your file manager (
filePicker) and an upload endpoint (upload). See File manager and uploads. - Replace the editor script on one form, test, then roll out.
Settings
| TinyMCE | CKEditor 5 | VEditor | |
|---|---|---|---|
selector | ClassicEditor.create(element) | await VEditor.create(element or selector, options) | |
toolbar | toolbar | toolbar (array of names, `' | '` separator, see Editor options) |
plugins | plugins | plugins (DEFAULT_PLUGINS by default, all features) | |
language | language | language (36 languages, see Translations) | |
height, max_height | CSS | height, maxHeight | |
placeholder | placeholder | placeholder | |
readonly | isReadOnly | readOnly, setReadOnly() | |
content_css | CSS | veditor-content.css + your own CSS for .veditor-content | |
style_formats | style.definitions | styles: [{ name, element, classes }] | |
templates | Template plugin | templates: [{ title, description, html }] | |
file_picker_callback | CKBox / CKFinder | filePicker(callback, meta) | |
images_upload_handler | upload adapter | upload(file) or VEditor.createUploader() | |
license_key | licenseKey | licenseKey |
API
| TinyMCE | CKEditor 5 | VEditor |
|---|---|---|
editor.getContent() | editor.getData() | editor.getContent() |
editor.setContent(html) | editor.setData(html) | editor.setContent(html) |
editor.execCommand('Bold') | editor.execute('bold') | editor.execute('bold') |
editor.on('change', …) | editor.model.document.on('change:data', …) | editor.on('change', …) |
editor.remove() | editor.destroy() | editor.destroy() |
What changes in the HTML
b,i,strike,delbecomestrong,em,s;divbecomesp.- Images inserted in the editor are
figure.imagewidgets with an optionalfigcaption; in list items and table cells they stay inlineimg. An existing<p><img></p>is kept as it is. - Ids must start with
ve-; old anchors without the prefix are removed. Add the prefix in a migration script if you link to them. - Inline styles outside the whitelist (fonts, colours as
style) are removed. Text colours, highlights and sizes are classes (color-*,background-*,size-*). - Embedded players (
iframe) must be YouTube (useyoutube-nocookie.com) or Vimeo; video and audio files can stay as<video>and<audio>inside afigure.
Something unclear? Send feedback on the documentation.