mirror of
https://github.com/IRBorisov/ConceptPortal.git
synced 2025-06-26 13:00:39 +03:00
Improve hotkeys
This commit is contained in:
parent
bc31df77a9
commit
38b661f290
|
@ -30,7 +30,7 @@ function ConstituentaToolbar({
|
|||
return (
|
||||
<Overlay position='right-1/2 translate-x-1/2 top-1 flex items-start'>
|
||||
<MiniButton
|
||||
tooltip='Сохранить изменения'
|
||||
tooltip='Сохранить изменения [Ctrl + S]'
|
||||
disabled={!canSave}
|
||||
icon={<SaveIcon size={5} color={canSave ? 'text-primary' : ''}/>}
|
||||
onClick={onSubmit}
|
||||
|
@ -48,13 +48,13 @@ function ConstituentaToolbar({
|
|||
icon={<SmallPlusIcon size={5} color={isMutable ? 'text-success' : ''} />}
|
||||
/>
|
||||
<MiniButton
|
||||
tooltip='Клонировать конституенту'
|
||||
tooltip='Клонировать конституенту [Alt + V]'
|
||||
disabled={!isMutable}
|
||||
onClick={onClone}
|
||||
icon={<CloneIcon size={5} color={isMutable ? 'text-success' : ''} />}
|
||||
/>
|
||||
<MiniButton
|
||||
tooltip='Создать конституенту из шаблона'
|
||||
tooltip='Создать конституенту из шаблона [Alt + E]'
|
||||
icon={<DiamondIcon color={isMutable ? 'text-primary': ''} size={5}/>}
|
||||
disabled={!isMutable}
|
||||
onClick={onTemplates}
|
||||
|
|
|
@ -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<HTMLDivElement>) {
|
||||
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<HTMLDivElement>) {
|
||||
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)}
|
||||
/>
|
||||
<div className='flex justify-start'>
|
||||
|
|
|
@ -28,7 +28,7 @@ function RSFormToolbar({
|
|||
return (
|
||||
<Overlay position='w-full top-1 flex items-start justify-center'>
|
||||
<MiniButton
|
||||
tooltip='Сохранить изменения'
|
||||
tooltip='Сохранить изменения [Ctrl + S]'
|
||||
disabled={!canSave}
|
||||
icon={<SaveIcon size={5} color={canSave ? 'text-primary' : ''}/>}
|
||||
onClick={onSubmit}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -86,13 +86,13 @@ function RSListToolbar({
|
|||
</div>
|
||||
</div>
|
||||
<MiniButton
|
||||
tooltip='Создать конституенту из шаблона'
|
||||
tooltip='Создать конституенту из шаблона [Alt + E]'
|
||||
icon={<DiamondIcon color={isMutable ? 'text-primary': ''} size={5}/>}
|
||||
disabled={!isMutable}
|
||||
onClick={onTemplates}
|
||||
/>
|
||||
<MiniButton
|
||||
tooltip='Сброс имен: присвоить порядковые имена'
|
||||
tooltip='Сброс имен: присвоить порядковые имена [Alt + R]'
|
||||
icon={<UpdateIcon color={isMutable ? 'text-primary': ''} size={5}/>}
|
||||
disabled={!isMutable}
|
||||
onClick={onReindex}
|
||||
|
|
Loading…
Reference in New Issue
Block a user