Skip to content

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.

set minWidth to 360 for the canvas resize and use the lower bound of the media query

Oleg Isonenb0b143a76a2e
diff --git a/apps/designer/app/designer/features/breakpoints/use-update-canvas-width.ts b/apps/designer/app/designer/features/breakpoints/use-update-canvas-width.ts
index 704cfd8bc1..b716f9154b 100644
--- a/apps/designer/app/designer/features/breakpoints/use-update-canvas-width.ts
+++ b/apps/designer/app/designer/features/breakpoints/use-update-canvas-width.ts
@@ -4,14 +4,12 @@ import {
useCanvasWidth,
} from "~/designer/shared/nano-states";
import { useIsPreviewMode } from "~/shared/nano-states";
-import { useNextBreakpoint } from "./use-next-breakpoint";
import { minWidth } from "./width-setting";
export const useUpdateCanvasWidth = () => {
const [selectedBreakpoint] = useSelectedBreakpoint();
const [canvasWidth, setCanvasWidth] = useCanvasWidth();
const [isPreviewMode] = useIsPreviewMode();
- const nextBreakpoint = useNextBreakpoint();
// Ensure the size is within currently selected breakpoint when returning to design mode out of preview mode,
// because preview mode enables resizing without constraining to the selected breakpoint.
@@ -19,11 +17,8 @@ export const useUpdateCanvasWidth = () => {
if (isPreviewMode || selectedBreakpoint === undefined) {
return;
}
- const nextWidth = nextBreakpoint
- ? nextBreakpoint.minWidth - 1
- : selectedBreakpoint.minWidth;
- setCanvasWidth(Math.max(nextWidth, minWidth));
- }, [isPreviewMode, nextBreakpoint, selectedBreakpoint, setCanvasWidth]);
+ setCanvasWidth(Math.max(selectedBreakpoint.minWidth, minWidth));
+ }, [isPreviewMode, selectedBreakpoint, setCanvasWidth]);
// This fallback is needed for cases when something unexpected loads in the iframe.
// In that case the width remains 0, and user is unable to see what has loaded,
diff --git a/apps/designer/app/designer/features/breakpoints/width-setting.tsx b/apps/designer/app/designer/features/breakpoints/width-setting.tsx
index 20e3722a4b..7339fbe48a 100644
--- a/apps/designer/app/designer/features/breakpoints/width-setting.tsx
+++ b/apps/designer/app/designer/features/breakpoints/width-setting.tsx
@@ -7,7 +7,7 @@ import { useIsPreviewMode } from "~/shared/nano-states";
import { useNextBreakpoint } from "./use-next-breakpoint";
// Doesn't make sense to allow resizing the canvas lower/higher than this.
-export const minWidth = 50;
+export const minWidth = 360;
export const maxWidth = 3000;
export const WidthSetting = () => {