-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
DualContentModelElementSupport doesn't support inline element upcasting into block element #11513
Comments
Sibling Drupal issue: https://www.drupal.org/project/drupal/issues/3271418 |
Currently, to detect whether a Thus, in this situation:
We're seeing only the This means that we put more emphasize on the inner most elements than on the containers when deciding which elements to retain in case of schema conflicts. Thus, the heuristic should also take into consideration the inner most elements when making the decision. Why this makes sense will be visible in this scenario where invalid HTML is loaded:
Currently, the editor will retain: If we change the heuristic to scan the entire subtree (all nodes in it), the original structure will be better retained. We can expect something like:
Note: we need to scan really all nodes in this tree. If we focused on the leaf nodes only, then the below markup would still not be handled correctly:
|
The heuristic: ckeditor5/packages/ckeditor5-html-support/src/integrations/dualcontent.js Lines 113 to 118 in 30286f7
|
…ck-elements Fix (html-support): `<div>` elements should be upcast to container-like elements when there is a block among their descendants. Closes #11513.
📝 Provide detailed reproduction steps (if any)
The
html-support/integrations/dualcontent~DualContentModelElementSupport
is not handling cases where a child node that is an inline element in view changes into a block element in model. Example case where this is happening (in Drupal) is when<a>
is wrapping a<drupal-media>
element.Following data:
Upcasts into (because the links plugin doesn't support linking block elements):
So imagine the following use case:
✔️ Expected result
❌ Actual result
What actually happens is:
Which is later on reduced to since
<drupalMedia>
is a block element:If you'd like to see this fixed sooner, add a 👍 reaction to this post.
The text was updated successfully, but these errors were encountered: