Some of the pages in my Silverstripe 3.1 website have specific styles, so I used the page class to target just those pages. Now the issue is that I am not able to make that distinction in the CMS because it does not include the pageclass.
I found HtmlEditorConfig::get('cms')->setOption('body_class', page_class); which sounded very promising, but that is a static setting: it is set once upon the first page load within the CMS. Any next page loaded via ajax will use those same editor settings, even if the page is of a different type. So what I really need is something like this, but refreshing every time the HTMLEditor is displayed.
One way is making the CMS reload upon every page load (i.e. disable the ajax for CMS page loads), but I'm not sure whether that's possible.
The other (and more prefered) way is making the HTMLEditor config settings come along with an ajax load. At the moment only Content is included in the json; it could easily include a ssTinyMceConfig field, in order to overwrite any current TinyMCE settings. Is there a specific reason this was not done, some kind of issue perhaps? It might just be because it was deemed unnecessary, so in that case I'd be interested to know how to make it happen of course.
A third way might be to hack into a single config field by adding <script>ssTinyMceConfig.body_class="..."</script> in the returned Content field, but I'm not sure how to do that either, and I'm not sure it would work.