Prevent command menu backspace shortcut on V1 (#10555)
Before: https://github.com/user-attachments/assets/87be65fa-4b24-4e15-b0a4-ca1aa06f5ca6 After: https://github.com/user-attachments/assets/ef9076a0-214f-4680-a455-157a206e8197
This commit is contained in:
@ -8,9 +8,11 @@ import { useKeyboardShortcutMenu } from '@/keyboard-shortcut-menu/hooks/useKeybo
|
|||||||
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
import { useScopedHotkeys } from '@/ui/utilities/hotkey/hooks/useScopedHotkeys';
|
||||||
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
|
import { AppHotkeyScope } from '@/ui/utilities/hotkey/types/AppHotkeyScope';
|
||||||
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
import { useRecoilComponentValueV2 } from '@/ui/utilities/state/component-state/hooks/useRecoilComponentValueV2';
|
||||||
|
import { useIsFeatureEnabled } from '@/workspace/hooks/useIsFeatureEnabled';
|
||||||
import { isNonEmptyString } from '@sniptt/guards';
|
import { isNonEmptyString } from '@sniptt/guards';
|
||||||
import { useRecoilValue } from 'recoil';
|
import { useRecoilValue } from 'recoil';
|
||||||
import { Key } from 'ts-key-enum';
|
import { Key } from 'ts-key-enum';
|
||||||
|
import { FeatureFlagKey } from '~/generated-metadata/graphql';
|
||||||
|
|
||||||
export const useCommandMenuHotKeys = () => {
|
export const useCommandMenuHotKeys = () => {
|
||||||
const {
|
const {
|
||||||
@ -31,6 +33,10 @@ export const useCommandMenuHotKeys = () => {
|
|||||||
COMMAND_MENU_COMPONENT_INSTANCE_ID,
|
COMMAND_MENU_COMPONENT_INSTANCE_ID,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const isCommandMenuV2Enabled = useIsFeatureEnabled(
|
||||||
|
FeatureFlagKey.IsCommandMenuV2Enabled,
|
||||||
|
);
|
||||||
|
|
||||||
useScopedHotkeys(
|
useScopedHotkeys(
|
||||||
'ctrl+k,meta+k',
|
'ctrl+k,meta+k',
|
||||||
() => {
|
() => {
|
||||||
@ -65,7 +71,7 @@ export const useCommandMenuHotKeys = () => {
|
|||||||
useScopedHotkeys(
|
useScopedHotkeys(
|
||||||
[Key.Backspace, Key.Delete],
|
[Key.Backspace, Key.Delete],
|
||||||
() => {
|
() => {
|
||||||
if (isNonEmptyString(commandMenuSearch)) {
|
if (isNonEmptyString(commandMenuSearch) || !isCommandMenuV2Enabled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user