
mxEditorJs
Block editor Editor.js for MODX 3 — content in blocks instead of TinyMCE/CKEditor
- MODX 3
- PHP 8.2


Save and load diagrams. Editor guide: Editor guide.
mxEditorJs uses Canonical JSON + HTML snapshot:
modResource.content or TV textareaOnDocFormPrerender loads CSS/JS and fills window.mxEditorJsConfigMODx.loadRTE initializes Editor.js on #ta (main content) and on textarea.modx-richtext except #ta (TVs)content/get reads JSON from sidecarcontent/migrate, dry_run)The form writes HTML to the resource or TV, JSON to the sidecar. Connector content/save is not called.
syncToTextarea, 500 ms delay): renderPreviewHtml)mxeditorjs_json / mxeditorjs_tv_{id}_jsonhookBeforeSubmit flushes JSON to hidden fieldsOnBeforeDocFormSave → ContentRepository / TvContentRepository.save(JSON)content_version increments. Empty blocks: [] updates the sidecar (clearing the editor wipes JSON).Server HtmlRenderer is not called on this path. The client builds HTML in the textarea.
POST content/save + content_json:
ContentValidatorHtmlRenderer → HTMLmodResource.contentUse for AJAX or custom integrations. TVs do not update modResource.content via connector.
content/migrate?dry_run=1: block previewHtmlMigrator.convert() → sidecar + HtmlRenderer → modResource.contentforce, confirmed: overwrite existing sidecarSupported: p, h1–h6, ul/ol, blockquote, img, table, pre/code, hr. Not migrated: embed, gallery, attaches, checklist.
| Action | Connector | Settings |
|---|---|---|
| Image / gallery upload | media/upload | image_mediasource, image_upload_path |
| Attachment upload | media/uploadFile | file_mediasource, file_upload_path |
| Folder browse | media/browse | type=image or type=file |
OnResourceDelete removes rows in mxeditorjs_content and related mxeditorjs_tv_content.
| Event | Purpose |
|---|---|
OnRichTextEditorRegister | Register mxEditorJs in RTE list |
OnTVInputRenderList | Path to elements/tv/input/ (migxmxeditorjs handler) when mxeditorjs.enabled |
OnDocFormPrerender | Config, assets, init |
OnBeforeDocFormSave | Save JSON to sidecar |
OnResourceDelete | Clean sidecar |