Integration
How to enable mxEditorJs in MODX, use it in TVs, and output content on the site.
Enabling in the manager
- Settings → System settings → find which_editor → select mxEditorJs.
- Ensure mxeditorjs.enabled = Yes (namespace
mxeditorjs). - Open a resource — the content field shows the block editor.
The editor is loaded by a plugin on OnDocFormPrerender and initializes when the content field (or a richtext TV) appears. Saving is handled on resource form submit via the Connector API (content/save).
Using in Template Variables
- Create a TV of type Text (multiline) (textarea).
- In the TV settings, enable Use visual editor (richtext).
- With
which_editor= mxEditorJs, this TV will use the same block editor.
TV content is stored in the sidecar table mxeditorjs_tv_content in Editor.js format; on the frontend the generated HTML is used (same as for main content).
Output on the site
After saving with mxEditorJs, resource content (main content field) is stored in two forms:
- JSON — in the sidecar for the editor (loaded into Editor.js when the form is opened again).
- HTML — in
modResource.content(used for frontend output).
In the template, output content as usual:
[[*content]]{$_modx->resource.content}TVs that use Editor.js are output via TV placeholders (e.g. [[*my_richtext_tv]] or Fenom). JSON → HTML rendering is done by the component on save; the frontend always receives ready HTML.
HTML → Editor.js migration
If you already have resources with HTML in the content field, you can convert them to Editor.js format.
- Via Connector: action content/migrate with
resource_id, optionallydry_run=1(preview), thenconfirmed=1to overwrite. - With
dry_runthe response includespreview(blocks) andblocks_count; on success —migrated,blocks_count,overwritten.
After migration, opening the resource in the manager shows the block editor; the site still outputs HTML from modResource.content, updated during migration.
Profiles and tools
The set of blocks (paragraph, header, list, image, etc.) is defined by mxeditorjs.profile or mxeditorjs.enabled_tools. See System settings.
Media and presets
- Image and file uploads go to the Media Source from mxeditorjs.image_mediasource and mxeditorjs.file_mediasource.
- Upload path is set in mxeditorjs.image_upload_path (template with
{resource_id}). - CSS classes for images and links are set in presets (mxeditorjs.image_class_presets, mxeditorjs.link_class_presets, etc.) — see System settings.
Next steps
- API — connector endpoints, PHP classes, data formats
- System settings — all component parameters
