ENHANCEMENT: HTMLEditorField default alignment setting

This commit is contained in:
Damian Mooyman 2016-12-06 09:55:48 +13:00 committed by GitHub
commit b4ba606ff2

View File

@ -20,6 +20,12 @@ class HtmlEditorField extends TextareaField {
*/ */
private static $insert_width = 600; 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 * @config
* @var bool Should we check the valid_elements (& extended_valid_elements) rules from HtmlEditorConfig server side? * @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.'), 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'),
'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'),
'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.') 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.')
) ),
HtmlEditorField::config()->get('media_alignment')
)->addExtraClass('last') )->addExtraClass('last')
); );
@ -808,7 +816,8 @@ class HtmlEditorField_Toolbar extends RequestHandler {
'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'), 'center' => _t('HtmlEditorField.CSSCLASSCENTER', 'Centered, on its own.'),
'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'), 'left' => _t('HtmlEditorField.CSSCLASSLEFT', 'On the left, with text wrapping around.'),
'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.') 'right' => _t('HtmlEditorField.CSSCLASSRIGHT', 'On the right, with text wrapping around.')
) ),
HtmlEditorField::config()->get('media_alignment')
)->addExtraClass('last') )->addExtraClass('last')
); );