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.

fix: support command panel only in design mode (#4624)

Bogdan Chadkine3baeec7a729
diff --git a/apps/builder/app/builder/features/topbar/menu/menu.tsx b/apps/builder/app/builder/features/topbar/menu/menu.tsx
index 44e8ced868..fc4e36df47 100644
--- a/apps/builder/app/builder/features/topbar/menu/menu.tsx
+++ b/apps/builder/app/builder/features/topbar/menu/menu.tsx
@@ -25,6 +25,7 @@ import {
$authPermit,
$authToken,
$authTokenPermissions,
+ $isDesignMode,
$userPlanFeatures,
} from "~/shared/nano-states";
import { emitCommand } from "~/builder/shared/commands";
@@ -60,6 +61,7 @@ export const Menu = () => {
const authPermit = useStore($authPermit);
const authTokenPermission = useStore($authTokenPermissions);
const authToken = useStore($authToken);
+ const isDesignMode = useStore($isDesignMode);
const isPublishEnabled = authPermit === "own" || authPermit === "admin";
@@ -240,12 +242,14 @@ export const Menu = () => {
<DropdownMenuSeparator />
- <DropdownMenuItem onSelect={() => emitCommand("openCommandPanel")}>
- Search & Commands
- <DropdownMenuItemRightSlot>
- <Kbd value={["cmd", "k"]} />
- </DropdownMenuItemRightSlot>
- </DropdownMenuItem>
+ {isDesignMode && (
+ <DropdownMenuItem onSelect={() => emitCommand("openCommandPanel")}>
+ Search & Commands
+ <DropdownMenuItemRightSlot>
+ <Kbd value={["cmd", "k"]} />
+ </DropdownMenuItemRightSlot>
+ </DropdownMenuItem>
+ )}
<DropdownMenuItem
onSelect={() => {
diff --git a/apps/builder/app/builder/shared/commands.ts b/apps/builder/app/builder/shared/commands.ts
index 66d6369ad3..62da330cc2 100644
--- a/apps/builder/app/builder/shared/commands.ts
+++ b/apps/builder/app/builder/shared/commands.ts
@@ -501,7 +501,9 @@ export const { emitCommand, subscribeCommands } = createCommandsEmitter({
hidden: true,
defaultHotkeys: ["meta+k", "ctrl+k"],
handler: () => {
- openCommandPanel();
+ if ($isDesignMode.get()) {
+ openCommandPanel();
+ }
},
},
],