You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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
changed the title
Introduce view.writer.clear method
Introduce UIElement and view.writer.clear method
Jan 30, 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
transferred this issue from ckeditor/ckeditor5-engine
Oct 9, 2019
My first thought was to introduce an
UIElement
: similar to theAttributeElement
, 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
andEmptyElement
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 useUIElement
. 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 handleContainer
andAttribute
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 allEmptyElement
s similar to the given element from the given range.The text was updated successfully, but these errors were encountered: