Update TinyMCEConfig to use theme CSS

This commit is contained in:
Aaron Carlino 2017-06-30 20:41:06 +12:00 committed by Damian Mooyman
parent c69a565b08
commit cddaaf1444
2 changed files with 15 additions and 2 deletions

View File

@ -51,6 +51,11 @@ abstract class HTMLEditorConfig
*/
private static $default_config = 'default';
/**
* @var List of themes defined for the frontend
*/
private static $user_themes = [];
/**
* Get the HTMLEditorConfig object for the given identifier. This is a correct way to get an HTMLEditorConfig
* instance - do not call 'new'
@ -147,6 +152,15 @@ abstract class HTMLEditorConfig
return $configs;
}
/**
* Set user defined (non-admin) themes
* @param array $themes
*/
public static function set_user_themes($themes)
{
self::config()->set('user_themes', $themes);
}
/**
* Get the current value of an option
*

View File

@ -616,9 +616,8 @@ class TinyMCEConfig extends HTMLEditorConfig
// Add standard editor.css
$editor[] = $this->getAdminModule()->getResourceURL('client/dist/styles/editor.css');
// Themed editor.css
$themedEditor = ThemeResourceLoader::inst()->findThemedCSS('editor', SSViewer::get_themes());
$themedEditor = ThemeResourceLoader::inst()->findThemedCSS('editor', $this->config()->user_themes);
if ($themedEditor) {
$editor[] = Director::absoluteURL($themedEditor, Director::BASE);
}