excalidraw/src/actions/actionDeleteSelected.tsx

17 lines
531 B
TypeScript
Raw Normal View History

import { Action } from "./types";
import { deleteSelectedElements } from "../scene";
import { KEYS } from "../keys";
export const actionDeleteSelected: Action = {
name: "deleteSelectedElements",
perform: (elements, appState) => {
return {
2020-01-24 12:04:54 +02:00
elements: deleteSelectedElements(elements),
appState: { ...appState, elementType: "selection", multiElement: null },
};
},
contextItemLabel: "labels.delete",
contextMenuOrder: 3,
2020-01-24 12:04:54 +02:00
keyTest: event => event.key === KEYS.BACKSPACE || event.key === KEYS.DELETE,
};