fix: paragraph styles apply to every block, not just the first
The document's content ended in an optional noteSection, so the content match after the first child offered noteSection as its defaultType — and that is what TipTap's clearNodes converts a block into. Every style command on a top-level block past the first threw "Invalid content for node type noteSection" and applied nothing. Spelling the same language as an alternation puts a paragraph first again.
This commit is contained in:
1 parent
dc1f5bb7b1
commit
8b1bef9706
2 files changed
+32
-1
No files matched your search
@@ -79,7 +79,12 @@ import { Insertion, Deletion, TrackChanges } from './extensions/trackChanges';
|
||||
export const extensions = [
|
||||
// textBox and columns have their own groups so only the document (not
|
||||
// cells/lists/boxes) admits them; the note section is last or nowhere.
|
||||
Document.extend({ content: '(block | textBox | columns)+ noteSection?' }),
|
||||
// Spelled as an alternation, not `… + noteSection?`: with the trailing optional the
|
||||
// match state after the first block offers noteSection first, and that is the type
|
||||
// TipTap's clearNodes converts a block into (`contentMatchAt(i).defaultType`).
|
||||
Document.extend({
|
||||
content: '((block | textBox | columns)+ noteSection) | (block | textBox | columns)+',
|
||||
}),
|
||||
Paragraph,
|
||||
Text,
|
||||
Bold,
|
||||
|
||||
Reference in new issue
Block a user