mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
* fix: pass default value for grid mode / zen mode so it sets the value from initialData appState fixes #2870 * change checked from boolean to be a function which recieves appState and returns boolean * fix * use clsx Co-authored-by: dwelle <luzar.david@gmail.com>
19 lines
516 B
TypeScript
19 lines
516 B
TypeScript
import { CODES, KEYS } from "../keys";
|
|
import { register } from "./register";
|
|
|
|
export const actionToggleZenMode = register({
|
|
name: "zenMode",
|
|
perform(elements, appState) {
|
|
return {
|
|
appState: {
|
|
...appState,
|
|
zenModeEnabled: !this.checked!(appState),
|
|
},
|
|
commitToHistory: false,
|
|
};
|
|
},
|
|
checked: (appState) => appState.zenModeEnabled,
|
|
contextItemLabel: "buttons.zenMode",
|
|
keyTest: (event) =>
|
|
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.Z,
|
|
});
|