fixes for hotkeys usage in docusaurus

This commit is contained in:
Erik Ziegler committed 2021-07-21 12:58:15 +02:00
1 parent 7a9f113b91
commit ff28a2264b
24 files changed
+61 -659

No files matched your search

@@ -9,7 +9,7 @@ import { useTranslation } from 'react-i18next';
import { MODIFIER_KEYS } from './hotkeysConfig';
import { validate, splitHotkeyDefinitionsAndCreateTuples } from './utils';
const HotkeysPreferences = ({ disabled, hotkeyDefinitions, errors: controlledErrors, onChange }) => {
const HotkeysPreferences = ({ disabled, hotkeyDefinitions, errors: controlledErrors, onChange, hotkeysModule }) => {
const { t } = useTranslation('UserPreferencesModal');
const visibleHotkeys = Object.keys(hotkeyDefinitions)
@@ -83,6 +83,7 @@ const HotkeysPreferences = ({ disabled, hotkeyDefinitions, errors: controlledErr
keys={definition.keys}
modifierKeys={MODIFIER_KEYS}
onChange={onChangeHandler}
hotkeys={hotkeysModule}
className='text-lg h-8'
/>
{error && <span className='p-2 text-left text-red-600 text-sm'>{error}</span>}
@@ -106,6 +107,13 @@ HotkeysPreferences.propTypes = {
onChange: PropTypes.func,
disabled: PropTypes.bool,
hotkeyDefinitions: PropTypes.object.isRequired,
hotkeysModule: PropTypes.object({
initialize: PropTypes.func.isRequired,
pause: PropTypes.func.isRequired,
unpause: PropTypes.func.isRequired,
startRecording: PropTypes.func.isRequired,
record: PropTypes.func.isRequired,
}).isRequired
};
HotkeysPreferences.defaultProps = {
@@ -46,7 +46,4 @@ const validate = ({ commandName, pressedKeys, hotkeys }) => {
return { error: undefined };
};
export {
validate,
splitHotkeyDefinitionsAndCreateTuples
};
export { validate, splitHotkeyDefinitionsAndCreateTuples };