mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-01 05:39:10 +02:00
ENHANCEMENT: toggle header and action label for image dialog popups (from content TinyMCE image icon)
This commit is contained in:
parent
095b62a0b4
commit
e1372b3794
@ -422,14 +422,19 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
$fields = new FieldList(
|
$fields = new FieldList(
|
||||||
new LiteralField(
|
new LiteralField(
|
||||||
'Heading',
|
'Heading',
|
||||||
sprintf('<h3>%s</h3>', _t('HtmlEditorField.IMAGE', 'Insert Image'))
|
sprintf('<h3 class="htmleditorfield-mediaform-heading insert">%s</h3>', _t('HtmlEditorField.INSERTIMAGE', 'Insert Image')).
|
||||||
|
sprintf('<h3 class="htmleditorfield-mediaform-heading update">%s</h3>', _t('HtmlEditorField.UpdateIMAGE', 'Update Image'))
|
||||||
),
|
),
|
||||||
$allFields
|
$allFields
|
||||||
);
|
);
|
||||||
|
|
||||||
$actions = new FieldList(
|
$actions = new FieldList(
|
||||||
FormAction::create('insertimage', _t('HtmlEditorField.BUTTONINSERT', 'Insert'))
|
FormAction::create('insertimage', _t('HtmlEditorField.BUTTONINSERT', 'Insert'))
|
||||||
->addExtraClass('ss-ui-action-constructive')
|
->addExtraClass('ss-ui-action-constructive image-insert')
|
||||||
|
->setAttribute('data-icon', 'accept')
|
||||||
|
->setUseButtonTag(true),
|
||||||
|
FormAction::create('insertimage', _t('HtmlEditorField.BUTTONUpdate', 'Update'))
|
||||||
|
->addExtraClass('ss-ui-action-constructive image-update')
|
||||||
->setAttribute('data-icon', 'accept')
|
->setAttribute('data-icon', 'accept')
|
||||||
->setUseButtonTag(true)
|
->setUseButtonTag(true)
|
||||||
);
|
);
|
||||||
|
@ -653,6 +653,24 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
* of remove files as well.
|
* of remove files as well.
|
||||||
*/
|
*/
|
||||||
$('form.htmleditorfield-mediaform').entwine({
|
$('form.htmleditorfield-mediaform').entwine({
|
||||||
|
onmatch: function() {
|
||||||
|
this.toggleLooks();
|
||||||
|
this._super();
|
||||||
|
},
|
||||||
|
toggleLooks: function(){
|
||||||
|
var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
|
||||||
|
if(updateExisting){
|
||||||
|
this.find('.htmleditorfield-mediaform-heading.insert').hide();
|
||||||
|
this.find('.Actions .image-insert').hide();
|
||||||
|
this.find('.htmleditorfield-mediaform-heading.update').show();
|
||||||
|
this.find('.Actions .image-update').show();
|
||||||
|
}else{
|
||||||
|
this.find('.htmleditorfield-mediaform-heading.insert').show();
|
||||||
|
this.find('.Actions .image-insert').show();
|
||||||
|
this.find('.htmleditorfield-mediaform-heading.update').hide();
|
||||||
|
this.find('.Actions .image-update').hide();
|
||||||
|
}
|
||||||
|
},
|
||||||
onsubmit: function() {
|
onsubmit: function() {
|
||||||
var self = this, ed = this.getEditor();
|
var self = this, ed = this.getEditor();
|
||||||
|
|
||||||
@ -682,7 +700,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
},
|
},
|
||||||
redraw: function() {
|
redraw: function() {
|
||||||
this._super();
|
this._super();
|
||||||
|
this.toggleLooks();
|
||||||
var ed = this.getEditor(), node = $(ed.getSelectedNode()),
|
var ed = this.getEditor(), node = $(ed.getSelectedNode()),
|
||||||
hasItems = Boolean(this.find('.ss-htmleditorfield-file').length),
|
hasItems = Boolean(this.find('.ss-htmleditorfield-file').length),
|
||||||
editingSelected = node.is('img');
|
editingSelected = node.is('img');
|
||||||
|
@ -287,7 +287,8 @@ en:
|
|||||||
FROMCMS: "From the CMS"
|
FROMCMS: "From the CMS"
|
||||||
FROMCOMPUTER: "From your computer"
|
FROMCOMPUTER: "From your computer"
|
||||||
Find: "Find"
|
Find: "Find"
|
||||||
IMAGE: "Insert Image"
|
INSERTIMAGE: "Insert Image"
|
||||||
|
UPDATEIMAGE: "Update Image"
|
||||||
IMAGEALTTEXT: "Alternative text (alt) - shown if image cannot be displayed"
|
IMAGEALTTEXT: "Alternative text (alt) - shown if image cannot be displayed"
|
||||||
IMAGEDIMENSIONS: "Dimensions"
|
IMAGEDIMENSIONS: "Dimensions"
|
||||||
IMAGEHEIGHTPX: "Height"
|
IMAGEHEIGHTPX: "Height"
|
||||||
|
Loading…
Reference in New Issue
Block a user