[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) <qsm@odoo.com>
Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit is contained in:
Benjamin Vray
2021-12-20 16:52:57 +00:00
committed by qsm-odoo
co-authored by qsm-odoo
parent 9c5694e929
commit e51cdc1e60
@@ -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 => {