Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
use +- keys for zoom without cmd
Oleg Isonena9e4c0e41f2c
diff --git a/apps/designer/app/designer/features/breakpoints/use-subscribe-shortcuts.ts b/apps/designer/app/designer/features/breakpoints/use-subscribe-shortcuts.tsindex 48f4ef9a87..3860a6ac6b 100644--- a/apps/designer/app/designer/features/breakpoints/use-subscribe-shortcuts.ts+++ b/apps/designer/app/designer/features/breakpoints/use-subscribe-shortcuts.ts@@ -3,8 +3,6 @@ import { useBreakpoints } from "~/shared/nano-states";import { useZoom, useSelectedBreakpoint } from "../../shared/nano-states";import { minZoom } from "./zoom-setting";import { utils } from "@webstudio-is/project";-import { shortcuts } from "~/shared/shortcuts";-import { useHotkeys } from "react-hotkeys-hook";export const useSubscribeSelectBreakpointFromShortcut = () => {const [breakpoints] = useBreakpoints();@@ -22,16 +20,6 @@ const zoomStep = 20;export const useSubscribeZoomFromShortcut = () => {const [zoom, setZoom] = useZoom();- // We need to prevent browser default behavior for zooming in/out- // Maybe we should use shift modifier and keep the default behaivor functional?- useHotkeys(- shortcuts.zoom,- (event) => {- event.preventDefault();- },- []- );-useSubscribe("zoom", (direction) => {if (direction === "zoomIn") {setZoom(Math.min(zoom + zoomStep, 100));diff --git a/apps/designer/app/designer/features/topbar/menu/menu.tsx b/apps/designer/app/designer/features/topbar/menu/menu.tsxindex 92cb31284d..b2c07f7690 100644--- a/apps/designer/app/designer/features/topbar/menu/menu.tsx+++ b/apps/designer/app/designer/features/topbar/menu/menu.tsx@@ -226,7 +226,7 @@ export const Menu = ({ publish }: MenuProps) => {}}>Zoom in- <ShortcutHint value={["cmd", "+"]} />+ <ShortcutHint value={["+"]} /></DropdownMenuItem><DropdownMenuItemcss={menuItemCss}@@ -238,7 +238,7 @@ export const Menu = ({ publish }: MenuProps) => {}}>Zoom out- <ShortcutHint value={["cmd", "-"]} />+ <ShortcutHint value={["-"]} /></DropdownMenuItem><DropdownMenuSeparator /><ThemeMenuItem />diff --git a/apps/designer/app/shared/shortcuts/index.ts b/apps/designer/app/shared/shortcuts/index.tsindex 641924af95..499b146ee7 100644--- a/apps/designer/app/shared/shortcuts/index.ts+++ b/apps/designer/app/shared/shortcuts/index.ts@@ -1,14 +1 @@-export const shortcuts = {- esc: "esc",- undo: "cmd+z, ctrl+z",- redo: "cmd+shift+z, ctrl+shift+z",- preview: "cmd+shift+p, ctrl+shift+p",- delete: "backspace, delete",- breakpointsMenu: "cmd+b, ctrl+b",- breakpoint: Array.from(new Array(9))- .map((_, index) => `cmd+${index + 1}, ctrl+${index + 1}`)- .join(", "),- zoom: "cmd+=, ctrl+=, cmd+-, ctrl+-",-} as const;--export const options = { splitKey: "+", keydown: true };+export * from "./shortcuts";diff --git a/apps/designer/app/shared/shortcuts/shortcuts.ts b/apps/designer/app/shared/shortcuts/shortcuts.tsnew file mode 100644index 0000000000..860701ee72--- /dev/null+++ b/apps/designer/app/shared/shortcuts/shortcuts.ts@@ -0,0 +1,14 @@+export const shortcuts = {+ esc: "esc",+ undo: "cmd+z, ctrl+z",+ redo: "cmd+shift+z, ctrl+shift+z",+ preview: "cmd+shift+p, ctrl+shift+p",+ delete: "backspace, delete",+ breakpointsMenu: "cmd+b, ctrl+b",+ breakpoint: Array.from(new Array(9))+ .map((_, index) => `cmd+${index + 1}, ctrl+${index + 1}`)+ .join(", "),+ zoom: "=, -",+} as const;++export const options = { splitKey: "+", keydown: true };