Commit 1fcf864
feat(super-editor): timeoutMs option on scrollToPositionAsync
`scrollToPositionAsync` had a hard-coded 2 second timeout for
waiting on the painter to mount the target virtualised page.
Callers navigating long documents — where the painter may need
longer than 2 s to settle when jumping far from the current
viewport — had no way to extend it short of editing the static
`ANCHOR_NAV_TIMEOUT_MS` constant.
Adds an opt-in `timeoutMs` to the options bag. Backwards-
compatible: defaults stay at 2000 ms when unset. The warn message
now also includes the actual timeout that elapsed, which is
useful when diagnosing whether a particular long-doc click was
fighting the timeout or some other issue.
`SuperDoc.scrollToHeading` passes the option through to
`scrollToPositionAsync` when given, so external apps can extend
the wait at the call site without reaching into the presentation
editor directly:
await superdoc.scrollToHeading(2, 18, { timeoutMs: 8000 });
`scrollToElement` / `navigateTo` deliberately don't yet thread
the option — those traverse `#navigateToBlock` / `#navigateToComment` /
`#navigateToTrackedChange` before reaching `scrollToPositionAsync`,
which is a wider surface to touch. Can be added in a follow-up
once the call sites that need it surface.
Existing scrollToPosition test updated to match the new warn
message; a new test exercises the option (short timeout fires
faster than the default and the warn text includes the supplied
value). 86/86 SuperDoc.test.js + 14/14 scrollToPosition.test.ts
pass.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 4ded2ae commit 1fcf864
4 files changed
Lines changed: 125 additions & 7 deletions
File tree
- packages
- super-editor/src/editors/v1/core/presentation-editor
- tests
- superdoc/src/core
Lines changed: 22 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3712 | 3712 | | |
3713 | 3713 | | |
3714 | 3714 | | |
3715 | | - | |
| 3715 | + | |
| 3716 | + | |
| 3717 | + | |
| 3718 | + | |
| 3719 | + | |
| 3720 | + | |
| 3721 | + | |
| 3722 | + | |
| 3723 | + | |
| 3724 | + | |
| 3725 | + | |
| 3726 | + | |
| 3727 | + | |
| 3728 | + | |
3716 | 3729 | | |
3717 | 3730 | | |
3718 | 3731 | | |
| |||
3747 | 3760 | | |
3748 | 3761 | | |
3749 | 3762 | | |
3750 | | - | |
3751 | | - | |
3752 | | - | |
| 3763 | + | |
| 3764 | + | |
| 3765 | + | |
| 3766 | + | |
| 3767 | + | |
3753 | 3768 | | |
3754 | | - | |
| 3769 | + | |
| 3770 | + | |
| 3771 | + | |
3755 | 3772 | | |
3756 | 3773 | | |
3757 | 3774 | | |
| |||
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
667 | 667 | | |
668 | 668 | | |
669 | 669 | | |
670 | | - | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
671 | 698 | | |
672 | 699 | | |
673 | 700 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1477 | 1477 | | |
1478 | 1478 | | |
1479 | 1479 | | |
1480 | | - | |
| 1480 | + | |
| 1481 | + | |
| 1482 | + | |
| 1483 | + | |
| 1484 | + | |
1481 | 1485 | | |
1482 | 1486 | | |
1483 | 1487 | | |
| |||
1563 | 1567 | | |
1564 | 1568 | | |
1565 | 1569 | | |
| 1570 | + | |
| 1571 | + | |
| 1572 | + | |
1566 | 1573 | | |
1567 | 1574 | | |
1568 | 1575 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
518 | 518 | | |
519 | 519 | | |
520 | 520 | | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
521 | 588 | | |
522 | 589 | | |
523 | 590 | | |
| |||
0 commit comments