[FIX] website: ignore carousel slides for history step

When you drop a block containing a carousel, you can change the slide.
Unfortunately, in edit mode, changing the slide creates a step in the
history (you slide in the other direction by pressing CTRL-Z). This is
not what you want.

task-3356629

closes odoo/odoo#130417

X-original-commit: 5c68489c4220fe50c26168f2fb98546626b36e78
Signed-off-by: Colin Louis (loco) <loco@odoo.com>
Signed-off-by: Guillaume Dieleman (gdi) <gdi@odoo.com>
This commit is contained in:
Guillaume (gdi)
2023-08-02 06:18:43 +02:00
parent 029a1ab2cc
commit ca10ad3c2a
@@ -459,6 +459,15 @@ registry.slider = publicWidget.Widget.extend({
// Initialize carousel and pause if in edit mode.
this.$el.carousel(this.editableMode ? 'pause' : undefined);
$(window).on('resize.slider', debounce(() => this._computeHeights(), 250));
if (this.editableMode) {
// Prevent carousel slide to be an history step.
this.$el.on("slide.bs.carousel", () => {
this.options.wysiwyg.odooEditor.observerUnactive();
});
this.$el.on("slid.bs.carousel", () => {
this.options.wysiwyg.odooEditor.observerActive();
});
}
return this._super.apply(this, arguments);
},
/**
@@ -475,6 +484,7 @@ registry.slider = publicWidget.Widget.extend({
$(el).css("min-height", "");
});
$(window).off('.slider');
this.$target.off('.carousel');
},
//--------------------------------------------------------------------------