[IMP] web_editor: open shape selection when enabling shapes

Before this commit when toggling shapes on a snippet background, the
shape selection dropdown was shown as closed.

After this commit when toggling shapes on a snippet background, the
shape selection dropdown is automatically opened.
We have to use a click() on the toggler instead of an open() on the
dropdown to make the page containing the selected shape appear when
opening.

task-2431445
https://github.com/odoo/odoo/pull/64515
This commit is contained in:
Benoit Socias
2021-02-03 12:08:51 +00:00
parent b67084e729
commit fe44184b48
@@ -934,6 +934,14 @@ const SelectUserValueWidget = BaseSelectionUserValueWidget.extend({
this.menuTogglerEl.appendChild(this.menuTogglerItemEl);
}
},
/**
* @override
*/
enable() {
if (!this.menuTogglerEl.classList.contains('active')) {
this.menuTogglerEl.click();
}
},
//--------------------------------------------------------------------------
// Handlers
@@ -4482,6 +4490,10 @@ registry.BackgroundShape = SnippetOptionWidget.extend({
} else {
shapeToSelect = possibleShapes[1];
}
this.trigger_up('snippet_edition_request', {exec: () => {
// options for shape will only be available after _toggleShape() returned
this._requestUserValueWidgets('bg_shape_opt')[0].enable();
}});
return this._handlePreviewState(false, () => ({shape: shapeToSelect}));
}
},