Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix Selection.getBounds() when starting range at end of text node #4010

Merged
merged 1 commit into from
Feb 13, 2024

Conversation

luin
Copy link
Member

@luin luin commented Feb 13, 2024

Cherry-picked from #3774.
Closes #3774

At the moment there's a bug when trying to get the bounds of a range
which starts at the end of a text node at the end of a line.

In this case, the returned bounds span the entire width of the editor,
which isn't the desired result.

This change fixes the issue by checking if the Quill range starts at the
end of a leaf. If it does, we try to define the range starting at the
beginning of the next leaf instead.

At the moment there's a bug when trying to get the bounds of a range
which starts at the end of a text node at the end of a line.

In this case, the returned bounds span the entire width of the editor,
which isn't the desired result.

This change fixes the issue by checking if the Quill range starts at the
end of a leaf. If it does, we try to define the range starting at the
beginning of the next leaf instead.
@luin luin merged commit 60660bd into main Feb 13, 2024
5 checks passed
@luin luin deleted the zh-selection-bounds branch February 13, 2024 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants