mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-06-30 16:39:38 +02:00
BUGFIX: add CloseButton back, only hidde it when editing an image that loaded from content area.
ENHANEMENT: remove call of toogleLooks() from redraw(), only call toggleLooks() when needed. MINOR: code minimazing / code convention.
This commit is contained in:
parent
e1372b3794
commit
ca38b25014
|
@ -659,17 +659,14 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||
},
|
||||
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();
|
||||
}
|
||||
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();
|
||||
|
@ -692,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();
|
||||
this.toggleLooks();
|
||||
var ed = this.getEditor(), node = $(ed.getSelectedNode()),
|
||||
hasItems = Boolean(this.find('.ss-htmleditorfield-file').length),
|
||||
editingSelected = node.is('img');
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
<div class="overview">
|
||||
<span class="thumbnail">$Preview</span>
|
||||
<span class="title">$Name</span>
|
||||
<a href="#" class="action-delete ui-state-default">
|
||||
<span class="ui-button-icon-primary ui-icon btn-icon-cross-circle"></span>
|
||||
</a>
|
||||
</div>
|
||||
<div class="details">
|
||||
<fieldset>
|
||||
|
|
Loading…
Reference in New Issue
Block a user