Add defaultStyle to a TipTap text block - #6384
Draft
VPS-Andreas wants to merge 3 commits into
Draft
VPS-Andreas wants to merge 3 commits into
VPS-Andreas wants to merge 3 commits into
Conversation
This was referenced Sep 16, 2026
VPS-Andreas
force-pushed
the
tiptap-text-block-default-style
branch
from
September 16, 2026 15:33
ab4807c to
021d328
Compare
VPS-Obi
added this pull request to stack #6386
September 17, 2026 06:23
VPS-Andreas
force-pushed
the
tiptap-text-block-default-style
branch
from
September 17, 2026 07:29
021d328 to
791d707
Compare
Contributor
|
We'll review this once #6383 has been merged. |
VPS-Obi
marked this pull request as draft
September 17, 2026 07:52
VPS-Andreas
force-pushed
the
tiptap-text-block-default-style
branch
2 times, most recently
from
September 17, 2026 08:36
3ac786e to
7695789
Compare
VPS-Andreas
force-pushed
the
tiptap-text-block-default-style
branch
from
September 17, 2026 09:08
7695789 to
709b81b
Compare
The styling select always offered a "Default" entry standing for "no style", even where a design has no unstyled variant. A text block with a defaultStyle drops that entry, so every paragraph or heading of that type carries one of its styles. The editor creates text blocks in several ways that don't go through the toolbar, so a ProseMirror plugin fills the style in for any node that has none, rather than reimplementing Enter, the keyboard shortcuts and paste one by one. It runs only on a document change, so opening older content leaves it untouched. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Toggling a list through the toolbar hands the cursor's paragraph from its text block to the list or back, so the styles of whichever now holds it apply. Mod-Shift-7 and Mod-Shift-8 went through the list extensions' own shortcuts and left the previous style in place, which the list may not offer at all. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
VPS-Andreas
force-pushed
the
tiptap-text-block-default-style
branch
from
September 17, 2026 09:26
709b81b to
07ba087
Compare
VPS-Andreas
marked this pull request as ready for review
September 17, 2026 10:00
VPS-Andreas
marked this pull request as draft
September 17, 2026 10:00
VPS-Obi
removed their request for review
September 17, 2026 10:02
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.
The styling select always offered a "Default" entry standing for "no style", even where a design has no unstyled variant and every paragraph or heading is meant to carry one of the configured styles. Editors had to pick the right style by hand on every new paragraph, and forgetting it produced unstyled content.
A text block (or list) with a
defaultStylehas no such state:The select drops its "Default" entry, and the style is applied to new content and to every paragraph or heading the editor creates without one — pressing Enter at the end of a heading, the
Mod-Alt-<level>shortcuts, pasting. Rather than reimplementing each of those paths, a ProseMirror plugin fills in a missing style on document change, so opening older content leaves it untouched and does not mark the document as changed. Switching the type keeps a style the new text block also offers and falls back to itsdefaultStyleotherwise, and toggling a list hands the paragraph to the list's styles or back — through the toolbar buttons andMod-Shift-7/Mod-Shift-8alike.Because the default sits on the text block rather than on a tag, two text blocks sharing a tag can have different defaults, and a text block without one keeps its "Default" entry next to text blocks that have one.
buildApplyTextBlocksMigrationgives existing content its style up front and replaces a style a text block no longer offers.Third of four stacked pull requests, on top of #6383 and #6382; #6385 splits the block's Storybook stories by topic.
Example
createTipTapRichTextBlock.test.ts/.test.tsxcover the validation and the migration. The Storybook story Default Text Block Style walks through a text block with a default, one without, and the styled lists.Session: https://claude.ai/code/session_f3c6ad37-c68b-4187-85b6-2abe5aa95c35