From 280d3e69ea20af6f70a0b8ffb85d56685baadd36 Mon Sep 17 00:00:00 2001 From: Cassie Tarakajian Date: Wed, 19 Oct 2016 18:35:59 -0400 Subject: [PATCH] fix keyboard shortcuts on safari --- client/modules/IDE/components/Editor.js | 3 ++- client/modules/IDE/pages/IDEView.js | 8 +++++--- package.json | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/client/modules/IDE/components/Editor.js b/client/modules/IDE/components/Editor.js index 855d500b..913987c5 100644 --- a/client/modules/IDE/components/Editor.js +++ b/client/modules/IDE/components/Editor.js @@ -77,7 +77,8 @@ class Editor extends React.Component { }); this._cm.on('keydown', (_cm, e) => { - if (e.key === 'Tab' && e.shiftKey) { + // 9 === Tab + if (e.keyCode === 9 && e.shiftKey) { this.tidyCode(); } }); diff --git a/client/modules/IDE/pages/IDEView.js b/client/modules/IDE/pages/IDEView.js index a31b3558..339599a6 100644 --- a/client/modules/IDE/pages/IDEView.js +++ b/client/modules/IDE/pages/IDEView.js @@ -137,15 +137,17 @@ class IDEView extends React.Component { } 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.stopPropagation(); 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.stopPropagation(); 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.stopPropagation(); this.props.startSketchAndRefresh(); diff --git a/package.json b/package.json index 6de6c86f..e6aae572 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "body-parser": "^1.15.1", "bson-objectid": "^1.1.4", "classnames": "^2.2.5", - "codemirror": "^5.14.2", + "codemirror": "^5.19.0", "connect-mongo": "^1.2.0", "cookie-parser": "^1.4.1", "csslint": "^0.10.0",