fix keyboard shortcuts on safari

This commit is contained in:
Cassie Tarakajian 2016-10-19 18:35:59 -04:00
parent ef7d121927
commit 280d3e69ea
3 changed files with 8 additions and 5 deletions

View file

@ -77,7 +77,8 @@ class Editor extends React.Component {
}); });
this._cm.on('keydown', (_cm, e) => { this._cm.on('keydown', (_cm, e) => {
if (e.key === 'Tab' && e.shiftKey) { // 9 === Tab
if (e.keyCode === 9 && e.shiftKey) {
this.tidyCode(); this.tidyCode();
} }
}); });

View file

@ -137,15 +137,17 @@ class IDEView extends React.Component {
} }
handleGlobalKeydown(e) { handleGlobalKeydown(e) {
if (e.key === 's' && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) { // 83 === s
if (e.keyCode === 83 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.props.saveProject(); this.props.saveProject();
} else if (e.key === 'Enter' && e.shiftKey && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) { // 13 === enter
} else if (e.keyCode === 13 && e.shiftKey && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.props.stopSketch(); this.props.stopSketch();
} else if (e.key === 'Enter' && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) { } else if (e.keyCode === 13 && ((e.metaKey && this.isMac) || (e.ctrlKey && !this.isMac))) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
this.props.startSketchAndRefresh(); this.props.startSketchAndRefresh();

View file

@ -65,7 +65,7 @@
"body-parser": "^1.15.1", "body-parser": "^1.15.1",
"bson-objectid": "^1.1.4", "bson-objectid": "^1.1.4",
"classnames": "^2.2.5", "classnames": "^2.2.5",
"codemirror": "^5.14.2", "codemirror": "^5.19.0",
"connect-mongo": "^1.2.0", "connect-mongo": "^1.2.0",
"cookie-parser": "^1.4.1", "cookie-parser": "^1.4.1",
"csslint": "^0.10.0", "csslint": "^0.10.0",