You can create a helper method you call whenever the XHtmlString is rendering. Then just loop through the fragments and find the one relevant to images and adjust the markup to add what you need. I've done this for similar things should as resonsive attributes and to add alt text from the core image
We are in process of upgrading EPiServer ver.11 to Optimizely ver. 12.
The issue we are facing right now is that DIsplayTemplate (Image.cshtml) is not getting executed when picture is added in TinyMCE editor.
In EpiServer 11 we had this Image.cshtml html file inside the DisplayTemplates folder ->
By this way we could add css class to images inside TinyMCE (Xhtml string).
Does anyone know whats the issue in Optimizely ver 12 or is there anyother way to add css classes to pictures/images residing inside TinyMCE ?