Commit 0f00522
authored
fix(types): type contextMenu.customItems as ContextMenuSection[] (SD-2514) (#2777)
* fix(types): type contextMenu.customItems as ContextMenuSection[] (SD-2514)
contextMenu.customItems was typed as bare {Array} which resolved to any[]
in TypeScript. Define ContextMenuItem, ContextMenuSection, and
ContextMenuConfig typedefs with proper shapes derived from runtime usage
in the context menu component. Also types menuProvider callback signature.
* fix(types): widen context menu callback types to match runtime (SD-2514)
action receives (editor, context), not just (editor). Extract
ContextMenuContext typedef with the full runtime shape (isInTable,
documentMode, activeMarks, etc.) and use it across showWhen, render,
action, and menuProvider. Also simplify AugmentedChainedCommands to
reuse Chainified<KnownCommandRecord> instead of restating the mapped type.
* fix(types): allow menuProvider to return null/undefined (SD-2514)
Runtime falls back to original sections when menuProvider returns falsy
(menuProvider(...) || allSections), so the type should allow it.1 parent 2d93b10 commit 0f00522
File tree
4 files changed
+108
-11
lines changed- packages
- super-editor/src/editors/v1/core/types
- superdoc/src
- core/types
- tests/consumer-typecheck/src
4 files changed
+108
-11
lines changedLines changed: 3 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | | - | |
83 | | - | |
| 81 | + | |
84 | 82 | | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 83 | + | |
| 84 | + | |
89 | 85 | | |
90 | 86 | | |
91 | 87 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 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 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
89 | 146 | | |
90 | 147 | | |
91 | 148 | | |
| |||
469 | 526 | | |
470 | 527 | | |
471 | 528 | | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
| 529 | + | |
476 | 530 | | |
477 | 531 | | |
478 | 532 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
165 | 170 | | |
166 | 171 | | |
167 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
132 | 132 | | |
133 | 133 | | |
134 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
135 | 141 | | |
136 | 142 | | |
137 | 143 | | |
| |||
583 | 589 | | |
584 | 590 | | |
585 | 591 | | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
586 | 627 | | |
587 | 628 | | |
588 | 629 | | |
| |||
679 | 720 | | |
680 | 721 | | |
681 | 722 | | |
| 723 | + | |
682 | 724 | | |
683 | 725 | | |
684 | 726 | | |
| |||
0 commit comments