You can clone with
HTTPS or Subversion.
One way to style pages on a SilverStripe website differently depending on their PageType, is using the class it puts on the body tag. E.g., .HomePage > div:first-child could be styled differently from the default on .Page.
.HomePage > div:first-child
Unfortunately, it is currently impossible to use those css classes in the HTMLEditor.
HtmlEditorConfig::get('cms')->setOption('body_class', page_class); can be used to set the body's class in the editor, but only on a full page load: any subsequent ajax loads do not update that body class. Since SilverStripe loads everything with ajax now, it's impossible to have the correct styles inside the HTMLEditor for different PageTypes. This is also not very intuitive: one would expect the config options that are set during php execution to actually take effect.
There are several ways to fix this.
The most flexible one would be to not only send a Content field upon the ajax loads, but also a new ssTinyMceConfig.
Alternatively, a script tag in the Content field could set any overwritten config options, such as <script>ssTinyMceConfig.body_class="..."</script>. This way, no extra field needs to be added to the returned json, should that be a difficulty.
I’ve been struggling with the same issue lately, and this issue reminded me about it, so I put together a small module to allow devs to add CSS classes using ->setAttribute('data-mce-body-class', 'HomePage');: https://github.com/kinglozzer/htmleditorstyinghook.
This doesn’t really resolve this issue, updating configs via AJAX could be potentially useful elsewhere, but it might be of some use to you. :)
That, sir, is awesome! Thanks for sharing.
For my own application, I needed to add only one line to my php files, in Page.php: $fields->dataFieldByName('Content')->setAttribute('data-mce-body-class',get_called_class());
(get_called_class() is available since php 5.3)
One other note: your project name is missing an l :)
Heh, thanks for pointing that out :)