Merge pull request #9733 from creative-commoners/pulls/4.6/fix-tinymce-image-configs

FIX TinyMCEConfig image size presets handle incorrect values
This commit is contained in:
Serge Latyntsev 2020-10-12 18:06:27 +13:00 committed by GitHub
commit 01b5551a5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -16,7 +16,7 @@ SilverStripe\Core\Injector\Injector:
SilverStripe\Forms\HTMLEditor\TinyMCEConfig: SilverStripe\Forms\HTMLEditor\TinyMCEConfig:
image_size_presets: image_size_presets:
- width: 600, - width: 600
i18n: SilverStripe\Forms\HTMLEditor\TinyMCEConfig.BEST_FIT i18n: SilverStripe\Forms\HTMLEditor\TinyMCEConfig.BEST_FIT
text: Best fit text: Best fit
name: bestfit name: bestfit

View File

@ -694,6 +694,10 @@ class TinyMCEConfig extends HTMLEditorConfig implements i18nEntityProvider
} }
foreach ($settings['image_size_presets'] as &$preset) { foreach ($settings['image_size_presets'] as &$preset) {
if (isset($preset['width'])) {
$preset['width'] = (int) $preset['width'];
}
if (isset($preset['i18n'])) { if (isset($preset['i18n'])) {
$preset['text'] = _t( $preset['text'] = _t(
$preset['i18n'], $preset['i18n'],