summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorNicolas Lempereur <nle@odoo.com>2021-04-27 11:46:05 +0000
committerNicolas Lempereur <nle@odoo.com>2021-04-28 08:00:38 +0000
commiteb3772508ce518ff3f84724eebbe43fd1e040d77 (patch)
tree6fdaef00c5aca951af5bb421c81c8f83f852f0e9 /addons/web_editor/static/src/js
parent7aa233e63a8c82cce8336adb99418a96e061268f (diff)
[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#69915 Signed-off-by: Nicolas Lempereur (nle) <nle@odoo.com>
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/wysiwyg/widgets/media.js6
1 files changed, 5 insertions, 1 deletions
diff --git a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js
index 703de4e744f..99ecabb1bed 100644
--- a/addons/web_editor/static/src/js/wysiwyg/widgets/media.js
+++ b/addons/web_editor/static/src/js/wysiwyg/widgets/media.js
@@ -444,7 +444,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 || '');
@@ -457,6 +457,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;