mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Filter all context menu items (standard and custom) through
`isActionEnabled`.
This commit is contained in:
parent
f86d0f9102
commit
9e5948ac28
1 changed files with 13 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue