Add requireTextBlockStyle option to TipTap rich text block - #6225
Draft
VPS-Andreas wants to merge 3 commits into
Draft
Add requireTextBlockStyle option to TipTap rich text block#6225VPS-Andreas wants to merge 3 commits into
VPS-Andreas wants to merge 3 commits into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
textBlockStylesare configured oncreateTipTapRichTextBlock, 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.requireTextBlockStyleoption 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 ProseMirrorappendTransactionplugin so no path can leave a node unstyled. The API package rejects stored content missing a required style during validation, consistent with howmaxTextBlocks/listLevelMaxare already enforced server-side.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