Problem/Motivation
I have created a custom ckeditor5 plugin (run with Drupal 9) and that all works fine for initial editing and output. It creates a custom tag eg: <bbref ver="RSV">Ex 2:32</bbref>
A couple of days later (possibly after 9.5.2 update?) the editor now rejects my tag when it loads saved HTML (or creating new) and replaces it with <span data-ck-unsafe-element="bbref" ver="RSV">Ex 2:32</span>
which is styled to be invisible in the editor.
ckeditor's domconverter.js seems to have a hand in this.
There is a method for handling a similar thing with data-ck-unsafe-attribute- (eg https://ckeditor.com/docs/ckeditor5/latest/updating/guides/update-to-31....) but not for unsafe-element and trying the unsafe-attribute method does not seem to work:
// Callback function provides access to the model attribute value
// and the DowncastWriter
view: (modelAttributeValue, conversionApi) => {
const {writer} = conversionApi;
const cae = writer.createAttributeElement(
'bbref',
{
ver: modelAttributeValue
},
{
renderUnsafeAttributes: ['ver', 'bbref']
});
console.log('cae');
//console.dir(cae);
return cae;
}
Current core: 9.5.2
Using full_html text format, 'Limit allowed HTML tags and correct faulty HTML' and 'Correct faulty and chopped off HTML' both disabled.
Steps to reproduce
Add any custom tag to ckeditor (ie using source-edit facility), switch back to normal editing. The text disappears and inspecting the element shows <span data-ck-unsafe-element="mytag" ...
Proposed resolution
Stop ckeditor 5 marking unknown tags.
Provide a method to bypass
Note: you cannot add accepted tags to 'Limit allowed HTML tags and correct faulty HTML' anymore, and notes: 'With CKEditor 5 this is a read-only field....'