fix: hotkeys editing in user preferences
This commit is contained in:
1 parent
bcd4aeb9e4
commit
f5ecc753f7
4 files changed
+56
-59
No files matched your search
@@ -1,11 +1,13 @@
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
//import { hotkeys } from '@ohif/core';
|
||||
import { hotkeys } from '@ohif/core';
|
||||
import Input from '../Input';
|
||||
|
||||
//import { getKeys, formatKeysForInput } from './utils';
|
||||
import { formatKeysForInput } from './utils';
|
||||
import { getKeys, formatKeysForInput } from './utils';
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* HotkeyField
|
||||
@@ -25,16 +27,16 @@ const HotkeyField = ({ disabled, keys, onChange, className, modifierKeys }) => {
|
||||
event.stopPropagation();
|
||||
event.preventDefault();
|
||||
|
||||
/*hotkeys.record(sequence => {
|
||||
hotkeys.record(sequence => {
|
||||
const keys = getKeys({ sequence, modifierKeys });
|
||||
hotkeys.unpause();
|
||||
onChange(keys);
|
||||
});*/
|
||||
});
|
||||
};
|
||||
|
||||
const onFocus = () => {
|
||||
/*hotkeys.pause();
|
||||
hotkeys.startRecording();*/
|
||||
hotkeys.pause();
|
||||
hotkeys.startRecording();
|
||||
};
|
||||
|
||||
return (
|
||||
|
||||
@@ -35,9 +35,10 @@ const HotkeysPreferences = ({ disabled, hotkeyDefinitions, errors: controlledErr
|
||||
|
||||
setErrors(prevState => {
|
||||
const errors = { ...prevState, [id]: error };
|
||||
onChange(id, definition, errors);
|
||||
return errors;
|
||||
});
|
||||
|
||||
onChange(id, definition, { ...errors, [id]: error });
|
||||
};
|
||||
|
||||
return (
|
||||
@@ -84,7 +85,7 @@ const HotkeysPreferences = ({ disabled, hotkeyDefinitions, errors: controlledErr
|
||||
onChange={onChangeHandler}
|
||||
className='text-lg h-8'
|
||||
/>
|
||||
{error && <span className='p-2 text-red-600 text-sm'>{error}</span>}
|
||||
{error && <span className='p-2 text-left text-red-600 text-sm'>{error}</span>}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user