diff --git a/.gitignore b/.gitignore index 8a775d78..bf453146 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,10 @@ -.DS_Store -.vscode *.log +.DS_Store +.envrc +.now +.vscode build +firebase/ logs node_modules npm-debug.log* @@ -9,5 +12,3 @@ static yarn-debug.log* yarn-error.log* yarn.lock -.envrc -firebase/ diff --git a/src/actions/actionMenu.tsx b/src/actions/actionMenu.tsx index 3db133e6..844e951f 100644 --- a/src/actions/actionMenu.tsx +++ b/src/actions/actionMenu.tsx @@ -4,6 +4,8 @@ import { ToolButton } from "../components/ToolButton"; import { t } from "../i18n"; import { showSelectedShapeActions } from "../element"; import { register } from "./register"; +import { allowFullScreen, exitFullScreen, isFullScreen } from "../utils"; +import { KEYS } from "../keys"; export const actionToggleCanvasMenu = register({ name: "toggleCanvasMenu", @@ -45,3 +47,19 @@ export const actionToggleEditMenu = register({ /> ), }); + +export const actionFullScreen = register({ + name: "toggleFullScreen", + perform: () => { + if (!isFullScreen()) { + allowFullScreen(); + } + if (isFullScreen()) { + exitFullScreen(); + } + return { + commitToHistory: false, + }; + }, + keyTest: (event) => event.keyCode === KEYS.F_KEY_CODE, +}); diff --git a/src/actions/index.ts b/src/actions/index.ts index e9dcf88f..7680cbdf 100644 --- a/src/actions/index.ts +++ b/src/actions/index.ts @@ -36,4 +36,8 @@ export { } from "./actionExport"; export { actionCopyStyles, actionPasteStyles } from "./actionStyles"; -export { actionToggleCanvasMenu, actionToggleEditMenu } from "./actionMenu"; +export { + actionToggleCanvasMenu, + actionToggleEditMenu, + actionFullScreen, +} from "./actionMenu"; diff --git a/src/actions/types.ts b/src/actions/types.ts index d95c0c94..786477bd 100644 --- a/src/actions/types.ts +++ b/src/actions/types.ts @@ -48,7 +48,8 @@ export type ActionName = | "zoomIn" | "zoomOut" | "resetZoom" - | "changeFontFamily"; + | "changeFontFamily" + | "toggleFullScreen"; export interface Action { name: ActionName; diff --git a/src/components/ShortcutsDialog.tsx b/src/components/ShortcutsDialog.tsx index 7854625c..fa1727f1 100644 --- a/src/components/ShortcutsDialog.tsx +++ b/src/components/ShortcutsDialog.tsx @@ -219,6 +219,7 @@ export const ShortcutsDialog = ({ onClose }: { onClose?: () => void }) => { title={t("buttons.resetZoom")} shortcuts={[getShortcutKey("CtrlOrCmd+0", "")]} /> +