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

Field editorjs

Version: Free.

Why this type

Block content with headings, lists, embeds. Html ready for chunk, json for custom render. Structure safer than free-form 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

html
<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