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