[FIX] web_editor: correctly move snippets on a popup
Inside a scrollable popup, the scroll was not correctly triggered when moving one of its snippets through drag and drop. This commit correctly defines the SmoothScrollOnDrag.$scrollTarget when a modal is shown. task-2431469 closes odoo/odoo#82040 X-original-commit: 844051168311ac0c3e8640dda2a90545e373c98d Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Co-authored-by: qsm-odoo <qsm@odoo.com>
This commit is contained in:
committed by
qsm-odoo
co-authored by
qsm-odoo
parent
062ad4d998
commit
116afad9fa
@@ -214,7 +214,9 @@ var SnippetEditor = Widget.extend({
|
||||
},
|
||||
},
|
||||
});
|
||||
const $scrollable = (this.options.wysiwyg.snippetsMenu && this.options.wysiwyg.snippetsMenu.$scrollable)
|
||||
const modalAncestorEl = this.$target[0].closest('.modal');
|
||||
const $scrollable = modalAncestorEl && $(modalAncestorEl)
|
||||
|| (this.options.wysiwyg.snippetsMenu && this.options.wysiwyg.snippetsMenu.$scrollable)
|
||||
|| (this.$scrollingElement.length && this.$scrollingElement)
|
||||
|| $().getScrollingElement(this.ownerDocument);
|
||||
this.draggableComponent = new SmoothScrollOnDrag(this, this.$el, $scrollable, smoothScrollOptions);
|
||||
@@ -905,12 +907,6 @@ var SnippetEditor = Widget.extend({
|
||||
},
|
||||
});
|
||||
|
||||
// If a modal is open, the scroll target must be that modal
|
||||
const $openModal = self.$editable.find('.modal:visible');
|
||||
if ($openModal.length) {
|
||||
self.draggableComponent.$scrollTarget = $openModal;
|
||||
}
|
||||
|
||||
// Trigger a scroll on the draggable element so that jQuery updates
|
||||
// the position of the drop zones.
|
||||
self.draggableComponent.$scrollTarget.on('scroll.scrolling_element', function () {
|
||||
|
||||
Reference in New Issue
Block a user