Skip to content
  1. Extras
  2. PageBuilder
  3. Field types
  4. Pro
  5. editorjs

Field editorjs

Version: Pro (advanced-fields). A new field is created only in Pro. An already saved field still opens and writes.

Why this type

Text made of blocks: headings, lists, and embeds. The chunk can print ready HTML (html), or JSON (json) if you build the markup yourself. The block list is more predictable than free HTML.

When to use

  • Long article or block-based landing
  • Content parsed from json later
  • richtext alternative for block-first UX

Tips

Chunk usually {$body.html}, not raw json. Simple HTML without blocks is faster in richtext.

Similar types

  • richtext for classic WYSIWYG HTML
  • ace when a developer owns markup

Schema

json
{
  "name": "body",
  "type": "editorjs",
  "label": "Content",
  "tab": "Content",
  "width": 100,
  "active": true
}

Value

Object { json, html }; on the frontend use html.

Section data

Key body in the section data:

json
{
  "body": {
    "json": {
      "time": 1710000000000,
      "blocks": [
        {
          "type": "paragraph",
          "data": {
            "text": "Block text"
          }
        }
      ],
      "version": "2.29.0"
    },
    "html": "<p>Block text</p>"
  }
}
  • In a chunk use html; json is raw Editor.js.

Chunk example

modx
<div class="pb-richtext__content">[[+body.html]]</div>
fenom
<div class="pb-richtext__content">{$body.html}</div>

Common properties

For fields with name that are stored in the section data:

KeyTypeRoleCMP
tabstringGroup subtitle in the inspectoryes
width25–100Field width as % of the row (flex)yes
descriptionstringHint under the labelyes
defaultanyInitial value for a new sectionyes
activeboolfalse hides the field in the inspectoryes
requiredboolRequired on publish (draft still saves)yes
  • Also: data holds { json, html }; in a chunk use {$field.html}.

See fields overview.

See also