Merge pull request #7099 from open-sausages/pulls/4.0/thats-a-wrap

Update TinyMCEConfig to use theme CSS
This commit is contained in:
Damian Mooyman 2017-07-03 11:32:27 +12:00 committed by GitHub
commit 40f8b04501
2 changed files with 11 additions and 2 deletions

View File

@ -51,6 +51,14 @@ abstract class HTMLEditorConfig
*/ */
private static $default_config = 'default'; private static $default_config = 'default';
/**
* List of themes defined for the frontend
*
* @config
* @var array
*/
private static $user_themes = [];
/** /**
* Get the HTMLEditorConfig object for the given identifier. This is a correct way to get an HTMLEditorConfig * Get the HTMLEditorConfig object for the given identifier. This is a correct way to get an HTMLEditorConfig
* instance - do not call 'new' * instance - do not call 'new'
@ -103,7 +111,7 @@ abstract class HTMLEditorConfig
*/ */
public static function get_active_identifier() public static function get_active_identifier()
{ {
$identifier = self::$current ?: static::config()->default_config; $identifier = self::$current ?: static::config()->get('default_config');
return $identifier; return $identifier;
} }

View File

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