Fix/cleanup.
This commit is contained in:
parent
333cc53797
commit
6e3b575fa5
@ -154,13 +154,6 @@ export interface Action {
|
|||||||
appState: AppState,
|
appState: AppState,
|
||||||
elements: readonly ExcalidrawElement[],
|
elements: readonly ExcalidrawElement[],
|
||||||
) => boolean;
|
) => boolean;
|
||||||
customPredicate?: (
|
|
||||||
elements: readonly ExcalidrawElement[],
|
|
||||||
appState: AppState,
|
|
||||||
appProps: ExcalidrawProps,
|
|
||||||
app: AppClassProperties,
|
|
||||||
data?: Record<string, any>,
|
|
||||||
) => boolean;
|
|
||||||
contextItemLabel?:
|
contextItemLabel?:
|
||||||
| string
|
| string
|
||||||
| ((
|
| ((
|
||||||
|
@ -6169,11 +6169,9 @@ class App extends React.Component<AppProps, AppState> {
|
|||||||
): ContextMenuItems => {
|
): ContextMenuItems => {
|
||||||
const options: ContextMenuItems = [];
|
const options: ContextMenuItems = [];
|
||||||
let addedCustom = false;
|
let addedCustom = false;
|
||||||
this.actionManager.getCustomActions().forEach((action) => {
|
this.actionManager.getCustomActions({ data: { source } }).forEach((action) => {
|
||||||
if (this.actionManager.isActionEnabled(action, { data: { source } })) {
|
addedCustom = true;
|
||||||
addedCustom = true;
|
options.push(action);
|
||||||
options.push(action);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
if (type === "custom") {
|
if (type === "custom") {
|
||||||
return options;
|
return options;
|
||||||
|
@ -38,8 +38,8 @@ const exampleAction: Action = {
|
|||||||
perform: (elements, appState) => {
|
perform: (elements, appState) => {
|
||||||
return { elements, appState, commitToHistory: false };
|
return { elements, appState, commitToHistory: false };
|
||||||
},
|
},
|
||||||
customPredicate: (elements, appState, appProps, app, data) =>
|
predicate: (elements, appState, appProps, app, data) =>
|
||||||
data !== undefined && data.source === "editor-current-shape",
|
data === undefined || data.source === "editor-current-shape",
|
||||||
contextItemLabel: "labels.untitled",
|
contextItemLabel: "labels.untitled",
|
||||||
};
|
};
|
||||||
const exampleEnableFn: EnableFn = (elements, appState, actionName) =>
|
const exampleEnableFn: EnableFn = (elements, appState, actionName) =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user