excalidraw/src/actions/actionSelectAll.ts

20 lines
498 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,
2020-03-13 15:10:24 +01:00
selectedElementIds: elements.reduce((map, element) => {
map[element.id] = true;
return map;
}, {} as any),
},
};
},
contextItemLabel: "labels.selectAll",
keyTest: event => event[KEYS.CTRL_OR_CMD] && event.key === "a",
});