mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Make filtering of custom actions optional.
This commit is contained in:
parent
9e5948ac28
commit
ddc393bd9d
2 changed files with 20 additions and 14 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue