Commit 9bcb0ad
committed
refactor(core): simplify the BlockInfo API and make it the single vocabulary for block/children plumbing
Combines the former block-info and blockinfo-consolidation changes into
one API-simplification pass over BlockInfo.
Field renames (drop internal jargon; PM group name strings unchanged):
- bnBlock -> block
- blockContent -> content
- childContainer -> children
- isWrappedBlock -> hasContent
Precomputed derived fields, replacing hand arithmetic at dozens of
callsites (blockContent.beforePos + 1, afterPos - 1, empty-inline
checks):
- contentStart / contentEnd
- children.childrenStart / children.childrenEnd
- contentKind: "inline" | "none" | "table" | "other"
- isContentEmpty
Producer consolidation: 6 overlapping producers -> 4, named by what you
have (getBlockInfoFromNode, getBlockInfoAt, getBlockInfoNearPos,
getBlockInfoFromSelection). getBlockInfo and
getBlockInfoFromResolvedPos are deleted; getBlockInfoWithManualOffset,
getBlockInfoAtNearest and getBottomNestedBlockInfo are renamed.
One shape resolver: getBlockRegions(node) -> { outer, content?,
childrenHolder? } resolves container vs blockContainer shape in one
place, consumed by getBlockInfoFromNode. Deleted the synonym
vocabularies that answered "where do children live" in parallel:
childrenHolder.ts, ChildrenWriteTarget, fixContainer's private repair
targets, and the descend seal-variant trio (now one self-recursive
descendToLastInsertionPos returning { pos, crossedSeal }).
Deleted helpers that were bare property reads: getChildrenConfig,
isContainerType, isPlaceableAnywhere, isInsertableChild; inlined
deleteBlockCollapsingSingletonGroup and the table-caret +-4 arithmetic.
Navigation helpers (getParentBlockInfo / getPrevBlockInfo /
getNextBlockInfo / getLastDescendantBlockInfo) move from mergeBlocks.ts
to getBlockInfoFromPos.ts and become public. getParentBlockInfo now has
block-model semantics: a block inside a column parents to the column,
not the columnList, fixing the Delete-at-end climb's seal check for
container children.1 parent 7ec114f commit 9bcb0ad
53 files changed
Lines changed: 1811 additions & 1020 deletions
File tree
- packages
- core/src
- api
- blockManipulation
- commands
- insertBlocks
- mergeBlocks
- moveBlocks
- nestBlock
- replaceBlocks
- splitBlock
- updateBlock
- containers
- getBlock
- selections
- clipboard/fromClipboard
- exporters/html/util
- nodeConversions
- blocks
- ListItem
- NumberedListItem
- utils
- editor
- managers/ExtensionManager
- exporter
- extensions/tiptap-extensions/KeyboardShortcuts
- pm-nodes
- schema
- blocks
- react/src/schema
- xl-ai/src
- api/formats/html-blocks
- prosemirror
- testUtil/cases
- xl-multi-column/src/extensions/DropCursor
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 22 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
51 | 52 | | |
52 | 53 | | |
53 | 54 | | |
54 | | - | |
| 55 | + | |
55 | 56 | | |
56 | | - | |
57 | | - | |
| 57 | + | |
| 58 | + | |
58 | 59 | | |
59 | 60 | | |
60 | 61 | | |
| |||
66 | 67 | | |
67 | 68 | | |
68 | 69 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
82 | 73 | | |
83 | 74 | | |
84 | 75 | | |
85 | | - | |
| 76 | + | |
86 | 77 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
91 | 84 | | |
92 | 85 | | |
93 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
94 | 91 | | |
95 | | - | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
96 | 95 | | |
97 | 96 | | |
98 | 97 | | |
| |||
Lines changed: 3 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
17 | | - | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
Lines changed: 20 additions & 133 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | 1 | | |
3 | 2 | | |
4 | | - | |
5 | 3 | | |
6 | 4 | | |
7 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
8 | 8 | | |
9 | 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 | | - | |
46 | | - | |
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 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | 10 | | |
120 | 11 | | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
126 | 17 | | |
127 | 18 | | |
128 | 19 | | |
| |||
133 | 24 | | |
134 | 25 | | |
135 | 26 | | |
136 | | - | |
| 27 | + | |
137 | 28 | | |
138 | | - | |
| 29 | + | |
139 | 30 | | |
140 | 31 | | |
141 | 32 | | |
142 | 33 | | |
143 | 34 | | |
144 | | - | |
| 35 | + | |
145 | 36 | | |
146 | | - | |
| 37 | + | |
147 | 38 | | |
148 | 39 | | |
149 | | - | |
| 40 | + | |
150 | 41 | | |
151 | 42 | | |
152 | 43 | | |
153 | 44 | | |
154 | | - | |
| 45 | + | |
155 | 46 | | |
156 | 47 | | |
157 | 48 | | |
| |||
160 | 51 | | |
161 | 52 | | |
162 | 53 | | |
163 | | - | |
| 54 | + | |
164 | 55 | | |
165 | | - | |
| 56 | + | |
166 | 57 | | |
167 | 58 | | |
168 | 59 | | |
| |||
172 | 63 | | |
173 | 64 | | |
174 | 65 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
| 66 | + | |
179 | 67 | | |
180 | 68 | | |
181 | 69 | | |
| |||
191 | 79 | | |
192 | 80 | | |
193 | 81 | | |
194 | | - | |
195 | | - | |
| 82 | + | |
196 | 83 | | |
197 | 84 | | |
198 | 85 | | |
199 | | - | |
| 86 | + | |
200 | 87 | | |
201 | 88 | | |
202 | 89 | | |
203 | 90 | | |
204 | 91 | | |
205 | 92 | | |
206 | | - | |
| 93 | + | |
207 | 94 | | |
208 | 95 | | |
209 | 96 | | |
| |||
Lines changed: 12 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| |||
223 | 223 | | |
224 | 224 | | |
225 | 225 | | |
226 | | - | |
| 226 | + | |
227 | 227 | | |
228 | 228 | | |
229 | 229 | | |
230 | | - | |
| 230 | + | |
231 | 231 | | |
232 | 232 | | |
233 | 233 | | |
| |||
347 | 347 | | |
348 | 348 | | |
349 | 349 | | |
350 | | - | |
| 350 | + | |
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
| |||
0 commit comments