mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #359 from silverstripe-big-o/sapphire
--- When open an image form loaded from TinyMCE Content, change the looks of the popup, such as popup heading (change from "Insert Image" to "Update Image"), action button label (change from "Insert" to "Update"), hiding the cancelling button on the top right corner which still needs to show when in inserting mode Conflicts: lang/en.yml
This commit is contained in:
commit
8489ff37db
@ -422,14 +422,19 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
||||
$fields = new FieldList(
|
||||
new LiteralField(
|
||||
'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
|
||||
);
|
||||
|
||||
$actions = new FieldList(
|
||||
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')
|
||||
->setUseButtonTag(true)
|
||||
);
|
||||
|
@ -653,6 +653,21 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
||||
* of remove files as well.
|
||||
*/
|
||||
$('form.htmleditorfield-mediaform').entwine({
|
||||
onmatch: function() {
|
||||
this.toggleLooks();
|
||||
this._super();
|
||||
},
|
||||
toggleLooks: function(){
|
||||
var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
|
||||
this.find('.htmleditorfield-mediaform-heading.insert')[updateExisting ? 'hide' : 'show']();
|
||||
this.find('.Actions .image-insert')[updateExisting ? 'hide' : 'show']();
|
||||
this.find('.htmleditorfield-mediaform-heading.update')[updateExisting ? 'show' : 'hide']();
|
||||
this.find('.Actions .image-update')[updateExisting ? 'show' : 'hide']();
|
||||
},
|
||||
toggleCloseButton: function(){
|
||||
var updateExisting = Boolean(this.find('.ss-htmleditorfield-file').length);
|
||||
this.find('.overview .action-delete')[updateExisting ? 'hide' : 'show']();
|
||||
},
|
||||
onsubmit: function() {
|
||||
var self = this, ed = this.getEditor();
|
||||
|
||||
@ -674,15 +689,15 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
||||
if(node.is('img')) {
|
||||
this.showFileView(node.attr('src'), function() {
|
||||
$(this).updateFromNode(node);
|
||||
self.toggleCloseButton();
|
||||
self.redraw();
|
||||
});
|
||||
}
|
||||
|
||||
this.toggleLooks();
|
||||
this.redraw();
|
||||
},
|
||||
redraw: function() {
|
||||
this._super();
|
||||
|
||||
var ed = this.getEditor(), node = $(ed.getSelectedNode()),
|
||||
hasItems = Boolean(this.find('.ss-htmleditorfield-file').length),
|
||||
editingSelected = node.is('img');
|
||||
|
Loading…
Reference in New Issue
Block a user