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 UIElement and view.writer.clear method #3962

Closed
pjasiun opened this issue Jan 30, 2017 · 1 comment · Fixed by ckeditor/ckeditor5-engine#798
Closed

Introduce UIElement and view.writer.clear method #3962

pjasiun opened this issue Jan 30, 2017 · 1 comment · Fixed by ckeditor/ckeditor5-engine#798
Assignees
Labels
package:engine type:improvement This issue reports a possible enhancement of an existing feature.
Milestone

Comments

@pjasiun
Copy link

pjasiun commented Jan 30, 2017

My first thought was to introduce an UIElement: similar to the AttributeElement, but which does not need to have content to exists. It would be an element to represent something that does not have a models representation, can not have a selection inside, like drag handler or collapsed selection of other users.

Then I realized that the only difference between UIElement and EmptyElement it that one have a length in the model 0 and the other 1. But it's mapper job to handle it, and mapper does not distinguish element types, it's based only on mapping.

This is why we may try to use EmptyElement for the cases we wanted to use UIElement. For sure we should try because it would be far simpler.

What we need, in such case, is the method to remove all empty element from the given range. It could be called clear, first, but if the concept will work we would have to work on names (EmptyElement does not sound good too). Also, the question is: should such method handle Container and Attribute elements as well. I think we should start with something simple and if it will work we can improve it later.

So the first approach is to create the view.writer.clear method which will take the range and the element and removes all EmptyElements similar to the given element from the given range.

@pjasiun
Copy link
Author

pjasiun commented Jan 30, 2017

Writing the ticket about the view.range.enlarge (https://github.com/ckeditor/ckeditor5-engine/issues/789) I realized that we may need to distinguish semantic and visual elements, so the UIElement which from the view.writer perspective is very similar to the EmptyElement would be useful.

@pjasiun pjasiun changed the title Introduce view.writer.clear method Introduce UIElement and view.writer.clear method Jan 30, 2017
@oskarwrobel oskarwrobel self-assigned this Jan 30, 2017
Reinmar referenced this issue in ckeditor/ckeditor5-engine Feb 8, 2017
Feature: Introduced `view.UIElement` and `view.writer.clear()` method. Closes #788.

BREAKING CHANGES: Removed `view.DocumentFragment#getAncestors()`. Closes #803. Closes #805.
BREAKING CHANGES: `Position.getAncestors()` should return elements in the same order as `Node.getAncestors()`.
@mlewand mlewand transferred this issue from ckeditor/ckeditor5-engine Oct 9, 2019
@mlewand mlewand added this to the iteration 8 milestone Oct 9, 2019
@mlewand mlewand added module:view type:improvement This issue reports a possible enhancement of an existing feature. 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:improvement This issue reports a possible enhancement of an existing feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants