summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/widgets
diff options
context:
space:
mode:
authorlen-odoo <len@odoo.com>2018-11-21 08:03:58 +0000
committerlen-odoo <len@odoo.com>2018-11-23 10:32:45 +0000
commit264f89f63f89678b01a75a20b508dd10018b00d8 (patch)
tree5dff70c8b1851286c1e322b32fff266c4e070919 /addons/web_editor/static/src/js/widgets
parent06373dde4eb46b4d392ec33cb070d53a94d4dbcd (diff)
[FIX] web_editor: remove video option when composing email
Embedding a video can't work because it embeds an iframe, which is not supported by most email clients for security reasons. (What happens when Gmail shows embedded videos in displayed emails, is that you send a link in the email body, and it is at rendering that Gmail adds the iframe into the page.) So the bugfix solution is to hide the button. Since there is an option "res_model" that allows us to know when we are in that case, we remove the video option. opw 1905497 closes odoo/odoo#28911
Diffstat (limited to 'addons/web_editor/static/src/js/widgets')
-rw-r--r--addons/web_editor/static/src/js/widgets/widgets.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/addons/web_editor/static/src/js/widgets/widgets.js b/addons/web_editor/static/src/js/widgets/widgets.js
index a4c1a29616d..078bfd95bd0 100644
--- a/addons/web_editor/static/src/js/widgets/widgets.js
+++ b/addons/web_editor/static/src/js/widgets/widgets.js
@@ -986,10 +986,14 @@ var MediaDialog = Dialog.extend({
this.$modal.addClass('note-image-dialog');
this.$modal.find('.modal-dialog').addClass('o_select_media_dialog');
-
+ // DO NOT FORWARD PORT
+ this.mailCompose = this.options.res_model === "mail.compose.message";
this.only_images = this.options.only_images || this.options.select_images || (this.media && ($(this.media).parent().data("oe-field") === "image" || $(this.media).parent().data("oe-type") === "image"));
+ if (this.only_images || this.mailCompose) {
+ this.$('[href="#editor-media-video"]').addClass('hidden');
+ }
if (this.only_images) {
- this.$('[href="#editor-media-document"], [href="#editor-media-video"], [href="#editor-media-icon"]').addClass('hidden');
+ this.$('[href="#editor-media-document"], [href="#editor-media-icon"]').addClass('hidden');
}
this.opened((function () {
@@ -1016,8 +1020,10 @@ var MediaDialog = Dialog.extend({
if (!this.only_images) {
this.iconDialog = new fontIconsDialog(this, this.media, this.options);
this.iconDialog.appendTo(this.$("#editor-media-icon"));
- this.videoDialog = new VideoDialog(this, this.media, this.options);
- this.videoDialog.appendTo(this.$("#editor-media-video"));
+ if (!this.mailCompose) {
+ this.videoDialog = new VideoDialog(this, this.media, this.options);
+ this.videoDialog.appendTo(this.$("#editor-media-video"));
+ }
}
this.active = this.imageDialog;