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 #3774

Closed
wants to merge 2 commits into from

Conversation

alecgibson
Copy link
Contributor

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.

@alecgibson alecgibson closed this Jun 2, 2023
@alecgibson alecgibson deleted the bounds-eol branch June 2, 2023 10:24
@alecgibson alecgibson restored the bounds-eol branch June 2, 2023 10:25
@alecgibson
Copy link
Contributor Author

Sorry closed by accident

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
Copy link
Member

luin commented Feb 13, 2024

Works good 👍

@alecgibson alecgibson deleted the bounds-eol branch February 13, 2024 06:49
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