Closed wimleers closed 2 years ago
Sibling issue of #10891 and #11104? 🤔
Unfortunately no. Support for custom elements is a different thing. CKEditor needs to understand the meaning of an element to know how to handle it. This is impossible for custom elements unless someone can provide such information.
In fact, CKE4 doesn't support custom elements unless you modify its DTD manually. I've checked that (to my surprise) it will accept custom elements (assuming ACF passes them), but this was never officially documented and is quite buggy (e.g. such elements are lost on copy-paste).
So, assuming that DTD's modification is a must to make them work reliably – that's the same story for CKE5. You can register custom elements in GHS's schema. But you need to know their names.
We'll need to discuss how this was handled in Drupal becuase I didn't know that someone could enable elements via a wildcard.
We discussed this a week ago in our meeting. I believe you got the information you needed then? 😊
I think the conclusion we reached was to follow @dawidurbanski's proposal: to implement this using the same approach as CKEditor 5 uses for HTML comments. That is: don't treat it as HTML but just something arbitrary that would be stored and wouldn’t be visible in the editing view, only in the dataDowncast
.
Options:
<htmlCustomElement rawData="<myCustomElement>raw HTML content</myCustomElement>"></htmlCustomElement>
htmlCustomElement
everywhere (just like htmlScript
and htmlStyle
). Define isInline: true
<script>
and <style>
support)rawData
rendered insideAdditional remarks:
Decision: "As elements in the model" + option 1 (no preview in the editing view for now).
Example content that we need to handle:
<p>Foo</p>
<custom>x</custom>
<custom someattr>
<p>Bar</p>
<custom2 someotherattr=1234>
foo
</custom2>
</custom>
<p>
Foo
<custom someattr />
<custom someattr />
<custom someattr /><custom someattr />
Bar
<custom>Bom</custom>
</p>
Making sure that GH won't lose this comment (sorry for a screenshot :P):
Sibling issue of #10891 and #11104? 🤔
I cannot configure CKEditor 5 to not strip away custom elements (f.e.
<drupal-media>
) or even arbitrary elements (f.e.<yo>
).📝 Provide detailed reproduction steps (if any)
htmlSupport.GeneralHtmlSupport
andsourceEditing.SourceEditing
CKE5 plugins, with the followinghtmlSupport
config:Source
button to paste this:Source
button again to access the rendered HTML representationSource
button again to access the raw HTML representation✔️ Expected result
Exactly what we pasted:
❌ Actual result
📃 Other details
v32.0.0