silverstripe-framework/docs/en/02_Developer_Guides/15_Customising_the_Admin_Interface/05_Typography.md
Simon Winter 9bb41358fa Update 05_Typography.md
The documentation isn't clear as to where the editor config call should be made. If developers wish to set this up globally, there is a slightly different syntax required.
2015-07-14 15:20:15 +12:00

1.0 KiB

title: WYSIWYG Styles summary: Add custom CSS properties to the rich-text editor.

WYSIWYG Styles

SilverStripe lets you customize the style of content in the CMS. This is done by setting up a CSS file called editor.css in either your theme or in your mysite folder. This is set through

:::php
HtmlEditorConfig::get('cms')->setOption('ContentCSS', project() . '/css/editor.css');

Will load the mysite/css/editor.css file.

If using this config option in mysite/_config.php, you will have to instead call:

:::php
HtmlEditorConfig::get('cms')->setOption('content_css', project() . '/css/editor.css');

Any CSS classes within this file will be automatically added to the WYSIWYG editors 'style' dropdown. For instance, to add the color 'red' as an option within the WYSIWYG add the following to the editor.css

:::css
.red {
	color: red;
}
After you have defined the `editor.css` make sure you clear your SilverStripe cache for it to take effect.

API Documentation

  • [api:HtmlEditorConfig]