Description
We started to experiment with EditContext API in CKEditor 5 and encountered an issue. There are so-called "nested editables" inside the editor – smaller editable regions inside the main editable region of the editor, e.g. image captions or table cells. We want to use the EditContext API also in these nested editables but it can't be used directly due to limiting the list of supported elements only to shadow hosts + <canvas>
. This limitation forces us to dynamically inject a <div>
element into a nested editable to enable the EditContext API when the user starts interacting with it:
<figure class="image" contenteditable="false">
<img src="[…]" alt="[…]">
<figcaption contenteditable="true">Some caption</figcaption>
</figure>
<!-- beomes -->
<figure class="image" contenteditable="false">
<img src="[…]" alt="[…]">
<figcaption contenteditable="true">
<div class="edit-context-host">Some caption</div>
</figcaption>
</figure>
It works but introduces some drawbacks, especially when it comes to the styling, e.g. it breaks selectors like td > p:first-child
.
It was decided in #19 to limit the list to "boring elements" (shadow hosts) but I feel that this list could be too limited. CKEditor 5 is not the only editor that uses nested editables, e.g. Tiny also uses them with the <figcaption>
element for image captions so does Lexical. Due to that, I propose extending the current list of supported elements, e.g. to all elements supporting the contenteditable
attribute.
Activity