mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-22 00:41:09 +02:00
Filter all context menu items (standard and custom) through
`isActionEnabled`.
This commit is contained in:
@@ -6240,6 +6240,19 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
private getContextMenuItems = (
|
private getContextMenuItems = (
|
||||||
type: "canvas" | "element" | "custom",
|
type: "canvas" | "element" | "custom",
|
||||||
source?: string,
|
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 => {
|
): ContextMenuItems => {
|
||||||
const options: ContextMenuItems = [];
|
const options: ContextMenuItems = [];
|
||||||
this.actionManager
|
this.actionManager
|
||||||
|
Reference in New Issue
Block a user