Rapid

EditorJS block editor fieldtype for ProcessWire. Stores content as JSON, renders HTML server-side via pluggable block renderers.

EditorJS block editor fieldtype for ProcessWire. Stores content as JSON, renders HTML server-side via pluggable PHP block renderers.

Requirements


  • ProcessWire >= 3.0.200
  • PHP >= 8.2

Installation


  1. Copy the Rapid/ folder to site/modules/.
  2. In the admin go to Modules → Refresh → install Rapid.
    This automatically installs InputfieldRapid, ProcessFieldtypeRapid, ProcessRapid, and ProcessRapidFrontend.
  3. Add a field of type Rapid to any template.

No build step required — a pre-built js/dist/editor.js is included.

Template usage


// Render all blocks
echo $page->body;
echo $page->body->render();

// Restrict to specific block types
$r = new RapidRenderer(['allowedBlocks' => ['paragraph', 'header', 'image']]);
echo $page->body->renderWith($r);

// Single block by index
echo $page->body->renderBlock(0);

// Plain text — for meta descriptions, search indexing
$description = mb_substr($page->body->toText(), 0, 160);

// Raw JSON
$json = $page->body->toJSON();

// From a raw JSON string (static shortcut)
echo RapidRenderer::fromJSON($json, $page);

// Check if empty
if (!$page->body->isEmpty()) { ... }

Supported blocks


Block tools

TypeJS packageNotes
paragraphbuilt-inlarge variant supported
header@editorjs/headerh1–h6, auto-generates anchor ID
quote@editorjs/quoteCaption optional
nestedList@editorjs/nested-listOrdered + unordered, recursive
table@editorjs/tableOptional header row
code@editorjs/codeMonospace, scroll overflow
delimiter@editorjs/delimiter<hr>
warning@editorjs/warningTitle + message box
checklist@editorjs/checklistRead-only checkboxes on output
raw@editorjs/rawHTML pass-through
image@editorjs/imageUploads to page files directory, optional WebP + resize
attaches@editorjs/attachesFile download block
embedCustomYouTube + Vimeo via URL paste, youtube-nocookie.com
alerteditorjs-alert8 color variants
toggleeditorjs-toggle-blockSpoiler / accordion via <details>
linkTool@editorjs/linkLink preview with OG metadata

Inline tools

TypeJS package
inlineCode@editorjs/inline-code
marker@editorjs/marker
underline@editorjs/underline
boldbuilt-in
italicbuilt-in
linkbuilt-in

Plugins

PluginNotes
editorjs-drag-dropDrag blocks by settings handle
editorjs-undoCtrl+Z / Ctrl+Y

Field configuration


In Setup → Fields → your field → Details:

Editor behaviour

  • Allowed block types — restrict available blocks. Leave all unchecked to allow every type.
  • Min height (px) — minimum height of the editor area (default: 200).
  • Placeholder text — shown when editor is empty.
  • Editor alignmentLeft, Center, or Full width.
  • Toolbar positionLeft (default) or Right.
  • Autosave debounce (ms) — delay between typing and saving to the hidden textarea (default: 300).

Header block

  • Allowed heading levels — restrict which h-levels appear in the toolbar.
  • Default level — pre-selected level when inserting a new header.

File uploads

  • Max upload size (MB) — applies to images and file attachments.
  • Default image width / height (px) — resize all images on render via Pageimage::size(). 0 = no resize.
  • Image options — Convert to WebP, Crop to fit.
  • Allowed image types — JPEG, PNG, GIF, WebP, SVG. Leave all unchecked to allow all types.
  • Allowed file extensions — comma-separated list (e.g. pdf,doc,xlsx,zip). Leave empty to allow all.

Output / rendering

  • Enable frontend editing — render an inline Rapid editor on the frontend for authorized users.
  • Who can edit — permission required to use the frontend editor (default: page-edit).
  • CSS frameworkVanilla (rapid-*), Tailwind CSS, Bootstrap 5, or UIkit 3.
  • Output wrapper CSS class — added to the wrapping <div>. Useful for scoped CSS (e.g. prose).

Inline toolbar

  • Visible inline tools — restrict which inline tools appear in the text selection toolbar.

Frontend editing


Enable per-field in Output / rendering. Requires ProcessRapidFrontend module (auto-installed with Rapid).

$editor = $modules->get('ProcessRapidFrontend');

// Auto: editor for authorized users, plain HTML for others
echo $editor->renderField($page, 'body');

// Manual control
if ($editor->canEdit($page, 'body')) {
    echo $editor->editorFor($page, 'body');
} else {
    echo $page->body;
}
  • Save requests POST to /rapid-save/ (frontend URL hook — no admin URL needed).
  • Protected by HMAC nonce (no separate CSRF token required).
  • JS bundle and CSS are injected automatically on first editorFor() call.

CSS frameworks


// Output with Tailwind classes (set in field config, applied automatically)
echo $page->body;

// Override per render call
echo $page->body->render(['outputFramework' => 'bootstrap']);

Class mappings are defined in RapidFrameworks.php.

Frontend styles


Include rapid.css for default vanilla styling:

$config->styles->add($config->urls->FieldtypeRapid . 'rapid.css');

Custom block types


<?php namespace ProcessWire;

class RapidBlockMyType extends RapidBlockAbstract {
    public static function render(array $block, ?Page $page = null, ?Field $field = null): string {
        $text = htmlspecialchars(strip_tags($block['data']['text'] ?? ''));
        return "<div " . self::attr($block) . ">$text</div>";
    }
    public static function toText(array $block): string {
        return strip_tags($block['data']['text'] ?? '');
    }
}

Auto-discovered — no registration needed. Type key = lcfirst of the class suffix.

Upload endpoints


Mounted at /[admin]/setup/rapid-upload/:

RouteMethodDescription
upload/POSTImage upload
attach/POSTFile upload
link/?url=GETFetch OG metadata
save/POSTFrontend save (nonce-protected)

Building the JS bundle


cd site/modules/Rapid/js
npm install
node esbuild.mjs

Architecture


FileRole
FieldtypeRapid.module.phpFieldtype — DB schema, value lifecycle, field config UI
InputfieldRapid.module.phpInputfield — admin editor, asset loading
ProcessFieldtypeRapid.module.phpUpload/link/save endpoints
ProcessRapid.module.phpDashboard and block preview
ProcessRapidFrontend.module.phpFrontend editing helper + /rapid-save/ hook
RapidValue.phpValue object returned by $page->field
RapidRenderer.phpBlock dispatcher — iterates blocks, handles toggle nesting
RapidAttr.phpHTML attribute builder
RapidFrameworks.phpCSS class mappings for Tailwind, Bootstrap, UIkit
blocks/RapidBlockAbstract.phpBase class for block renderers
blocks/RapidBlocks.phpBuilt-in block renderers
js/editor.jsEditor source (ES modules)
js/dist/editor.jsPre-built IIFE bundle loaded in admin
js/editor.cssAdmin editor styles
rapid.cssFrontend styles for vanilla rendering

Author


Maxim Semenov — smnv.orgmaxim@smnv.org

More modules by Maxim Semenov

  • Context

    Export ProcessWire site context for AI development (JSON + TOON formats)
  • WireWall

    Advanced traffic firewall with VPN/Proxy/Tor detection, rate limiting, and JS challenge
  • LQRS URL Shortener Profile

    This site profile for ProcessWire offers a free and easy-to-use URL shortener that transforms long links into concise, shareable URLs. It is built using standard ProcessWire modules and field types.
  • Page Markdown

    Export any page to a clean Markdown file. Adds an export button to the page editor.
  • Media Platform Profile

    This site profile for ProcessWire offers a fully-featured media platform for hosting and managing video content with Backblaze B2 and Cloudflare integration.
  • Plausible Analytics

    Plausible Analytics dashboard using Stats API v2 with page-edit widget, traffic trends chart, and geo/device tabs.
  • AiWire

    AI integration for ProcessWire. Supports Anthropic, OpenAI, Google, xAI, and OpenRouter.
  • Rapid

    EditorJS block editor fieldtype for ProcessWire. Stores content as JSON, renders HTML server-side via pluggable block renderers.
  • Subscribe

    Newsletter subscription handler with lists, double opt-in, honeypot, rate limiting and unsubscribe link.

All modules by Maxim Semenov

Install and use modules at your own risk. Always have a site and database backup before installing new modules.