Email mode, CSS allowlist, catalog filters, blocks provider injection.
Describes the removed Craft editor; kept for history.
Boot @pagehub/sdk as a narrowed editor: fewer components, fewer inspector tabs, fewer style options, an empty Blocks library. Useful when the output medium can't support the full surface — email builders, kiosk apps, embedded form designers, etc.
Where host-configuration.md covers additive config (extra fonts, extra device presets), this doc covers subtractive config — strip things out.
Email-mode in 15 lines. Restrict the toolbox to four components, hide the Blocks panel, allow only a handful of utility class prefixes:
That's a working email-safe editor. Everything below explains each knob and the niche ones.
Five mechanisms, used in combination:
Each section below explains one mechanism.
Restrict the toolbox to a named set of components. Inverse of features.restrictedComponents (which is a deny-list).
What it does: while rendering, the editor installs the list into the allowlist registry (define/hostConstraints.ts), then filters the toolbox allDefs list in editor.tsx. Unset or [] means no filter, and it clears whatever another editor set. Built-ins and host-supplied custom components run through the same name filter. The CraftJS resolver still receives every built-in so previously-saved nodes hydrate correctly — only the visible defs are trimmed.
When you'd reach for it: you want a small fixed surface and starting from a deny-list of 30 names is the wrong direction.
Readers in define/componentAllowlist.ts: getComponentAllowlist(), isComponentAllowed(name), savedComponentsAllowed(). registerComponentAllowlist / resetComponentAllowlist still exist for code that reads the registry without an editor (tests, tools), but a mounted editor overwrites them with its own features.componentAllowlist.
Heads up — server-side AI/MCP is separate. This registry is client-only. To restrict the components an AI agent or MCP call can emit, pass a per-request allowedTypes parameter to those surfaces. A module-level filter wouldn't work — those calls run server-side and multitenant. See utils/ai/schema-loader.ts and packages/mcp-core/src/component-registry.js.
Per-component predicate over a component's preset and modifier lists. Applied at read time inside getPresets(name) / getModifiers(name) from define/catalogRegistry.ts.
The predicate receives the real ComponentPreset / ComponentModifier object — inspect whatever fields you care about (label, name, classes, expands, category). There's no synthetic tags field.
When you'd reach for it: the component itself is fine, but some of its variant chips emit CSS the output medium can't render (animations in email, transforms in print export, etc.).
The editor installs features.catalogFilters while rendering and drops every filter set before, so one editor's filters never leak into the next. getCatalogFilter(name) reads the current predicate; registerCatalogFilter / resetCatalogFilter(name?) remain for code that reads presets without an editor (tests, tools).
The Blocks panel (toolbox "Blocks" tab) renders categories + searchable block templates. The SDK consults a registered BlocksProvider. Hosts ship whatever backing store they want: REST API, static JSON file, IndexedDB, in-memory fixture.
Each BlockItem.structure must be a CraftJS-shaped node map (the same shape editor.exportJSON() produces) — either as a JSON object or a JSON string the SDK will parse on drop.
Default behavior when no provider is registered: the SDK uses defaultHttpBlocksProvider, which fetches /api/v1/components/categories and /api/v1/components against the host origin. That's PageHub's own setup — its app gets the legacy behavior with zero registration.
Static JSON catalog:
Pair the provider with features.blocksPanel.enabled = true to actually show the panel — it's false by default so standalone consumers don't get a broken panel pointing at endpoints they don't host.
Helpers: resetBlocksProvider(), getBlocksProvider() (returns the default when nothing is registered).
Four flags on PageHubFeatures shape the constrained-editor surface. See the full flag table in host-configuration.md.
blocksPanelHides the Blocks tab in the toolbox (ToolboxTabs.tsx). URL state also collapses back to components when the tab disappears. Default is enabled: false — opt in for hosts that have a blocks provider (or use the default HTTP one).
Object-shaped (not a boolean) so future block-related settings can land here without another flag rename.
inspectorTabsPer-component allowlist of inspector tabs. Tab names: "component" | "layout" | "design" | "interactions" | "advanced". Omit a component and it keeps all tabs. Filters TABS in RegistrySettings.tsx.
cssAllowlistFilters className tokens and inline style properties at the chrome input boundary. A class survives if at least one regex matches; an inline style declaration survives if its property name is in properties (kebab-case). Installed via core/cssAllowlist.ts, enforced in propSystem.changeProp.
Programmatic writes via CraftJS setProp — template / block hydration, hydration from onLoad, etc. — bypass the filter intentionally. The allowlist gates human input, not stored data.
canvasWidthLocks the canvas to this width in px and hides the breakpoint switcher. Default null (the canvas follows the breakpoint / device controls). Read in Viewport.tsx and ViewportTopBar.tsx.
emailEditorConfig() wires every knob from one profile (EMAIL_PROFILE in
render/email/profile.ts) — the same profile
validateEmailTree and the email renderer read, so the editor only offers what
the renderer can emit:
The returned features hide AI generation, custom CSS, import/export, SEO, multi-page, the
404 page, the dark-mode switcher and the Blocks panel; trim the inspector tabs; set
cssAllowlist.classes to the email class allowlist (one sm: / md: / lg: prefix allowed);
and lock the canvas to 600px with canvasWidth. Spread your own flags over it to change any of
them.
Pass host email-only components in the argument: the allowlist filters component defs before the resolver is built, so an unlisted component can't be deserialized.
Before saving, run validateEmailTree(nodes, { extraComponents }) and show its issues — the
renderer throws on the same errors.
features.componentAllowlist and features.catalogFilters belong to the editor that renders with them. The editor writes them into the registries synchronously while it renders, before the toolbox or anything else reads them. So when one editor unmounts and another mounts (email editor → page editor), the new one's constraints are in force from its first render, whatever order the old one's cleanup runs in. No host cleanup is needed.
registerBlocksProvider and registerMediaUploadHandler are still imperative registries: call them BEFORE mounting <PageHubEditor> / PageHub.init so the first render sees them. After mount, changes to them don't trigger a re-render.
features.* flags ARE reactive through the SDK config context — updates to blocksPanel, inspectorTabs, and cssAllowlist pick up when the resolved config changes. componentAllowlist / catalogFilters re-apply when their reference changes, so build them once (e.g. useMemo) rather than inline on every render.
PageHubEditor component, different config payload.@pagehub/sdk/email-renderer).#viewport).PageHubFeatures flag table → host-configuration.mdregister* registries in one reference → extensibility.md