Contents

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

  1. Run your existing content through HtmlSanitizer in a test script and compare the result. Classes and inline styles that your theme relies on need a styles entry (see HTML sanitizer).
  2. Decide where images come from: your file manager (filePicker) and an upload endpoint (upload). See File manager and uploads.
  3. Replace the editor script on one form, test, then roll out.

Settings

TinyMCECKEditor 5VEditor
selectorClassicEditor.create(element)await VEditor.create(element or selector, options)
toolbartoolbartoolbar (array of names, `''` separator, see Editor options)
pluginspluginsplugins (DEFAULT_PLUGINS by default, all features)
languagelanguagelanguage (36 languages, see Translations)
height, max_heightCSSheight, maxHeight
placeholderplaceholderplaceholder
readonlyisReadOnlyreadOnly, setReadOnly()
content_cssCSSveditor-content.css + your own CSS for .veditor-content
style_formatsstyle.definitionsstyles: [{ name, element, classes }]
templatesTemplate plugintemplates: [{ title, description, html }]
file_picker_callbackCKBox / CKFinderfilePicker(callback, meta)
images_upload_handlerupload adapterupload(file) or VEditor.createUploader()
license_keylicenseKeylicenseKey

API

TinyMCECKEditor 5VEditor
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, del become strong, em, s; div becomes p.
  • Images inserted in the editor are figure.image widgets with an optional figcaption; in list items and table cells they stay inline img. 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 (use youtube-nocookie.com) or Vimeo; video and audio files can stay as <video> and <audio> inside a figure.

Something unclear? Send feedback on the documentation.