Skip to content
Snippets Groups Projects
Commit 67fd56f1 authored by Florrie's avatar Florrie
Browse files

Save when Ctrl+S is pressed

parent 83a1babc
No related branches found
No related tags found
No related merge requests found
......@@ -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);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment