[FIX] web_editor: display drop zones only on dropdowns when shown
It was painful to add an inline snippets, or move elements inside mega menus. The dropdowns are now behaving as modals: if they are shown, the user can only add or move snippets inside them, but not outside. task-2668908 closes odoo/odoo#80757 X-original-commit: edc5c8d69fb5fc6da0b0012abc6539c21ffc421e Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -1568,11 +1568,16 @@ 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);
|
||||
// If a modal or a dropdown is open, the drop zones must be created
|
||||
// only in this element.
|
||||
const $editableArea = self.getEditableArea();
|
||||
let $open = $editableArea.find('.modal:visible');
|
||||
if (!$open.length) {
|
||||
$open = $editableArea.find('.dropdown-menu.show').addBack('.dropdown-menu.show').parent();
|
||||
}
|
||||
if ($open.length) {
|
||||
$selectorSiblings = $open.find($selectorSiblings);
|
||||
$selectorChildren = $open.find($selectorChildren);
|
||||
}
|
||||
|
||||
// Check if the drop zone should be horizontal or vertical
|
||||
|
||||
Reference in New Issue
Block a user