mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-09-24 01:40:41 +02:00

* feat: decouple package deps and introduce yarn workspaces * update root directory * fix * fix scripts * fix lint * update path in scripts * remove yarn.lock files from packages * ignore workspace * dummy * dummy * remove comment check * revert workflow changes * ignore ws when installing gh actions * remove log * update path * fix * fix typo
28 lines
753 B
TypeScript
28 lines
753 B
TypeScript
import { CODES, KEYS } from "../keys";
|
|
import { register } from "./register";
|
|
|
|
export const actionToggleViewMode = register({
|
|
name: "viewMode",
|
|
viewMode: true,
|
|
trackEvent: {
|
|
category: "canvas",
|
|
predicate: (appState) => !appState.viewModeEnabled,
|
|
},
|
|
perform(elements, appState) {
|
|
return {
|
|
appState: {
|
|
...appState,
|
|
viewModeEnabled: !this.checked!(appState),
|
|
},
|
|
commitToHistory: false,
|
|
};
|
|
},
|
|
checked: (appState) => appState.viewModeEnabled,
|
|
predicate: (elements, appState, appProps) => {
|
|
return typeof appProps.viewModeEnabled === "undefined";
|
|
},
|
|
contextItemLabel: "labels.viewMode",
|
|
keyTest: (event) =>
|
|
!event[KEYS.CTRL_OR_CMD] && event.altKey && event.code === CODES.R,
|
|
});
|