Commit f778c4a
SD-2447 - fix: tab stop computation and alignment for TOC styles (#2731)
* fix: toc not loading on paragraphs
* fix: tab stop computation and alignment for TOC styles
* fix: tests
* fix: don't decode every child twice
Co-authored-by: Caio Pizzol <97641911+caio-pizzol@users.noreply.github.com>
* fix: build
* refactor: removed unused code
* chore: small code tweaks
* chore: small code tweaks
* chore: removed unused code
* fix(layout-engine): tab-alignment parity, TOC schema invariant, regression tests
Follow-ups from PR review:
- measuring/dom: sync sequentialTabIndex with explicit tabIndex values (mirror remeasure.ts).
- Document getAlignmentStopForOrdinal as a Word-compat heuristic, not ECMA 17.3.3.32 behavior.
- tableOfContents encoder: normalize every non-paragraph child into its own paragraph
so the schema invariant (paragraph*) holds for mixed inline + paragraph input, not just
the all-inline case.
- Add regression tests: 3-tabs + 2-alignment-stops asymmetric case, mixed start+end stops
preserving legacy defaults-after-rightmost behavior, tightened TOC leader assertion.
* test(behavior): add TOC tab-alignment regression for SD-2447
Playwright spec that loads a TOC1 fixture and asserts leader endpoints align,
page numbers right-justify, and leader start positions vary with title length
(proving the first tab falls on the default grid, not the right stop).
Fixture is a Word-native 14KB DOCX with a right-aligned dot-leader tab stop
on TOC1 style — the same paragraph shape as the reported Keyper document.
---------
Co-authored-by: Gabriel Chittolina <gabrielchittolina1@gmail.com>
Co-authored-by: Caio Pizzol <97641911+caio-pizzol@users.noreply.github.com>
Co-authored-by: Caio Pizzol <caio@harbourshare.com>1 parent ff220a9 commit f778c4a
11 files changed
Lines changed: 381 additions & 51 deletions
File tree
- packages
- layout-engine
- contracts/src/engines
- layout-bridge
- src
- test
- measuring/dom/src
- pm-adapter/src
- super-editor/src/editors/v1/core/super-converter/v3/handlers/sd/tableOfContents
- tests/behavior/tests/formatting
- fixtures
Lines changed: 40 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
165 | 165 | | |
166 | | - | |
| 166 | + | |
167 | 167 | | |
168 | 168 | | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
169 | 207 | | |
170 | 208 | | |
171 | 209 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
129 | 129 | | |
130 | 130 | | |
131 | 131 | | |
132 | | - | |
133 | | - | |
134 | 132 | | |
135 | 133 | | |
| 134 | + | |
136 | 135 | | |
137 | 136 | | |
138 | | - | |
139 | | - | |
140 | | - | |
141 | | - | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
142 | 142 | | |
143 | | - | |
| 143 | + | |
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
781 | 782 | | |
782 | 783 | | |
783 | 784 | | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
784 | 812 | | |
785 | 813 | | |
786 | 814 | | |
| |||
797 | 825 | | |
798 | 826 | | |
799 | 827 | | |
800 | | - | |
| 828 | + | |
801 | 829 | | |
802 | 830 | | |
803 | | - | |
804 | | - | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
805 | 845 | | |
806 | 846 | | |
807 | 847 | | |
| |||
853 | 893 | | |
854 | 894 | | |
855 | 895 | | |
856 | | - | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
857 | 899 | | |
858 | 900 | | |
859 | 901 | | |
| |||
889 | 931 | | |
890 | 932 | | |
891 | 933 | | |
892 | | - | |
| 934 | + | |
| 935 | + | |
893 | 936 | | |
894 | 937 | | |
895 | 938 | | |
| |||
Lines changed: 21 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
445 | 445 | | |
446 | 446 | | |
447 | 447 | | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
448 | 469 | | |
449 | 470 | | |
450 | 471 | | |
| |||
481 | 502 | | |
482 | 503 | | |
483 | 504 | | |
484 | | - | |
485 | 505 | | |
486 | 506 | | |
487 | 507 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1619 | 1619 | | |
1620 | 1620 | | |
1621 | 1621 | | |
| 1622 | + | |
| 1623 | + | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
| 1627 | + | |
| 1628 | + | |
| 1629 | + | |
| 1630 | + | |
| 1631 | + | |
| 1632 | + | |
| 1633 | + | |
| 1634 | + | |
| 1635 | + | |
| 1636 | + | |
| 1637 | + | |
| 1638 | + | |
| 1639 | + | |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
| 1659 | + | |
| 1660 | + | |
| 1661 | + | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
| 1687 | + | |
| 1688 | + | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
1622 | 1693 | | |
1623 | 1694 | | |
1624 | 1695 | | |
| |||
0 commit comments