Commit 1a6fd03
fix: resolve GridColumn schema error when block types are restricted via Settings (#35035)
This PR fixes: #35032
## Root Cause
When the Block Editor's **Settings tab** is used to restrict which block
types are allowed, TipTap's `StarterKit` removes the disabled node types
from the schema entirely at initialization time.
The original `GridColumn` node had a **static content expression** that
referenced all possible node types:
```
(paragraph | heading | bulletList | orderedList | codeBlock | blockquote | table | horizontalRule | dotImage | dotVideo | dotContent)+
```
If any of those types were disabled (e.g. `blockquote`), StarterKit
would remove them from the schema, but `GridColumn.content` would still
reference them. TipTap throws a schema validation error on init, causing
the editor to render as a blank blue button instead of the full editing
surface.
## Fix
`GridColumn` is converted from a static export to a factory function
`createGridColumn(allowedBlocks)` that **dynamically builds the content
expression** based on the blocks actually registered in the schema. This
ensures `GridColumn` never references a node type that StarterKit has
removed.
`DotBlockEditorComponent` now calls
`createGridColumn(this.allowedBlocks)` at extension initialization time,
passing the active allowed list. The original `GridColumn` constant is
preserved as a default export (`createGridColumn()` with no args) to
avoid breaking other consumers.
## Changes
- `grid-column.node.ts` — converts static node to
`createGridColumn(allowedBlocks)` factory; adds
`buildGridColumnContent()` to derive the TipTap content expression from
the allowed list
- `dot-block-editor.component.ts` — replaces static `GridColumn` with
`createGridColumn(this.allowedBlocks)`
- `index.ts` — exports both `GridColumn` (backwards compat) and
`createGridColumn`
### Video
https://github.com/user-attachments/assets/61727785-0dcf-4824-bb89-64debfa9468b1 parent 7f82334 commit 1a6fd03
3 files changed
Lines changed: 74 additions & 23 deletions
File tree
- core-web/libs/block-editor/src/lib
- components/dot-block-editor
- nodes/grid-block
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | | - | |
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| |||
645 | 645 | | |
646 | 646 | | |
647 | 647 | | |
648 | | - | |
| 648 | + | |
649 | 649 | | |
650 | 650 | | |
651 | 651 | | |
| |||
Lines changed: 71 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | | - | |
20 | | - | |
21 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
22 | 46 | | |
23 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
0 commit comments