259 add navigation hotkeys for command menu level 2 (#10043)
Closes https://github.com/twentyhq/core-team-issues/issues/259 https://github.com/user-attachments/assets/abdcb44d-fc13-4597-befc-da99c94c1ef0
This commit is contained in:
@ -13,9 +13,9 @@ import { Key } from 'ts-key-enum';
|
|||||||
|
|
||||||
export const useCommandMenuHotKeys = () => {
|
export const useCommandMenuHotKeys = () => {
|
||||||
const {
|
const {
|
||||||
closeCommandMenu,
|
|
||||||
openRecordsSearchPage,
|
openRecordsSearchPage,
|
||||||
toggleCommandMenu,
|
toggleCommandMenu,
|
||||||
|
goBackFromCommandMenu,
|
||||||
setGlobalCommandMenuContext,
|
setGlobalCommandMenuContext,
|
||||||
} = useCommandMenu();
|
} = useCommandMenu();
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ export const useCommandMenuHotKeys = () => {
|
|||||||
toggleCommandMenu();
|
toggleCommandMenu();
|
||||||
},
|
},
|
||||||
AppHotkeyScope.CommandMenu,
|
AppHotkeyScope.CommandMenu,
|
||||||
[toggleCommandMenu],
|
[closeKeyboardShortcutMenu, toggleCommandMenu],
|
||||||
);
|
);
|
||||||
|
|
||||||
useScopedHotkeys(
|
useScopedHotkeys(
|
||||||
@ -55,18 +55,21 @@ export const useCommandMenuHotKeys = () => {
|
|||||||
useScopedHotkeys(
|
useScopedHotkeys(
|
||||||
[Key.Escape],
|
[Key.Escape],
|
||||||
() => {
|
() => {
|
||||||
closeCommandMenu();
|
goBackFromCommandMenu();
|
||||||
},
|
},
|
||||||
AppHotkeyScope.CommandMenuOpen,
|
AppHotkeyScope.CommandMenuOpen,
|
||||||
[closeCommandMenu],
|
[goBackFromCommandMenu],
|
||||||
);
|
);
|
||||||
|
|
||||||
useScopedHotkeys(
|
useScopedHotkeys(
|
||||||
[Key.Backspace, Key.Delete],
|
[Key.Backspace, Key.Delete],
|
||||||
() => {
|
() => {
|
||||||
|
if (isNonEmptyString(commandMenuSearch)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
commandMenuPage === CommandMenuPages.Root &&
|
commandMenuPage === CommandMenuPages.Root &&
|
||||||
!isNonEmptyString(commandMenuSearch) &&
|
|
||||||
!(
|
!(
|
||||||
contextStoreTargetedRecordsRuleComponent.mode === 'selection' &&
|
contextStoreTargetedRecordsRuleComponent.mode === 'selection' &&
|
||||||
contextStoreTargetedRecordsRuleComponent.selectedRecordIds.length ===
|
contextStoreTargetedRecordsRuleComponent.selectedRecordIds.length ===
|
||||||
@ -75,9 +78,18 @@ export const useCommandMenuHotKeys = () => {
|
|||||||
) {
|
) {
|
||||||
setGlobalCommandMenuContext();
|
setGlobalCommandMenuContext();
|
||||||
}
|
}
|
||||||
|
if (commandMenuPage !== CommandMenuPages.Root) {
|
||||||
|
goBackFromCommandMenu();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
AppHotkeyScope.CommandMenuOpen,
|
AppHotkeyScope.CommandMenuOpen,
|
||||||
[closeCommandMenu],
|
[
|
||||||
|
commandMenuPage,
|
||||||
|
commandMenuSearch,
|
||||||
|
contextStoreTargetedRecordsRuleComponent,
|
||||||
|
goBackFromCommandMenu,
|
||||||
|
setGlobalCommandMenuContext,
|
||||||
|
],
|
||||||
{
|
{
|
||||||
preventDefault: false,
|
preventDefault: false,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user