[FIX] mass_mailing: remove sidebar from conversion iframe

When converting an email for compatibility with email clients, we move
the contents of the editor iframe inside a new iframe, keeping only
what's in the iframe target element. But we failed to remove the sidebar
and other UI utils elements, which are irrelevant to the conversion.
Additionally, failing to remove the sidebar from the conversion iframe
made the snippets' images load again when committing changes.

task-3323894

closes odoo/odoo#126845

Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Antoine Guenet
2023-08-24 18:36:57 +02:00
parent d1a9e049f7
commit 6f560990b1
@@ -141,6 +141,7 @@ export class MassMailingHtmlField extends HtmlField {
const clonedBody = clonedHtmlNode.querySelector('body');
const clonedIframeTarget = clonedHtmlNode.querySelector('#iframe_target');
clonedBody.replaceChildren(clonedIframeTarget);
clonedBody.querySelector('.iframe-utils-zone').remove();
clonedHtmlNode.querySelectorAll('script').forEach(script => script.remove()); // Remove scripts.
iframe.srcdoc = clonedHtmlNode.outerHTML;
const iframePromise = new Promise((resolve) => {