From 79867ca96fed3475c6b591b3e3c8fd8c2eb3eb24 Mon Sep 17 00:00:00 2001 From: Younn Olivier Date: Mon, 25 Apr 2022 12:00:14 +0000 Subject: [PATCH] [FIX] web_tour, web_editor: observe iframe DOM mutations in tours Before this commit, iframes DOM mutations were not taken into account to update the tour manager. So in the context of mass_mailing, displaying the web editor in an iframe, the tours were updated at the right moment by chance (no mutations for 750ms in the global document and in the iframe document). This commit adds an o_iframe class, used to define an iframe that will render a part of Odoo. An observer is added in the tour service to monitor the addition of such iframe, and sets an observer on that iframe to correctly update the tour manager, counting the iframe DOM mutations for the 750ms delay. In addition to this observer, the iframe's HTML content is added to the final document HTML log when a tour crashes (directly between the for convenience, copy/pasting it in a browser just ignores what's in between). Also, when the tour_service is initialized in an o_iframe, it will not run the tours. This fix targets the saas-15.3 as it is needed to avoid a race condition introduced with [1] (introducing a tour which relies on DOM updates inside the mass mailing iframe). This could be backported if the need ever rise (it should really have been the case since [2]). [1]: https://github.com/odoo/odoo/commit/52d32e26c34bef10823582ef5c1f840492b73d7a [2]: https://github.com/odoo/odoo/commit/971629b9fe40911c3a9765c9fb746ea1c55d3560 closes odoo/odoo#91718 X-original-commit: ea35bd06c84b7101224c3b3dd24d1780e13232a9 Signed-off-by: Quentin Smetz (qsm) --- .../static/src/js/wysiwyg/wysiwyg_iframe.js | 2 +- addons/web_tour/static/src/js/tour_manager.js | 12 +++- addons/web_tour/static/src/js/tour_service.js | 63 +++++++++++++++++-- 3 files changed, 69 insertions(+), 8 deletions(-) diff --git a/addons/web_editor/static/src/js/wysiwyg/wysiwyg_iframe.js b/addons/web_editor/static/src/js/wysiwyg/wysiwyg_iframe.js index b52935aa9f4..8c6918ab890 100644 --- a/addons/web_editor/static/src/js/wysiwyg/wysiwyg_iframe.js +++ b/addons/web_editor/static/src/js/wysiwyg/wysiwyg_iframe.js @@ -92,7 +92,7 @@ Wysiwyg.include({ */ _loadIframe: function () { var self = this; - this.$iframe = $('