Elastic: Fix missing delete button in image upload widget in some browsers

pull/6796/head
Aleksander Machniak 6 years ago
parent d19377d276
commit 204a2c2d5b

@ -3321,16 +3321,19 @@ function rcube_elastic_ui()
function image_upload_input(obj)
{
var reset_button = $('<a>')
.attr({'class': 'icon button delete', href: '#', })
.click(function(e) { rcmail.command('delete-photo', '', this, e); return false; });
.attr({'class': 'icon button delete', href: '#', })
.click(function(e) { rcmail.command('delete-photo', '', this, e); return false; }),
img = $(obj).find('img')[0],
img_onload = function() {
var state = (img.currentSrc || img.src).indexOf(rcmail.env.photo_placeholder) != -1;
$(obj)[state ? 'removeClass' : 'addClass']('changed');
};
$(obj).append(reset_button).click(function() { rcmail.upload_input('upload-form'); });
$('img', obj).on('load', function() {
// FIXME: will that work in IE?
var state = (this.currentSrc || this.src).indexOf(rcmail.env.photo_placeholder) != -1;
$(obj)[state ? 'removeClass' : 'addClass']('changed');
});
// Note: Looks like only Firefox does not need this separate call
img_onload();
$(img).on('load', img_onload);
};
/**

Loading…
Cancel
Save