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.

feat: Reorder items in the build menu (#4484)

Ivan Starkov610f3e7048c2
diff --git a/apps/builder/app/builder/features/topbar/builder-mode.tsx b/apps/builder/app/builder/features/topbar/builder-mode.tsx
index 171042d6ab..4ee88bb254 100644
--- a/apps/builder/app/builder/features/topbar/builder-mode.tsx
+++ b/apps/builder/app/builder/features/topbar/builder-mode.tsx
@@ -45,13 +45,6 @@ export const BuilderModeDropDown = () => {
const isDesignModeAllowed = useStore($isDesignModeAllowed);
const menuItems = {
- preview: {
- icon: <PlayIcon />,
- description: "View the page as it will appear to users",
- title: "Preview",
- shortcut: ["cmd", "shift", "p"],
- enabled: true,
- },
design: {
icon: <PaintBrushIcon />,
description: "Edit components, styles, and properties",
@@ -66,6 +59,13 @@ export const BuilderModeDropDown = () => {
shortcut: ["cmd", "shift", "b"],
enabled: isContentModeAllowed,
},
+ preview: {
+ icon: <PlayIcon />,
+ description: "View the page as it will appear to users",
+ title: "Preview",
+ shortcut: ["cmd", "shift", "p"],
+ enabled: true,
+ },
} as const;
const [activeMode, setActiveMode] = useState<BuilderMode | undefined>();
@@ -125,6 +125,7 @@ export const BuilderModeDropDown = () => {
<DropdownMenuItemRightSlot>
<Kbd value={shortcut} />
</DropdownMenuItemRightSlot>
+ &nbsp;
</StyledMenuItem>
))}
</DropdownMenuRadioGroup>
diff --git a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx
index 241cdb5a4c..9759922701 100644
--- a/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx
+++ b/apps/builder/app/canvas/features/webstudio-component/webstudio-component.tsx
@@ -569,7 +569,16 @@ export const WebstudioComponentPreview = forwardRef<
return <></>;
}
- const Component = components.get(instance.component);
+ let Component = components.get(instance.component);
+
+ if (instance.component === editableBlockComponent) {
+ Component = EditableBlock;
+ }
+
+ if (instance.component === editableBlockTemplateComponent) {
+ Component = EditableBlockTemplate;
+ }
+
if (Component === undefined) {
return <></>;
}
diff --git a/apps/builder/app/shared/nano-states/misc.ts b/apps/builder/app/shared/nano-states/misc.ts
index c87f7e62ba..6fee229467 100644
--- a/apps/builder/app/shared/nano-states/misc.ts
+++ b/apps/builder/app/shared/nano-states/misc.ts
@@ -387,8 +387,6 @@ export const toggleBuilderMode = (mode: BuilderMode) => {
};
export const setBuilderMode = (mode: BuilderMode | null) => {
- const authPermit = $authPermit.get();
-
if (mode === "content" && !$isContentModeAllowed.get()) {
// This is content link from a non pro user, we don't allow content mode for such links
toast.info(
@@ -406,11 +404,6 @@ export const setBuilderMode = (mode: BuilderMode | null) => {
return;
}
- if (authPermit === "view") {
- $builderMode.set(mode ?? "preview");
- return;
- }
-
const defaultMode = $isDesignModeAllowed.get()
? "design"
: $isContentModeAllowed.get()