excalidraw/src/actions/actionToggleStats.tsx
Gurkiran Singh bec34f2d57
feat: Shortcut key for nerd stats (#3552)
* added alt+/ as the shortcut key for nerd stats

Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>

* added shortcut info in HelpDialog.ts

Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>

* resolved conflicts

Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>

* added shortcut info in HelpDialog.ts

Signed-off-by: gurkiran_singh <gurkiransinghk@gmail.com>
2021-05-12 14:27:35 +05:30

20 lines
502 B
TypeScript

import { register } from "./register";
import { CODES, KEYS } from "../keys";
export const actionToggleStats = register({
name: "stats",
perform(elements, appState) {
return {
appState: {
...appState,
showStats: !this.checked!(appState),
},
commitToHistory: false,
};
},
checked: (appState) => appState.showStats,
contextItemLabel: "stats.title",
keyTest: (event) =>
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.SLASH,
});