[FIX] web_editor: fix moving inner content in carousel slides

Before this commit, when moving inner content inside a carousel slide
(with the 'move' button), the carousel was jumping to the first slide.

Steps to reproduce the bug:

- In website edit mode, drag and drop a Carousel snippet onto the page.
- Move to the second slide.
- Click on the column to activate its overlay.
- Click and hold the "drag and drop" button of the column to start
dragging it.
- Release the mouse button.
- Bug: the carousel jumps to the first slide.

task-3006831

closes odoo/odoo#114067

X-original-commit: a09031d5f68de5d23bd9cab1910c6f9c50ad7cfd
Signed-off-by: Benoit Socias (bso) <bso@odoo.com>
This commit is contained in:
Benjamin Vray
2023-03-02 09:11:23 +01:00
parent 415390d5e0
commit ceb68cc600
@@ -3641,11 +3641,14 @@ var SnippetsMenu = Widget.extend({
*/
_onSnippetDragAndDropStop: async function (ev) {
this.snippetEditorDragging = false;
const $modal = ev.data.$snippet.closest('.modal');
const modalEl = ev.data.$snippet[0].closest('.modal');
const carouselItemEl = ev.data.$snippet[0].closest('.carousel-item');
// If the snippet is in a modal, destroy editors only in that modal.
// This to prevent the modal from closing because of the cleanForSave
// on each editors.
await this._destroyEditors($modal.length ? $modal : null);
// on each editors. Same thing for 'carousel-item', otherwise all the
// editors of the 'carousel' are destroyed and the 'carousel' jumps to
// first slide.
await this._destroyEditors(carouselItemEl ? $(carouselItemEl) : modalEl ? $(modalEl) : null);
await this._activateSnippet(ev.data.$snippet);
},
/**