From f1bf4578036e1a7261fa7d459d912cb6d8191a92 Mon Sep 17 00:00:00 2001 From: Jairo Llopis Date: Fri, 24 Feb 2017 11:19:24 +0100 Subject: [PATCH] [FIX] mass_mailing: do not remove image with link If you followed these steps, Chrome deleted the link and image: 1. Create a new mass mailing, fill the subject. 2. Drag & drop any snippet with pictograms. 3. Change a pictogram for an image. 4. Add a link to the image. 5. Save the record. This happen in chrome if the image was for example floating in the link, so this change check if an element is a contained element is visible before removing it. This issue doesn't happen with [jQuery 3][1] and may be linked to [this][2]. [1]: http://api.jquery.com/visible-selector/ [2]: http://stackoverflow.com/a/8337382/1468388 closes #15623 opw-710237 note: this is only needed in 9.0 and saas-11 because this features doesn't seem present in version 10.0 --- addons/mass_mailing/static/src/js/mass_mailing_editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addons/mass_mailing/static/src/js/mass_mailing_editor.js b/addons/mass_mailing/static/src/js/mass_mailing_editor.js index 6adc552365a..651e0c979e4 100644 --- a/addons/mass_mailing/static/src/js/mass_mailing_editor.js +++ b/addons/mass_mailing/static/src/js/mass_mailing_editor.js @@ -228,7 +228,8 @@ snippets_editor.Class.include({ var theme = ($("#o_left_bar .o_panel_body > div:not(.hidden)").attr("class") || "").replace(/^\s*|\s*o_mail_block[^\s]+\s*|\s*oe_snippet\s*|\s*ui-draggable\s*|\s*$/g, ''); var $theme = $("#editable_area [data-snippet-theme]").removeAttr("data-snippet-theme").removeData("snippet-theme"); $editable.children().first().attr("data-snippet-theme", theme); - $editable.find(":not(br):hidden").remove(); + // before jQuery 3, google chrome needs the `:not(:has(:visible))` part + $editable.find(":not(br):hidden:not(:has(:visible))").remove(); }, });