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
Conversion from simple model to complex view (slot conversion) #1589
Comments
I've made a PoC of what I call a "slot conversion", when we can control where children of a specific model element are being inserted in the view: https://github.com/ckeditor/ckeditor5-core/tree/poc-slot-conversion (updated version in monorepo: https://github.com/ckeditor/ckeditor5/tree/poc/slot-conversion)
This is a bit different scenario than what you described, because in what you showed @jodator |
BTW, this is labeled with |
Interestingly, the slot conversion that I made a PoC of in #1589 (comment) break widget type around feature. Since the model element is mapped to the slot, the WTA feature does not recognise the widget element as here it gets the slot element instead. That could probably be fixed in WTA itself because I don't know why it gets the view element from the model element and not the other way around, but in general, playing with mappings may lead to such issues. After implementing a couple such widgets I see two things that we should make easier:
|
As for a freshman, without any knowledge of CKE5 converters, the problem looks like Shadow DOM content distribution. There was even a proposal from Google for an imperative distribution API:
Maybe we can get some inspiration and naming the native world, to make CKE-specific things easier to understand. BTW, why don't we use the actual shadow DOM? |
Cross-linking table case: #8138 (comment). |
Outdated DUP #10294 |
Some nested widgets might have a structure that does not map 1:1 all elements inside.
Similar case is with current widgets that maps
<figure>
from the view to<image>
or<table>
element in the model. So the mapping is not element to element but rather view widget wrapper to model element.This complicates stuff as to override some parts of such widget conversion requires deeper understanding of the feature. For image it is hard IMO but for tables might be hard as hell for outsiders.
The second part is to showcase how to map view element editable to element in the model so the selection and automatic conversion of children will work out-of-the-box. In such example one would rather convert
div.widget-title
but map thediv.sub-editable
towidgetTitle
in the model.The text was updated successfully, but these errors were encountered: