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

Introduce isBefore() and isAfter() to view and model nodes #4318

Closed
scofalik opened this issue Mar 16, 2018 · 0 comments · Fixed by ckeditor/ckeditor5-engine#1368
Closed
Assignees
Labels
package:engine type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone

Comments

@scofalik
Copy link
Contributor

Similarly to what we have in model.Position and view.Position, we could use model.Node#isBefore and view.Node#isBefore. Same for #isAfter. Of course, the methods would compare two nodes and tell if one is before the other one in the tree. If nodes are in different trees, the methods would return false (just like in positions).

This might be useful for example in sorting. Now we have to create positions before items and compare positions. It's not as much of hassle but is also prone to errors (if you'll try to create a position before detached element (root) it will throw).

@scofalik scofalik self-assigned this Mar 16, 2018
oskarwrobel referenced this issue in ckeditor/ckeditor5-engine Mar 21, 2018
Feature: Introduced `#isBefore` and `#isAfter` in `model.Node` and `view.Node`. Additionally, `model.Node#is` and `view.Node#is` and `view.Node#getPath` were added. Closes #1365.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 15 milestone Oct 9, 2019
@mlewand mlewand added module:model type:feature This issue reports a feature request (an idea for a new functionality or a missing option). package:engine labels Oct 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:engine type:feature This issue reports a feature request (an idea for a new functionality or a missing option).
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants