2021-01-28 00:41:17 +05:30
|
|
|
import { CODES, KEYS } from "../keys";
|
|
|
|
import { register } from "./register";
|
2021-02-02 20:57:22 +05:30
|
|
|
import { trackEvent } from "../analytics";
|
2021-01-28 00:41:17 +05:30
|
|
|
|
|
|
|
export const actionToggleZenMode = register({
|
|
|
|
name: "zenMode",
|
|
|
|
perform(elements, appState) {
|
2021-02-02 20:57:22 +05:30
|
|
|
trackEvent("view", "mode", "zen");
|
|
|
|
|
2021-01-28 00:41:17 +05:30
|
|
|
return {
|
|
|
|
appState: {
|
|
|
|
...appState,
|
2021-01-29 23:38:37 +05:30
|
|
|
zenModeEnabled: !this.checked!(appState),
|
2021-01-28 00:41:17 +05:30
|
|
|
},
|
|
|
|
commitToHistory: false,
|
|
|
|
};
|
|
|
|
},
|
2021-01-29 23:38:37 +05:30
|
|
|
checked: (appState) => appState.zenModeEnabled,
|
2021-01-28 00:41:17 +05:30
|
|
|
contextItemLabel: "buttons.zenMode",
|
2021-01-29 23:38:37 +05:30
|
|
|
keyTest: (event) =>
|
|
|
|
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.Z,
|
2021-01-28 00:41:17 +05:30
|
|
|
});
|