Skip to content

Add requireTextBlockStyle option to TipTap rich text block - #6225

Draft
VPS-Andreas wants to merge 3 commits into
mainfrom
tiptap-require-text-block-style
Draft

Add requireTextBlockStyle option to TipTap rich text block#6225
VPS-Andreas wants to merge 3 commits into
mainfrom
tiptap-require-text-block-style

Conversation

@VPS-Andreas

@VPS-Andreas VPS-Andreas commented Aug 21, 2026

Copy link
Copy Markdown

Summary

  • When textBlockStyles are configured on createTipTapRichTextBlock, the toolbar's style dropdown always offered an unstyled "Default" entry alongside the configured styles, even for setups where every heading/paragraph should always carry one of them.
  • Add a requireTextBlockStyle option that removes that entry for text block types with at least one applicable style. The editor auto-assigns the first applicable style wherever one would otherwise be missing (toolbar changes, markdown input rules, keyboard shortcuts, pasted content), via a ProseMirror appendTransaction plugin so no path can leave a node unstyled. The API package rejects stored content missing a required style during validation, consistent with how maxTextBlocks/listLevelMax are already enforced server-side.
  • Enabled the option on the demo's general-purpose rich text block as a usage example (not just a heading-only case).

Prompted by PHSB2C-13678: the TipTap-based Headline block always showed a "Default" style state that didn't exist in the previous Draft.js implementation.

🤖 Generated with Claude Code

Mirrors the admin-side requireTextBlockStyle option: rejects stored
content where a heading or paragraph has an applicable textBlockStyles
entry but none set, consistent with how maxTextBlocks and listLevelMax
are already enforced server-side rather than trusting client-only
validation.
Consumers configuring textBlockStyles previously always got an
unstyled "Default" entry in the toolbar's style dropdown alongside
the configured styles, even when every heading/paragraph should
always have one of them. The new requireTextBlockStyle option removes
that entry and auto-assigns the first applicable style wherever one
would otherwise be missing (toolbar changes, markdown input rules,
keyboard shortcuts, pasted content), via a ProseMirror
appendTransaction plugin so no path can leave a node unstyled.
Shows the option applied to the general-purpose rich text block, not
just a heading-only use case.
@VPS-Andreas VPS-Andreas self-assigned this Aug 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant