cms-admin: Allow restricting selectable heading levels in TipTap rich text block - #6223
Draft
VPS-Andreas wants to merge 3 commits into
Draft
cms-admin: Allow restricting selectable heading levels in TipTap rich text block#6223VPS-Andreas wants to merge 3 commits into
VPS-Andreas wants to merge 3 commits into
Conversation
Consumers previously had no way to restrict which heading levels (H1-H6) are selectable in the TipTap-based rich text editor, since the level choice depends on TipTap's own StarterKit/Heading defaults. The new headingLevels option lets a factory consumer (e.g. a Headline block) narrow this down generically instead of hard-coding it per block.
A typo such as [0, 2, 3] would otherwise reach TipTap's Heading extension unchecked and produce an invalid <h0> tag in TextBlockStyleHeadingView, since node.attrs.level is used directly to build the HTML tag name. Throw early instead when headingLevels is empty, contains duplicates, or contains a value outside 1-6.
VPS-Andreas
force-pushed
the
tiptap-heading-levels
branch
from
August 20, 2026 13:53
a1e213f to
07163ec
Compare
Mirrors the admin-side headingLevels option: restricts which heading levels the schema allows via the same TipTap Heading `levels` extension option, and rejects stored content with a disallowed heading level during validation (via IsTipTapContent and isValidTipTapContentSync), consistent with how maxTextBlocks and listLevelMax are already enforced server-side rather than trusting client-only validation.
nsams
reviewed
Aug 20, 2026
Member
|
Lgtm |
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
headingLevels?: number[]option tocreateTipTapRichTextBlockto restrict which heading levels (1-6) are selectable in the toolbar dropdown, markdown input rules, and keyboard shortcuts. Defaults to[1, 2, 3, 4, 5, 6], so existing usages are unaffected.headingLevelsat block-creation time (non-empty, unique integers 1-6) so a typo fails fast instead of producing an invalid heading tag at runtime.Needed for an upcoming Headline block migration to TipTap, which should only offer H2-H4 (no H1/H5/H6), matching the previous Draft.js implementation.
Test plan
pnpm run lint:fixpassestsc --noEmitpassesHeadingLevels(dropdown restricted to H2-H4, keyboard shortcut for a disallowed level is blocked, combined withtextBlockStylesto cover the code path the Headline block actually uses) andInvalidHeadingLevels(invalid configs throw)@dextinity/cms-admin, minor)Supersedes #6222, which was closed because its
feature/-prefixed branch is protected against direct pushes and couldn't take a follow-up commit.🤖 Generated with Claude Code