Skip to content

Commit

Permalink
Fix not being allowed to disable shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
Anjula Karunarathne committed Aug 28, 2020
1 parent bc36748 commit 989b3d2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions ElectronClient/gui/KeymapConfig/KeymapConfigScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => {
return (recorderError && <i className="fa fa-exclamation-triangle" />);
} else if (hovering[commandName]) {
return (<i className="fa fa-pen" />);
} else { return null; }
} else {
return null;
}
};

const renderError = (error: KeymapError) => {
Expand All @@ -89,7 +91,7 @@ export const KeymapConfigScreen = ({ themeId }: KeymapConfigScreenProps) => {
onReset={handleReset}
onCancel={handleCancel}
onError={handleError}
initialAccelerator={accelerator}
initialAccelerator={accelerator || ''}
commandName={command}
themeId={themeId}
/> :
Expand Down
7 changes: 5 additions & 2 deletions ElectronClient/gui/KeymapConfig/ShortcutRecorder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,11 @@ export const ShortcutRecorder = ({ onSave, onReset, onCancel, onError, initialAc

useEffect(() => {
try {
keymapService.validateAccelerator(accelerator);
keymapService.validateKeymap({ accelerator, command: commandName });
if (accelerator) {
keymapService.validateAccelerator(accelerator);
keymapService.validateKeymap({ accelerator, command: commandName });
}

// Discard previous errors
onError({ recorderError: null });
setSaveAllowed(true);
Expand Down

0 comments on commit 989b3d2

Please sign in to comment.