Introduce an elementToStructure and rangeToStructure downcast helpers with slots for reconversion #10054
Labels
domain:dx
This issue reports a developer experience problem or possible improvement.
package:engine
type:feature
This issue reports a feature request (an idea for a new functionality or a missing option).
Milestone
📝 Provide a description of the new feature
This is a follow-up to #9783.
The big picture of the new downcast helpers stays the same as in the above issue.
In the previous issue we were trying to PoC the solution:
DowncastDispatcher
toDowncastHelpers
and a more streamlined approach to bringing back (reuse) old view elements was introduced with the slots that are placeholders that could indicate where the child view elements should land in the final view structuretriggerBy
was updated to be a facade for the more flexible callbacksrangeToStructure
that proved to be difficult to describe thetriggerBy
to detect changes and find a proper range.The most difficult part was to handle the range reconversion - it was simple for simple cases like adding elements, changing attributes, or promoting some element to become a part of the ranged conversion, but for those cases that act in the opposite direction like removing elements, removing attributes, it was difficult to find proper ranges and apply changes properly. The number of edge cases was growing. For example, who should be responsible for converting a paragraph that once was a part of a list but not is a plain paragraph between two lists? There are some ideas that we want to investigate to solve those issues and provide an understandable API for developers:
remove
downcast conversion is based on position mapping, and for complex view structures, it's not always ok that we just map the range and remove everything inside it. There are cases that a single model element is mapped to multiple view elements (this is a case in lists, tables). In those cases, it should not remove only the range that is the best guess but should use the outermost range that still fulfills the mapping.remove
downcast the outermost range should be used but for selection mapping the innermost.remove
(orremoveRange
) downcast to remove the old view but then theinsert
(orinsertRange
) would be responsible to reuse old view elements.If you'd like to see this feature implemented, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: