From 156cd55c4d852b8f38df8e255033822bd41ffc77 Mon Sep 17 00:00:00 2001 From: Benjamin Vray Date: Thu, 19 Nov 2020 15:30:09 +0000 Subject: [PATCH] [FIX] web_editor: fix drag and drop a snippet in a modal When a modal is open, allow the drop of a snippet only in this modal. Part of https://github.com/odoo/odoo/pull/61998 task-2312878 X-original-commit: 2f38816f279717bca38166a22c4f692a7f1d10c0 --- 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 2a4abac75d1..f6caffba3d3 100644 --- a/addons/web_editor/static/src/js/editor/snippets.editor.js +++ b/addons/web_editor/static/src/js/editor/snippets.editor.js @@ -1256,6 +1256,13 @@ var SnippetsMenu = Widget.extend({ _activateInsertionZones: function ($selectorSiblings, $selectorChildren) { var self = this; + // If a modal is open, the drop zones must be created only in this modal + const $openModal = self.getEditableArea().find('.modal:visible'); + if ($openModal.length) { + $selectorSiblings = $openModal.find($selectorSiblings); + $selectorChildren = $openModal.find($selectorChildren); + } + // Check if the drop zone should be horizontal or vertical function setDropZoneDirection($elem, $parent, $sibling) { var vertical = false;