I am trying to add a style attribute to an img tag in HTMLText markup view. But every time I save or publish, the attribute is stripped.
I found this documentation ("Setting options" - about half way down). So tried that in my /app/_config.php file and did a /dev/build:
HtmlEditorConfig::get('cms')->setOption(
'extended_valid_elements',
'img[style]'
);
After doing the above, img src was stripped. Because according to this documentation the tag rules completely replace existing rules for that tag. Which in Silverstripe's case are found in /vendor/silverstripe/admin/_config.php. The point is, this confirms the above config is definitely being used by Silverstripe.
But the style attribute is still being stripped out on save.