Following on from the recent changes in TinyMCEConfig to detect editor.css in SilverStripe 4 (#6767)
This works, provided you have an editor.css in a pre-defined ThemeResource, however this solution appears to provide no way in which to manually specify a CSS file either from a non-theme directory, a remote file, or a css file that isn't named editor.css, as content_css is overwritten in TinyMCEConfig::getConfig()
$settings['content_css'] = $this->getEditorCSS();
Please can the editor API be made more flexible to allow one to set _any_ css file, and not just css/editor.css in pre-defined ThemeResources? I have no objection to it _defaulting_ to a <theme>/css/editor.css if that exists, but at least allow developers to set a different one if required?
My suggestion in https://github.com/silverstripe/silverstripe-framework/issues/5965#issuecomment-245854635 was to merge TinyMCEConfig::getEditorCSS() with whatever has been set manually. That is a bit limiting though, as you couldn鈥檛 then choose to _not_ load the themed editor.css...
You can now do this via yml. The syntax supports vendor/module:path/to/editor.css so you don't need an absolute path.
https://github.com/silverstripe/silverstripe-admin/blob/1/_config/tinymce.yml
This is how admin module declares its css:
---
Name: admintinymce
---
SilverStripe\Forms\HTMLEditor\TinyMCEConfig:
base_dir: 'silverstripe/admin:thirdparty/tinymce'
editor_css:
- 'silverstripe/admin:client/dist/styles/editor.css'
Most helpful comment
You can now do this via yml. The syntax supports
vendor/module:path/to/editor.cssso you don't need an absolute path.https://github.com/silverstripe/silverstripe-admin/blob/1/_config/tinymce.yml
This is how admin module declares its css: