Commit 4ded2ae
feat(superdoc): scrollToHeading walks forward to next text content for empty headings
scrollToHeading targets a position INSIDE the heading paragraph's
text content (not the doc-level boundary just before it) so the
presentation editor's layout-fragment index — which only spans
inside-text positions — has something to scroll to. The original
patch did this by walking the heading node's own descendants.
Refinement: when the heading itself carries no text content
(empty paragraph, or content limited to structural markers like
bookmarkStart / commentRangeStart), walk forward in the doc for
the next text-bearing position instead of returning false. That
way the viewport at least lands near where the empty heading
lives — useful in user-facing TOC clicks where the click target
is the empty heading entry the user intentionally selected.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 5e66227 commit 4ded2ae
1 file changed
Lines changed: 19 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1526 | 1526 | | |
1527 | 1527 | | |
1528 | 1528 | | |
| 1529 | + | |
1529 | 1530 | | |
1530 | | - | |
1531 | 1531 | | |
1532 | | - | |
| 1532 | + | |
1533 | 1533 | | |
1534 | 1534 | | |
1535 | 1535 | | |
1536 | | - | |
| 1536 | + | |
1537 | 1537 | | |
1538 | 1538 | | |
1539 | 1539 | | |
1540 | | - | |
1541 | 1540 | | |
| 1541 | + | |
| 1542 | + | |
| 1543 | + | |
| 1544 | + | |
| 1545 | + | |
| 1546 | + | |
| 1547 | + | |
| 1548 | + | |
| 1549 | + | |
| 1550 | + | |
| 1551 | + | |
| 1552 | + | |
| 1553 | + | |
| 1554 | + | |
| 1555 | + | |
| 1556 | + | |
1542 | 1557 | | |
1543 | 1558 | | |
1544 | 1559 | | |
| |||
0 commit comments