I have a html formatted text in database, eg:
<img src="..." width="100%" alt="XY" style="border:red 1px solid"/>
If I load this into the richeditor, the width and style tags will be removed.
And vica versa:
- I built an extension which allows to edit class, style, width, height, alt and title tag.
- the alt and title tag will be in the saved html code, but the class, style, widht and height will be removed.
How can I allow html attributes?
I have this code in my image-editor.js, but still not allow these attributes in saved html:
return [
{
types: ["image"],
attributes: {
style: {
default: null,
parseHTML: (element) => element.getAttribute("style"),
renderHTML: (attributes) => {
if (!attributes.style) {
return null;
}
return {
style: attributes.style,
};
},
keepOnSplit: false,
}, .... ```