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

We do not want users to mess with command panel in content or design
mode.
This commit is contained in:
Bogdan Chadkin authored and GitHub committed 2024-12-23 23:26:22 +07:00
1 parent fb67334790
commit e3baeec7a7
2 files changed
+13 -7

No files matched your search

@@ -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={() => {
+3 -1
View File
@@ -501,7 +501,9 @@ export const { emitCommand, subscribeCommands } = createCommandsEmitter({
hidden: true,
defaultHotkeys: ["meta+k", "ctrl+k"],
handler: () => {
openCommandPanel();
if ($isDesignMode.get()) {
openCommandPanel();
}
},
},
],