From bca73885b287a01420d426d8bbca3ed0dc426bd2 Mon Sep 17 00:00:00 2001 From: Zach Rispoli Date: Wed, 26 Jul 2017 15:17:05 -0400 Subject: [PATCH] Fix broken accessibility feature --- client/modules/IDE/components/Editor.jsx | 34 +++++++++++------------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/client/modules/IDE/components/Editor.jsx b/client/modules/IDE/components/Editor.jsx index d93fc2d8..f97cbfa6 100644 --- a/client/modules/IDE/components/Editor.jsx +++ b/client/modules/IDE/components/Editor.jsx @@ -49,7 +49,18 @@ class Editor extends React.Component { constructor(props) { super(props); this.tidyCode = this.tidyCode.bind(this); - this.onUpdateLinting = this.onUpdateLinting.bind(this); + + this.updateLintingMessageAccessibility = debounce((annotations) => { + this.props.clearLintMessage(); + annotations.forEach((x) => { + if (x.from.line > -1) { + this.props.updateLintMessage(x.severity, (x.from.line + 1), x.message); + } + }); + if (this.props.lintMessages.length > 0 && this.props.lintWarning) { + this.beep.play(); + } + }, 2000); } componentDidMount() { this.beep = new Audio(beepUrl); @@ -65,7 +76,10 @@ class Editor extends React.Component { keyMap: 'sublime', highlightSelectionMatches: true, // highlight current search match lint: { - onUpdateLinting: this.onUpdateLinting, + onUpdateLinting: ((annotations) => { + this.props.hideRuntimeErrorWarning(); + this.updateLintingMessageAccessibility(annotations); + }), options: { 'asi': true, 'eqeqeq': false, @@ -166,22 +180,6 @@ class Editor extends React.Component { this._cm = null; } - onUpdateLinting() { - this.props.hideRuntimeErrorWarning(); - - debounce((annotations) => { - this.props.clearLintMessage(); - annotations.forEach((x) => { - if (x.from.line > -1) { - this.props.updateLintMessage(x.severity, (x.from.line + 1), x.message); - } - }); - if (this.props.lintMessages.length > 0 && this.props.lintWarning) { - this.beep.play(); - } - }, 2000); - } - getFileMode(fileName) { let mode; if (fileName.match(/.+\.js$/i)) {