excalidraw/src/actions/actionSelectAll.ts

19 lines
462 B
TypeScript
Raw Normal View History

2020-01-19 13:21:33 -08:00
import { KEYS } from "../keys";
import { register } from "./register";
export const actionSelectAll = register({
name: "selectAll",
perform: (elements, appState) => {
return {
appState: {
...appState,
selectedElementIds: Object.fromEntries(
elements.map(element => [element.id, true]),
),
},
};
},
contextItemLabel: "labels.selectAll",
keyTest: event => event[KEYS.META] && event.key === "a",
});