Add move hotkeys

This commit is contained in:
IRBorisov 2024-05-09 15:32:36 +03:00
parent 03fd5d054b
commit ea6bf7224c
2 changed files with 6 additions and 5 deletions

View File

@ -66,10 +66,11 @@ function EditorConstituenta({ activeCst, isModified, setIsModified, onOpenEdit }
} }
function processAltKey(code: string): boolean { function processAltKey(code: string): boolean {
// prettier-ignore
switch (code) { switch (code) {
case 'KeyV': case 'ArrowUp': controller.moveUp(); return true;
controller.cloneCst(); case 'ArrowDown': controller.moveDown(); return true;
return true; case 'KeyV': controller.cloneCst(); return true;
} }
return false; return false;
} }

View File

@ -49,7 +49,7 @@ function EditorRSList({ onOpenEdit }: EditorRSListProps) {
} }
} }
function handleTableKey(event: React.KeyboardEvent<HTMLDivElement>) { function handleKeyDown(event: React.KeyboardEvent<HTMLDivElement>) {
if (!controller.isContentEditable || controller.isProcessing) { if (!controller.isContentEditable || controller.isProcessing) {
return; return;
} }
@ -97,7 +97,7 @@ function EditorRSList({ onOpenEdit }: EditorRSListProps) {
return ( return (
<> <>
{controller.isContentEditable ? <RSListToolbar /> : null} {controller.isContentEditable ? <RSListToolbar /> : null}
<AnimateFade tabIndex={-1} className='outline-none' onKeyDown={handleTableKey}> <AnimateFade tabIndex={-1} className='outline-none' onKeyDown={handleKeyDown}>
{controller.isContentEditable ? ( {controller.isContentEditable ? (
<SelectedCounter <SelectedCounter
totalCount={controller.schema?.stats?.count_all ?? 0} totalCount={controller.schema?.stats?.count_all ?? 0}