From 58ed426653a637eadb44f2524aed05f55b6c70ae Mon Sep 17 00:00:00 2001 From: Serge Latyntcev Date: Mon, 12 Oct 2020 16:54:29 +1300 Subject: [PATCH] FIX TinyMCEConfig image size presets handle incorrect values --- _config/html.yml | 2 +- src/Forms/HTMLEditor/TinyMCEConfig.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/_config/html.yml b/_config/html.yml index dff94addb..83b30d3db 100644 --- a/_config/html.yml +++ b/_config/html.yml @@ -16,7 +16,7 @@ SilverStripe\Core\Injector\Injector: SilverStripe\Forms\HTMLEditor\TinyMCEConfig: image_size_presets: - - width: 600, + - width: 600 i18n: SilverStripe\Forms\HTMLEditor\TinyMCEConfig.BEST_FIT text: Best fit name: bestfit diff --git a/src/Forms/HTMLEditor/TinyMCEConfig.php b/src/Forms/HTMLEditor/TinyMCEConfig.php index e7f356fa6..f4bc99dbc 100644 --- a/src/Forms/HTMLEditor/TinyMCEConfig.php +++ b/src/Forms/HTMLEditor/TinyMCEConfig.php @@ -694,6 +694,10 @@ class TinyMCEConfig extends HTMLEditorConfig implements i18nEntityProvider } foreach ($settings['image_size_presets'] as &$preset) { + if (isset($preset['width'])) { + $preset['width'] = (int) $preset['width']; + } + if (isset($preset['i18n'])) { $preset['text'] = _t( $preset['i18n'],