fix: change hotkeys to work across platforms

Co-authored-by: moT01 <tmondloch01@gmail.com>
This commit is contained in:
Oliver Eyton-Williams
2019-09-17 18:40:11 +02:00
committed by mrugesh
parent a19ceeffe2
commit ab3a9076d9
2 changed files with 4 additions and 5 deletions

View File

@ -128,7 +128,7 @@ class Editor extends Component {
keybindings: [ keybindings: [
/* eslint-disable no-bitwise */ /* eslint-disable no-bitwise */
monaco.KeyMod.chord( monaco.KeyMod.chord(
monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.PageDown monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.US_COMMA
) )
], ],
run: () => navigate(this.props.prevChallengePath) run: () => navigate(this.props.prevChallengePath)
@ -139,7 +139,7 @@ class Editor extends Component {
keybindings: [ keybindings: [
/* eslint-disable no-bitwise */ /* eslint-disable no-bitwise */
monaco.KeyMod.chord( monaco.KeyMod.chord(
monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.PageUp monaco.KeyMod.CtrlCmd | monaco.KeyMod.Shift | monaco.KeyCode.US_DOT
) )
], ],
run: () => navigate(this.props.nextChallengePath) run: () => navigate(this.props.nextChallengePath)

View File

@ -8,8 +8,8 @@ import './challenge-title.css';
import GreenPass from '../../../assets/icons/GreenPass'; import GreenPass from '../../../assets/icons/GreenPass';
const keyMap = { const keyMap = {
NAVIGATE_PREV: 'ctrl+shift+pagedown', NAVIGATE_PREV: ['ctrl+shift+<', 'cmd+shift+<'],
NAVIGATE_NEXT: 'ctrl+shift+pageup' NAVIGATE_NEXT: ['ctrl+shift+>', 'cmd+shift+>']
}; };
const propTypes = { const propTypes = {
@ -33,7 +33,6 @@ function ChallengeTitle({
NAVIGATE_PREV: () => navigate(prevChallengePath), NAVIGATE_PREV: () => navigate(prevChallengePath),
NAVIGATE_NEXT: () => navigate(nextChallengePath) NAVIGATE_NEXT: () => navigate(nextChallengePath)
}; };
return ( return (
<div className='challenge-title-wrap'> <div className='challenge-title-wrap'>
<GlobalHotKeys handlers={handlers} keyMap={keyMap} /> <GlobalHotKeys handlers={handlers} keyMap={keyMap} />