diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/ConstituentaToolbar.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/ConstituentaToolbar.tsx index 41626681..88d3d0c5 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/ConstituentaToolbar.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/ConstituentaToolbar.tsx @@ -30,7 +30,7 @@ function ConstituentaToolbar({ return ( } onClick={onSubmit} @@ -48,13 +48,13 @@ function ConstituentaToolbar({ icon={} /> } /> } disabled={!isMutable} onClick={onTemplates} diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/EditorConstituenta.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/EditorConstituenta.tsx index 9ef49b33..77994eb4 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/EditorConstituenta.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorConstituenta/EditorConstituenta.tsx @@ -48,7 +48,7 @@ function EditorConstituenta({ onDeleteCst([activeID]); } - function handleCreateCst() { + function handleCreate() { if (!activeID || !schema) { return; } @@ -65,7 +65,7 @@ function EditorConstituenta({ onCreateCst(data); } - function handleCloneCst() { + function handleClone() { if (!activeID || !schema || !activeCst) { return; } @@ -82,19 +82,39 @@ function EditorConstituenta({ onCreateCst(data, true); } + function handleInput(event: React.KeyboardEvent) { + if (!isMutable) { + return; + } + if (event.ctrlKey && event.code === 'KeyS') { + if (isModified) { + initiateSubmit(); + } + event.preventDefault(); + return; + } + if (!event.altKey || event.shiftKey) { + return; + } + if (processAltKey(event.code)) { + event.preventDefault(); + return; + } + } + function initiateSubmit() { const element = document.getElementById(globalIDs.constituenta_editor) as HTMLFormElement; if (element) { element.requestSubmit(); } } - function handleInput(event: React.KeyboardEvent) { - if (event.ctrlKey && event.code === 'KeyS') { - if (isModified) { - initiateSubmit(); - } - event.preventDefault(); + + function processAltKey(code: string): boolean { + switch (code) { + case 'KeyE': onTemplates(); return true; + case 'KeyV': handleClone(); return true; } + return false; } return ( @@ -110,8 +130,8 @@ function EditorConstituenta({ onReset={() => setToggleReset(prev => !prev)} onDelete={handleDelete} - onClone={handleCloneCst} - onCreate={handleCreateCst} + onClone={handleClone} + onCreate={handleCreate} onTemplates={() => onTemplates(activeID)} />
diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormToolbar.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormToolbar.tsx index 96f63828..27a2fa57 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormToolbar.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSForm/RSFormToolbar.tsx @@ -28,7 +28,7 @@ function RSFormToolbar({ return ( } onClick={onSubmit} diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/EditorRSList.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/EditorRSList.tsx index 45865773..14f705a8 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/EditorRSList.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/EditorRSList.tsx @@ -177,11 +177,14 @@ function EditorRSList({ onOpenEdit, onCreateCst, onDeleteCst, onTemplates }: Edi switch (code) { case 'ArrowUp': handleMoveUp(); return true; case 'ArrowDown': handleMoveDown(); return true; - case 'KeyV': handleClone(); return true; + case 'KeyV': handleClone(); return true; } } switch (code) { case 'Backquote': handleCreateCst(); return true; + case 'KeyE': onTemplates(); return true; + case 'KeyR': handleReindex(); return true; + case 'Digit1': handleCreateCst(CstType.BASE); return true; case 'Digit2': handleCreateCst(CstType.STRUCTURED); return true; case 'Digit3': handleCreateCst(CstType.TERM); return true; diff --git a/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/RSListToolbar.tsx b/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/RSListToolbar.tsx index 1dc893fc..50d16df7 100644 --- a/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/RSListToolbar.tsx +++ b/rsconcept/frontend/src/pages/RSFormPage/EditorRSList/RSListToolbar.tsx @@ -86,13 +86,13 @@ function RSListToolbar({
} disabled={!isMutable} onClick={onTemplates} /> } disabled={!isMutable} onClick={onReindex}