Commit a66b16f
committed
fix: robust table row/col/table deletion and visible cell selection
Bypass prosemirror-tables' TableMap-based select-then-delete flow for
the table tooltip's row/column/table delete actions. The gfm preset
commands (selectRow/Col/TableCommand + deleteSelectedCellsCommand) rely
on TableMap consistency and silently no-op on ragged or otherwise
malformed tables, which left the tooltip's per-row and per-column
delete buttons unable to clean up such tables.
The new helpers operate directly on the document range of the row,
column cells, or table node — so they work regardless of TableMap
reported problems. Edge cases handled:
- Deleting the only row of a table deletes the table.
- A column delete that would empty a row drops the row instead.
- A column delete that would empty all rows deletes the table.
Also style prosemirror-tables' .selectedCell decoration so that
multi-cell selections (drag across cells) actually look selected; the
viewer was previously only showing the cursor cell's native text
selection, making range selections look like single-cell selections.
https://claude.ai/code/session_01YQpRGeviHUSZJ84cQJukFt1 parent 408cf8d commit a66b16f
2 files changed
Lines changed: 91 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | 10 | | |
15 | 11 | | |
16 | 12 | | |
| |||
35 | 31 | | |
36 | 32 | | |
37 | 33 | | |
38 | | - | |
| 34 | + | |
| 35 | + | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
42 | 39 | | |
43 | 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 | + | |
44 | 109 | | |
45 | 110 | | |
46 | 111 | | |
| |||
112 | 177 | | |
113 | 178 | | |
114 | 179 | | |
115 | | - | |
| 180 | + | |
116 | 181 | | |
117 | 182 | | |
118 | 183 | | |
| |||
148 | 213 | | |
149 | 214 | | |
150 | 215 | | |
151 | | - | |
152 | | - | |
| 216 | + | |
| 217 | + | |
153 | 218 | | |
154 | 219 | | |
155 | | - | |
156 | 220 | | |
157 | 221 | | |
158 | 222 | | |
| |||
168 | 232 | | |
169 | 233 | | |
170 | 234 | | |
171 | | - | |
172 | | - | |
| 235 | + | |
173 | 236 | | |
174 | 237 | | |
175 | | - | |
176 | | - | |
| 238 | + | |
177 | 239 | | |
178 | 240 | | |
179 | | - | |
180 | | - | |
| 241 | + | |
181 | 242 | | |
182 | 243 | | |
183 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
| 317 | + | |
317 | 318 | | |
318 | 319 | | |
319 | 320 | | |
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
323 | 324 | | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
324 | 339 | | |
325 | 340 | | |
326 | 341 | | |
| |||
0 commit comments