[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
This commit is contained in:
Jairo Llopis
2017-03-21 12:47:09 +01:00
committed by Nicolas Lempereur
parent 89581abf14
commit f1bf457803
@@ -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();
},
});