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

Save when Ctrl+S is pressed

parent 83a1babc
Branches
Tags
No related merge requests found
...@@ -151,11 +151,18 @@ class MenuBar extends React.Component { ...@@ -151,11 +151,18 @@ class MenuBar extends React.Component {
'handleClickSeeCommunity', 'handleClickSeeCommunity',
'handleClickShare', 'handleClickShare',
'handleCloseFileMenuAndThen', 'handleCloseFileMenuAndThen',
'handleKeyPress',
'handleLanguageMouseUp', 'handleLanguageMouseUp',
'handleRestoreOption', 'handleRestoreOption',
'restoreOptionMessage' 'restoreOptionMessage'
]); ]);
} }
componentDidMount () {
document.addEventListener('keydown', this.handleKeyPress);
}
componentWillUnmount () {
document.removeEventListener('keydown', this.handleKeyPress);
}
handleClickNew () { handleClickNew () {
let readyToReplaceProject = true; let readyToReplaceProject = true;
// if the project is dirty, and user owns the project, we will autosave. // if the project is dirty, and user owns the project, we will autosave.
...@@ -219,6 +226,12 @@ class MenuBar extends React.Component { ...@@ -219,6 +226,12 @@ class MenuBar extends React.Component {
fn(); fn();
}; };
} }
handleKeyPress (event) {
if (event.key === 's' && event.ctrlKey) {
this.props.onClickSave();
event.preventDefault();
}
}
handleLanguageMouseUp (e) { handleLanguageMouseUp (e) {
if (!this.props.languageMenuOpen) { if (!this.props.languageMenuOpen) {
this.props.onClickLanguage(e); this.props.onClickLanguage(e);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment