diff --git a/sources/application/UI/Base/Component/Input/RichText/RichText.php b/sources/application/UI/Base/Component/Input/RichText/RichText.php index 841a87667..11502802b 100644 --- a/sources/application/UI/Base/Component/Input/RichText/RichText.php +++ b/sources/application/UI/Base/Component/Input/RichText/RichText.php @@ -28,7 +28,7 @@ class RichText extends UIBlock 'js/ckeditor/plugins/codesnippet/lib/highlight/styles/obsidian.css', ]; - /** @var string */ + /** @var array Configuration parameters for the CKEditor instance used with Richtext block */ protected $aConfig; /** @@ -39,14 +39,27 @@ class RichText extends UIBlock public function __construct(?string $sId = null) { parent::__construct($sId); - $this->aConfig = json_encode(utils::GetCkeditorPref()); + $this->aConfig = utils::GetCkeditorPref(); } + /** + * @param array $aConfig + * @see static::$aConfig + * + * @return $this + */ + public function SetConfig(array $aConfig) + { + $this->aConfig = $aConfig; + + return $this; + } /** - * @return string + * @see static::$aConfig + * @return array */ - public function GetConfig() + public function GetConfig(): array { return $this->aConfig; } diff --git a/templates/base/components/input/richtext/layout.js.twig b/templates/base/components/input/richtext/layout.js.twig index c2da6b6a1..73ddc553b 100644 --- a/templates/base/components/input/richtext/layout.js.twig +++ b/templates/base/components/input/richtext/layout.js.twig @@ -1 +1 @@ -$('#{{ oUIBlock.GetId() }}').ckeditor(function() { /* callback code */ }, {{ oUIBlock.GetConfig()| raw }}); \ No newline at end of file +$('#{{ oUIBlock.GetId() }}').ckeditor(function() { /* callback code */ }, {{ oUIBlock.GetConfig()|json_encode|raw }}); \ No newline at end of file