[FIX] web_editor: fix picking a shape when sibling has the last one
Commit [1] introduced the shape system. This system was able to chain shapes depending on the shape of the previous sibling element. Unfortunately, if the shape selected on the sibling was the last shape available, clicking on the toggle shape button would result in nothing happening. This commit fixes that by defaulting to the first shape if no possible shapes are given by the sibling. [1]: https://github.com/odoo/odoo/commit/b84e0af742c51b88b4c108ebec2d0c7fff4b7483 opw-3082292 closes odoo/odoo#108017 X-original-commit: 9bdd8faea9f0126305856a40b3215589e6b3e610 Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com> Signed-off-by: Arthur Detroux (ard) <ard@odoo.com>
This commit is contained in:
@@ -6991,7 +6991,12 @@ registry.BackgroundShape = SnippetOptionWidget.extend({
|
||||
shapeToSelect = possibleShapes.find((shape, i) => {
|
||||
return possibleShapes[i - 1] === previousShape;
|
||||
});
|
||||
} else {
|
||||
}
|
||||
// If there is no previous sibling, if the previous sibling had the
|
||||
// last shape selected or if the previous shape could not be found
|
||||
// in the possible shapes, default to the first shape. ([0] being no
|
||||
// shapes selected.)
|
||||
if (!shapeToSelect) {
|
||||
shapeToSelect = possibleShapes[1];
|
||||
}
|
||||
this.trigger_up('snippet_edition_request', {exec: () => {
|
||||
|
||||
Reference in New Issue
Block a user