Add portableText as a Block Kit field type for nested rich text in custom PT blocks
#1047
wojtekpiskorz
started this conversation in
Ideas
Replies: 1 comment
-
|
(I'lll gladly prepare a PR ofc :) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Plugin-declared Portable Text blocks currently support Block Kit form fields for editing (
text_input,select,toggle,media_picker,repeater, etc.). This covers structured data well — but there's no way to include rich text content inside a custom block.I propose adding a
portableTextBlock Kit field type that renders a full TipTap rich text editor inline within a custom PT block's editing form. This would unlock layout composition — blocks like "section with columns" where each column contains its own rich text content.Problem
Plugin-declared PT blocks only support scalar Block Kit fields (
text_input,select,toggle, etc.). Consider a typical custom block:The
bodyfield istext_inputwithmultiline: true— plain text, no formatting. Editors can't add links, bold, headings, or embed images inside a section's body. They get WYSIWYG in the main post content, but not inside custom blocks.This means we can't build compositional layouts like:
Proposed Solution
Add
portableTextas a Block Kit field type for PT block declarations:Data shape
The
portableTextfield stores its content as a Portable Text array (same format as the main post content):This is the same format EmDash already uses for
contentfields — no new serialization format needed.Admin editing
In the TipTap-based editor, when a user clicks into a PT block with
portableTextfields:portableTextfield as an inline TipTap sub-editorSite-side rendering
The Astro component receives the nested PT arrays and renders them with
<PortableText>:Why this approach (not full block-in-block nesting)
There are two ways to enable composition:
Approach A is the pragmatic first step. It covers the most common layout patterns (column sections, cards, accordions) with predictable structure. It's easier for editors to understand ("fill these columns") vs. free-form block composition.
Approach B could be a future enhancement — a
blocksfield type that accepts an array of any registered PT block type.Scope considerations
portableTextfields should support inserting PT blocks via slash commands, but with a configurable max depth (default: 1 level of nesting) to prevent infinite recursion in the editor.portableTextfields are unaffected. The data shape is additive.Beta Was this translation helpful? Give feedback.
All reactions