Make filtering of custom actions optional.

This commit is contained in:
Daniel J. Geiger 2023-01-08 19:30:01 -06:00
parent 9e5948ac28
commit ddc393bd9d
2 changed files with 20 additions and 14 deletions

View file

@ -117,10 +117,16 @@ export class ActionManager {
if (this === undefined) {
return [];
}
const filter =
opts !== undefined &&
("elements" in opts || "data" in opts || "guardsOnly" in opts);
const customActions: Action[] = [];
for (const key in this.actions) {
const action = this.actions[key];
if (!isActionName(action.name) && this.isActionEnabled(action, opts)) {
if (
!isActionName(action.name) &&
(!filter || this.isActionEnabled(action, opts))
) {
customActions.push(action);
}
}