From 5acc71e2daf59250d3b6b0e69d31e0572427e5dd Mon Sep 17 00:00:00 2001 From: Michael Fix Date: Mon, 10 Jun 2019 09:29:02 -0700 Subject: [PATCH] add keyboard listener for exporting (#777) --- components/ExportMenu.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/components/ExportMenu.js b/components/ExportMenu.js index d2fb278..eb7a4f1 100644 --- a/components/ExportMenu.js +++ b/components/ExportMenu.js @@ -1,6 +1,6 @@ import React from 'react' 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 Button from './Button' @@ -69,6 +69,12 @@ function ExportMenu({ const online = useOnline() const isSafari = useSafari() + useKeyboardListener('e', e => { + if (e.shiftKey && e.metaKey) { + exportImage() + } + }) + const disablePNG = isSafari && (tooLarge || !online) const input = React.useRef()