
- MODX 3
- PHP 8.2


How to enable mxEditorJs in MODX, use it in TVs, and output content on the site.
mxeditorjs).The plugin hooks OnDocFormPrerender and initializes when the content field (or richtext TV) appears.
Save via resource form (primary path):
renderPreviewHtml) to textarea and hidden fieldsmodResource.content / TVOnBeforeDocFormSave writes JSON to sidecarThe form does not call connector content/save. Use that for AJAX and custom integrations. Details: Flows.
which_editor = mxEditorJs, this TV uses the same block editor.TV content is stored in mxeditorjs_tv_content as Editor.js JSON. Frontend output uses generated HTML (same as main content).
After saving, main resource content exists in two forms:
modResource.content for the frontendIn the template:
[[*content]]{$_modx->resource.content}Editor.js TVs use TV placeholders (e.g. [[*my_richtext_tv]] or Fenom). HTML lands in the TV textarea on save. Frontend always receives ready HTML.
Convert existing HTML in the content field to Editor.js:
resource_id, optionally dry_run=1 (preview), then confirmed=1 to overwritedry_run the response includes preview (blocks) and blocks_count. On success — migrated, blocks_count, overwrittenAfter migration the manager shows the block editor. The site still outputs HTML from modResource.content, updated during migration.
Block set (paragraph, header, list, image, etc.) is defined by mxeditorjs.profile or mxeditorjs.enabled_tools. See System settings.
{resource_id})0 = no limit)<img> in the HTML snapshot — see System settingsGallery HTML is generated on save (client renderPreviewHtml or server HtmlRenderer on content/save). Markup:
<figure class="mxeditorjs-gallery mxeditorjs-gallery--fit"> — grid (Fit)<figure class="mxeditorjs-gallery mxeditorjs-gallery--slider"> — horizontal scroll (Slider)gallery-front.css loads only in the manager (form preview). The frontend does not load it automatically.
Add styles in template or theme:
<link rel="stylesheet" href="/assets/components/mxeditorjs/css/gallery-front.css">Or copy rules from assets/components/mxeditorjs/css/gallery-front.css into theme CSS.
Embed blocks output <div class="mxeditorjs-embed"><iframe ...></iframe></div>. RuTube and other @editorjs/embed services are configured in mxeditorjs.ts (services section), not via system settings. Custom services are added in source — see Architecture.