fix(extension-table): update selection position when inserting a new … #5151
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.
…table
Typically when inserting a new table we want to select within the first cell of the newly inserted table. This change should ensure that occurs even if the original selection's head precedes the anchor.
fix #5143
Changes Overview
Using the selection's
from
instead ofanchor
is a better approach since the user may be making a selection where thehead
precedes theanchor
Implementation Approach
Changed the selection offset from
tr.selection.anchor + 1
totr.selection.from + 1
Testing Done
Made a selection from the end of the doc to the beginning, inserted a table and see that there is no error and that the selection is set to within the first cell.
Verification Steps
Additional Notes
Checklist
feat: Implement new feature
orchore(deps): Update dependencies
)Related Issues
#5143