[FIX] web_editor: email receiver see file icon
Scenario: - add a file in mass mailing editor => an generic icon (instead of lower version where icon depended on mimetype) is added linking the file - save and send mail => no icon is shown in email received The system is targeting `a[href*="/web/content/"][data-mimetype]:empty` to add real image inside instead of using background-image attribute which is stripped in sanitized. With this commit, data-mimetype is not removed when image processing attributes are removed when a file is inserted. opw-2474053 closes odoo/odoo#70022 X-original-commit: eb3772508ce518ff3f84724eebbe43fd1e040d77 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
This commit is contained in:
@@ -451,7 +451,7 @@ var FileWidget = SearchableMediaWidget.extend({
|
||||
}
|
||||
href += 'unique=' + img.checksum + '&download=true';
|
||||
this.$media.attr('href', href);
|
||||
this.$media.addClass('o_image').attr('title', img.name).attr('data-mimetype', img.mimetype);
|
||||
this.$media.addClass('o_image').attr('title', img.name);
|
||||
}
|
||||
|
||||
this.$media.attr('alt', img.alt || img.description || '');
|
||||
@@ -464,6 +464,10 @@ var FileWidget = SearchableMediaWidget.extend({
|
||||
removeOnImageChangeAttrs.forEach(attr => {
|
||||
delete this.media.dataset[attr];
|
||||
});
|
||||
// Add mimetype for documents
|
||||
if (!img.image_src) {
|
||||
this.media.dataset.mimetype = img.mimetype;
|
||||
}
|
||||
this.media.classList.remove('o_modified_image_to_save');
|
||||
this.$media.trigger('image_changed');
|
||||
return this.media;
|
||||
|
||||
Reference in New Issue
Block a user