mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Update TinyMCEConfig to use theme CSS
This commit is contained in:
parent
c69a565b08
commit
cddaaf1444
@ -51,6 +51,11 @@ abstract class HTMLEditorConfig
|
|||||||
*/
|
*/
|
||||||
private static $default_config = 'default';
|
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
|
* 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'
|
||||||
@ -147,6 +152,15 @@ abstract class HTMLEditorConfig
|
|||||||
return $configs;
|
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
|
* Get the current value of an option
|
||||||
*
|
*
|
||||||
|
@ -616,9 +616,8 @@ class TinyMCEConfig extends HTMLEditorConfig
|
|||||||
|
|
||||||
// Add standard editor.css
|
// Add standard editor.css
|
||||||
$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());
|
$themedEditor = ThemeResourceLoader::inst()->findThemedCSS('editor', $this->config()->user_themes);
|
||||||
if ($themedEditor) {
|
if ($themedEditor) {
|
||||||
$editor[] = Director::absoluteURL($themedEditor, Director::BASE);
|
$editor[] = Director::absoluteURL($themedEditor, Director::BASE);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user