Skip to content

Commit 393c8fb

Browse files
committed
added keybind for export
1 parent 1d3dcef commit 393c8fb

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

app/src/components/right/ExportButton.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
import React, { useState, useContext } from 'react';
2+
import React, { useState, useContext, useCallback, useEffect } from 'react';
33
import StateContext from '../../context/context';
44
import { makeStyles } from '@material-ui/core/styles';
55
import List from '@material-ui/core/List';
@@ -105,6 +105,19 @@ export default function ExportButton() {
105105
);
106106
};
107107

108+
const exportKeyBind = useCallback((e) => {
109+
//Export Project
110+
(e.key === 'e' && e.metaKey || e.key === 'e' && e.ctrlKey ) ? showGenerateAppModal() : '';
111+
}, []);
112+
113+
useEffect(() => {
114+
document.addEventListener('keydown', exportKeyBind);
115+
return () => {
116+
document.removeEventListener('keydown', exportKeyBind)
117+
}
118+
}, []);
119+
120+
108121
return (
109122
<div>
110123
<Button

0 commit comments

Comments
 (0)