Filter all context menu items (standard and custom) through

`isActionEnabled`.
This commit is contained in:
Daniel J. Geiger 2023-01-08 17:37:32 -06:00
parent f86d0f9102
commit 9e5948ac28

View File

@ -6240,6 +6240,19 @@ class App extends React.Component<AppProps, AppState> {
private getContextMenuItems = (
type: "canvas" | "element" | "custom",
source?: string,
): ContextMenuItems => {
const options = this._getContextMenuItems(type, source);
return options.filter(
(item) =>
!item ||
item === CONTEXT_MENU_SEPARATOR ||
this.actionManager.isActionEnabled(item, { guardsOnly: true }),
);
};
private _getContextMenuItems = (
type: "canvas" | "element" | "custom",
source?: string,
): ContextMenuItems => {
const options: ContextMenuItems = [];
this.actionManager