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

Provide a static Rect#getDomRangeRects method for external usage #4963

Closed
oleq opened this issue Jul 3, 2017 · 1 comment · Fixed by ckeditor/ckeditor5-utils#172
Closed
Assignees
Labels
package:utils type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@oleq
Copy link
Member

oleq commented Jul 3, 2017

ATM there's no way to obtain all DOM Range rects e.g. when the range spans multiple lines of text using the Rect class. While it's possible to iterate over the list returned by domRange.getClientRects() and create a new Rect instance from each rect, such approach does not cover very specific cases which are already handled by the Rect helper class e.g. when there's no rect (Safari) etc..

So to use the smart logic of the Rect class and avoid code duplication, a static method is required. The very first use case is in https://github.com/ckeditor/ckeditor5-ui/issues/263, where depending on the direction of the seleciton, a proper DOM Range rect must be returned (either the first or the last one). Without the smart Rect logic, ContextualToolbar fails to show when the selection is collapsed in Safari and in other edge cases.

@oleq oleq self-assigned this Jul 3, 2017
@oleq
Copy link
Member Author

oleq commented Jul 3, 2017

Current implementation in https://github.com/ckeditor/ckeditor5-utils/tree/t/168.

oleq referenced this issue in ckeditor/ckeditor5-utils Jul 7, 2017
Reinmar referenced this issue in ckeditor/ckeditor5-utils Jul 7, 2017
Feature: Introduced a static `Rect#getDomRangeRects` method for external usage. Closes #168.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-utils Oct 9, 2019
@mlewand mlewand added this to the iteration 11 milestone Oct 9, 2019
@mlewand mlewand added status:confirmed type:improvement This issue reports a possible enhancement of an existing feature. package:utils labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:utils type:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants