1
1
mirror of https://github.com/jxnblk/mdx-deck.git synced 2024-11-29 13:58:02 +03:00

Merge pull request #319 from unitehenry/master

Added pageUp and pageDown keys
This commit is contained in:
Brent Jackson 2019-04-15 13:32:13 -04:00 committed by GitHub
commit 0e70f424ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -35,6 +35,8 @@ const keys = {
p: 80,
o: 79,
g: 71,
pgUp: 33,
pgDown: 34,
}
const toggleMode = key => state => ({
@ -61,6 +63,7 @@ export class MDXDeck extends React.Component {
const { basepath } = this.props
const { keyCode, metaKey, ctrlKey, altKey, shiftKey } = e
const { activeElement } = document
if (inputElements.includes(activeElement.tagName)) {
return
}
@ -90,10 +93,12 @@ export class MDXDeck extends React.Component {
}
} else {
switch (keyCode) {
case keys.pgUp:
case keys.left:
e.preventDefault()
this.previous()
break
case keys.pgDown:
case keys.right:
case keys.space:
e.preventDefault()