From 24dc3428d9aa0830a1ab8a606ba67817e89a6263 Mon Sep 17 00:00:00 2001 From: Jonathon Menz Date: Fri, 2 Dec 2016 12:23:27 -0800 Subject: [PATCH] NEW HTMLEditorField default alignment setting A config setting to control the default alignment of embedded media and images --- forms/HtmlEditorField.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index e088b8401..87962d462 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -20,6 +20,12 @@ class HtmlEditorField extends TextareaField { */ private static $insert_width = 600; + /** + * @config + * @var string Default alignment for Images and Media. Options: leftAlone|center|left|right + */ + private static $media_alignment = 'leftAlone'; + /** * @config * @var bool Should we check the valid_elements (& extended_valid_elements) rules from HtmlEditorConfig server side? @@ -674,7 +680,9 @@ class HtmlEditorField_Toolbar extends RequestHandler { 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'), 'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.') - ) + ), + HtmlEditorField::config()->get('media_alignment') + )->addExtraClass('last') ); @@ -808,7 +816,8 @@ class HtmlEditorField_Toolbar extends RequestHandler { 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'), 'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.') - ) + ), + HtmlEditorField::config()->get('media_alignment') )->addExtraClass('last') );