fix(math): enable cursor positioning after inline math equations#2616
Merged
caio-pizzol merged 4 commits intomainfrom Mar 28, 2026
Merged
Conversation
Two fixes: 1. renderer.ts: use minWidth/minHeight instead of fixed width/height on the sd-math wrapper so it auto-sizes to MathML content. The estimated dimensions caused overflow β clicks in the overflow area couldn't resolve to PM positions. 2. DomSelectionGeometry.ts: position caret at elRect.right (not left) when pos === pmEnd for non-text elements. This fixes cursor positioning after all atomic inline elements (math, images). SD-2402
Address review findings: - Use pos >= entry.pmEnd instead of === to handle gap/closest-entry fallback path where pos may exceed the entry's end - Add unit test verifying caret positions at right edge of non-text elements when pos matches pmEnd SD-2402
6 tests covering: - PM document contains mathInline/mathBlock nodes after import - DomPainter renders <math> MathML elements - Fraction renders as <mfrac> with correct numerator/denominator - Math wrapper spans have data-pm-start/end attributes - Text content preserved for unimplemented math objects - Document text labels render alongside math elements SD-2402
β¦oned-after-inline-math
Contributor
|
π This PR is included in vscode-ext v1.1.0-next.33 |
Contributor
|
π This PR is included in superdoc v1.24.0-next.32 The release is available on GitHub release |
Contributor
|
π This PR is included in superdoc-cli v0.5.0-next.32 The release is available on GitHub release |
Contributor
|
π This PR is included in superdoc-sdk v1.3.0-next.32 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Two fixes:
renderer.ts: use minWidth/minHeight instead of fixed width/height on the sd-math wrapper so it auto-sizes to MathML content. The estimated dimensions caused overflow β clicks in the overflow area couldn't resolve to PM positions.
DomSelectionGeometry.ts: position caret at elRect.right (not left) when pos === pmEnd for non-text elements. This fixes cursor positioning after all atomic inline elements (math, images).
SD-2402