Save when Ctrl+S is pressed
This commit is contained in:
1 parent
83a1babc59
commit
67fd56f1a4
1 file changed
+13
@@ -151,11 +151,18 @@ class MenuBar extends React.Component {
|
||||
'handleClickSeeCommunity',
|
||||
'handleClickShare',
|
||||
'handleCloseFileMenuAndThen',
|
||||
'handleKeyPress',
|
||||
'handleLanguageMouseUp',
|
||||
'handleRestoreOption',
|
||||
'restoreOptionMessage'
|
||||
]);
|
||||
}
|
||||
componentDidMount () {
|
||||
document.addEventListener('keydown', this.handleKeyPress);
|
||||
}
|
||||
componentWillUnmount () {
|
||||
document.removeEventListener('keydown', this.handleKeyPress);
|
||||
}
|
||||
handleClickNew () {
|
||||
let readyToReplaceProject = true;
|
||||
// if the project is dirty, and user owns the project, we will autosave.
|
||||
@@ -219,6 +226,12 @@ class MenuBar extends React.Component {
|
||||
fn();
|
||||
};
|
||||
}
|
||||
handleKeyPress (event) {
|
||||
if (event.key === 's' && event.ctrlKey) {
|
||||
this.props.onClickSave();
|
||||
event.preventDefault();
|
||||
}
|
||||
}
|
||||
handleLanguageMouseUp (e) {
|
||||
if (!this.props.languageMenuOpen) {
|
||||
this.props.onClickLanguage(e);
|
||||
|
||||
Reference in new issue
Block a user