From e51cdc1e60ea8b61f6b1ca24ef7151d487ce8c86 Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Fri, 3 Dec 2021 11:17:59 +0000 Subject: [PATCH] [FIX] web_editor: prevent dropping popup inside a substructure Before this commit, it was possible to drag and drop a popup inside an oe_structure which was itself inside an other oe_structure (e.g. snippet parallax). It didn't make sense and moreover created bugs. After this commit, it is no longer possible to drag and drop the popup snippet or the newsletter popup snippet in a substructure. task-2491976 closes odoo/odoo#81669 X-original-commit: 49050c124795852ce7ad51b92958498972730dcf Signed-off-by: Quentin Smetz (qsm) Co-authored-by: qsm-odoo --- addons/web_editor/static/src/js/editor/snippets.editor.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/addons/web_editor/static/src/js/editor/snippets.editor.js b/addons/web_editor/static/src/js/editor/snippets.editor.js index 0c41f46d843..e7e3093baff 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -2375,6 +2375,13 @@ var SnippetsMenu = Widget.extend({ } } + // TODO mentioning external app snippet but done as a stable fix + // that will be adapted in master: if popup snippet, do not + // allow to add it in another snippet + if ($baseBody[0].matches('.s_popup, .o_newsletter_popup')) { + $selectorChildren = $selectorChildren.not('[data-snippet] *'); + } + $toInsert = $baseBody.clone(); // Color-customize dynamic SVGs in dropped snippets with current theme colors. [...$toInsert.find('img[src^="/web_editor/shape/"]')].forEach(dynamicSvg => {