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.

address minor review comment

Roman Pominov6296b6f78547
diff --git a/apps/designer/app/canvas/shared/use-drag-drop.ts b/apps/designer/app/canvas/shared/use-drag-drop.ts
index d4243a9229..4b8a79e52a 100644
--- a/apps/designer/app/canvas/shared/use-drag-drop.ts
+++ b/apps/designer/app/canvas/shared/use-drag-drop.ts
@@ -19,7 +19,7 @@ import {
publish,
useSubscribe,
type Instance,
- components as primitives,
+ components,
BaseInstance,
toBaseInstance,
} from "@webstudio-is/react-sdk";
@@ -104,7 +104,7 @@ export const useDragAndDrop = () => {
}
const data = path.find((instance) =>
- primitives[instance.component].canAcceptChild()
+ components[instance.component].canAcceptChild()
);
if (!data) {
diff --git a/apps/designer/app/canvas/shared/use-shortcuts.ts b/apps/designer/app/canvas/shared/use-shortcuts.ts
index fe5703cb1d..21e47c0955 100644
--- a/apps/designer/app/canvas/shared/use-shortcuts.ts
+++ b/apps/designer/app/canvas/shared/use-shortcuts.ts
@@ -79,7 +79,7 @@ export const useShortcuts = () => {
breakpointsMenu: publishOpenBreakpointsMenu,
breakpoint: publishSelectBreakpoint,
zoom: publishZoom,
- cancel: publishCancelCurrentDrag,
+ esc: publishCancelCurrentDrag,
} as const;
useHotkeys(
@@ -140,7 +140,7 @@ export const useShortcuts = () => {
[]
);
- useHotkeys(shortcuts.cancel, shortcutHandlerMap.cancel, options, []);
+ useHotkeys(shortcuts.esc, shortcutHandlerMap.esc, options, []);
// Shortcuts from the parent window
useSubscribe<"shortcut", { name: keyof typeof shortcuts; key: string }>(
diff --git a/apps/designer/app/shared/shortcuts/index.ts b/apps/designer/app/shared/shortcuts/index.ts
index cd51bf6fb8..cb4d00ea41 100644
--- a/apps/designer/app/shared/shortcuts/index.ts
+++ b/apps/designer/app/shared/shortcuts/index.ts
@@ -1,5 +1,5 @@
export const shortcuts = {
- cancel: "esc",
+ esc: "esc",
undo: "cmd+z, ctrl+z",
redo: "cmd+shift+z, ctrl+shift+z",
preview: "cmd+shift+p, ctrl+shift+p",
diff --git a/packages/design-system/src/components/primitives/dnd/canvas.stories.tsx b/packages/design-system/src/components/primitives/dnd/canvas.stories.tsx
index f5695ba47d..f5bc7d7807 100644
--- a/packages/design-system/src/components/primitives/dnd/canvas.stories.tsx
+++ b/packages/design-system/src/components/primitives/dnd/canvas.stories.tsx
@@ -193,7 +193,7 @@ export const Canvas = () => {
const getDefaultDropTarget = () => {
if (rootRef.current === null) {
- throw new Error("should not happen");
+ throw new Error("Unexpected empty rootRef during drag");
}
return { data: ROOT_ID, element: rootRef.current };
};
diff --git a/packages/design-system/src/components/primitives/dnd/placement-indicator.tsx b/packages/design-system/src/components/primitives/dnd/placement-indicator.tsx
index e533a61f75..ef9df206a6 100644
--- a/packages/design-system/src/components/primitives/dnd/placement-indicator.tsx
+++ b/packages/design-system/src/components/primitives/dnd/placement-indicator.tsx
@@ -8,21 +8,23 @@ const placementStyle = {
pointerEvents: "none",
};
-export const PlacementIndicator = ({ placement }: { placement: Placement }) => {
- const style =
- placement.direction === "horizontal"
- ? {
- top: placement.y - 1,
- left: placement.x,
- width: placement.length,
- height: 2,
- }
- : {
- top: placement.y,
- left: placement.x - 1,
- width: 2,
- height: placement.length,
- };
+const getStyle = (placement: Placement) => {
+ if (placement.direction === "horizontal") {
+ return {
+ top: placement.y - 1,
+ left: placement.x,
+ width: placement.length,
+ height: 2,
+ };
+ }
+ return {
+ top: placement.y,
+ left: placement.x - 1,
+ width: 2,
+ height: placement.length,
+ };
+};
- return <Box style={style} css={placementStyle} />;
+export const PlacementIndicator = ({ placement }: { placement: Placement }) => {
+ return <Box style={getStyle(placement)} css={placementStyle} />;
};
diff --git a/packages/design-system/src/components/primitives/dnd/sortable-list.stories.tsx b/packages/design-system/src/components/primitives/dnd/sortable-list.stories.tsx
index b1ad53dab9..09a842b832 100644
--- a/packages/design-system/src/components/primitives/dnd/sortable-list.stories.tsx
+++ b/packages/design-system/src/components/primitives/dnd/sortable-list.stories.tsx
@@ -79,7 +79,7 @@ export const SortableList = ({
}
if (rootRef.current === null) {
- throw new Error("should not happen");
+ throw new Error("Unexpected empty rootRef during drag");
}
return { data: true, element: rootRef.current };