From 9e5948ac28f2be6b96416695727039eccbb8c3d2 Mon Sep 17 00:00:00 2001 From: "Daniel J. Geiger" <1852529+DanielJGeiger@users.noreply.github.com> Date: Sun, 8 Jan 2023 17:37:32 -0600 Subject: [PATCH] Filter all context menu items (standard and custom) through `isActionEnabled`. --- src/components/App.tsx | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/components/App.tsx b/src/components/App.tsx index a7fda3f5e..ea706f66a 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -6240,6 +6240,19 @@ class App extends React.Component { 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