feat: use local HotKeys and allow editor escape

GlobalHotKeys were abandoned, because they were capturing events that
had called stopPropagation.  This meant that something needed to be in
focus, hence passing a ref of the HotKey DOM element to the Editor.

react-hotkeys has been updated to 2.0.0-pre9, because 2.0.0 captured
ctrl keypresses when asked for ctrl+enter

Currently only classic challenges can be executed by hotkey, but all
allow hotkey navigation
This commit is contained in:
Oliver Eyton-Williams
2019-09-18 17:46:19 +02:00
committed by mrugesh
parent ab3a9076d9
commit c91393d737
8 changed files with 128 additions and 83 deletions

View File

@@ -33,6 +33,7 @@ import { Form } from '../../../../components/formHelpers';
import Spacer from '../../../../components/helpers/Spacer';
import { ChallengeNode } from '../../../../redux/propTypes';
import { isSignedInSelector } from '../../../../redux';
import Hotkeys from '../../components/Hotkeys';
import { backend } from '../../../../../utils/challengeTypes';
@@ -186,6 +187,11 @@ export class BackEnd extends Component {
return (
<LearnLayout>
<Helmet title={`${blockNameTitle} | Learn | freeCodeCamp.org`} />
<Hotkeys
introPath={introPath}
nextChallengePath={nextChallengePath}
prevChallengePath={prevChallengePath}
/>
<Grid>
<Row>
<Col md={8} mdOffset={2} sm={10} smOffset={1} xs={12}>