mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Merge pull request #1145 from silverstripe-rebelalliance/bug/image_reedit_attr
FIX Not calling updateFromNode on re-opening an image
This commit is contained in:
commit
0b44d8fbfb
@ -800,8 +800,8 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
|
|
||||||
// TODO Depends on managed mime type
|
// TODO Depends on managed mime type
|
||||||
if(node.is('img')) {
|
if(node.is('img')) {
|
||||||
this.showFileView(node.data('url') || node.attr('src')).complete(function() {
|
this.showFileView(node.data('url') || node.attr('src')).done(function(filefield) {
|
||||||
$(this).updateFromNode(node);
|
filefield.updateFromNode(node);
|
||||||
self.toggleCloseButton();
|
self.toggleCloseButton();
|
||||||
self.redraw();
|
self.redraw();
|
||||||
});
|
});
|
||||||
@ -844,25 +844,29 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
getFileView: function(idOrUrl) {
|
getFileView: function(idOrUrl) {
|
||||||
return this.find('.ss-htmleditorfield-file[data-id=' + idOrUrl + ']');
|
return this.find('.ss-htmleditorfield-file[data-id=' + idOrUrl + ']');
|
||||||
},
|
},
|
||||||
showFileView: function(idOrUrl, successCallback) {
|
showFileView: function(idOrUrl) {
|
||||||
var self = this, params = (Number(idOrUrl) == idOrUrl) ? {ID: idOrUrl} : {FileURL: idOrUrl},
|
var self = this, params = (Number(idOrUrl) == idOrUrl) ? {ID: idOrUrl} : {FileURL: idOrUrl};
|
||||||
item = $('<div class="ss-htmleditorfield-file" />');
|
|
||||||
|
|
||||||
item.addClass('loading');
|
var item = $('<div class="ss-htmleditorfield-file loading" />');
|
||||||
this.find('.content-edit').append(item);
|
this.find('.content-edit').append(item);
|
||||||
return $.ajax({
|
|
||||||
// url: this.data('urlViewfile') + '?ID=' + id,
|
var dfr = $.Deferred();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
url: $.path.addSearchParams(this.attr('action').replace(/MediaForm/, 'viewfile'), params),
|
url: $.path.addSearchParams(this.attr('action').replace(/MediaForm/, 'viewfile'), params),
|
||||||
success: function(html, status, xhr) {
|
success: function(html, status, xhr) {
|
||||||
var newItem = $(html);
|
var newItem = $(html).filter('.ss-htmleditorfield-file');
|
||||||
item.replaceWith(newItem);
|
item.replaceWith(newItem);
|
||||||
self.redraw();
|
self.redraw();
|
||||||
if(successCallback) successCallback.call(newItem, html, status, xhr);
|
dfr.resolve(newItem);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
item.remove();
|
item.remove();
|
||||||
|
dfr.reject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
return dfr.promise();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -951,7 +955,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE;
|
|||||||
|
|
||||||
if (urlField.validate()) {
|
if (urlField.validate()) {
|
||||||
container.addClass('loading');
|
container.addClass('loading');
|
||||||
form.showFileView('http://' + urlField.val()).complete(function() {
|
form.showFileView('http://' + urlField.val()).done(function() {
|
||||||
container.removeClass('loading');
|
container.removeClass('loading');
|
||||||
});
|
});
|
||||||
form.redraw();
|
form.redraw();
|
||||||
|
Loading…
Reference in New Issue
Block a user