add keyboard listener for exporting (#777)

main
Michael Fix 6 years ago committed by GitHub
parent ab8cd71a80
commit 5acc71e2da
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import { withRouter } from 'next/router' import { withRouter } from 'next/router'
import { useCopyTextHandler, useOnline } from '@dawnlabs/tacklebox' import { useCopyTextHandler, useOnline, useKeyboardListener } from '@dawnlabs/tacklebox'
import { COLORS, EXPORT_SIZES } from '../lib/constants' import { COLORS, EXPORT_SIZES } from '../lib/constants'
import Button from './Button' import Button from './Button'
@ -69,6 +69,12 @@ function ExportMenu({
const online = useOnline() const online = useOnline()
const isSafari = useSafari() const isSafari = useSafari()
useKeyboardListener('e', e => {
if (e.shiftKey && e.metaKey) {
exportImage()
}
})
const disablePNG = isSafari && (tooLarge || !online) const disablePNG = isSafari && (tooLarge || !online)
const input = React.useRef() const input = React.useRef()

Loading…
Cancel
Save