[FIX] web_editor: properly select the command of powerbox

Before this commit
On mobile, clicking on a powerbox item called the first command.

After this commit
On mobile, clicking on a powerbox item call the clicked item command.

task-2751059

closes odoo/odoo#88059

X-original-commit: 03638e4d46941bb4751ac2d6df8c08cb4cc2208e
Signed-off-by: Antoine Guenet <age@odoo.com>
Signed-off-by: David Monjoie (dmo) <dmo@odoo.com>
This commit is contained in:
Nicolas Bayet
2022-04-06 11:15:09 +02:00
parent 378e9de97c
commit 2cef72a970
@@ -131,7 +131,7 @@ export class Powerbox {
ev => {
ev.preventDefault();
ev.stopImmediatePropagation();
this._currentValidate();
this._currentValidate(command);
},
true,
);
@@ -254,10 +254,12 @@ export class Powerbox {
this.options.onStop && this.options.onStop();
};
this._currentValidate = async () => {
const command = this._currentFilteredCommands.find(
c => c === this._currentSelectedCommand,
);
this._currentValidate = async (command) => {
if (!command) {
command = this._currentFilteredCommands.find(
c => c === this._currentSelectedCommand,
);
}
if (command) {
!command.isIntermediateStep &&
(!command.shouldPreValidate || command.shouldPreValidate()) &&