Fix broken accessibility feature

This commit is contained in:
Zach Rispoli 2017-07-26 15:17:05 -04:00
parent 8c832d06fd
commit 4d3e998f33

View file

@ -38,7 +38,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);
@ -53,7 +64,10 @@ class Editor extends React.Component {
gutters: ['CodeMirror-lint-markers'],
keyMap: 'sublime',
lint: {
onUpdateLinting: this.onUpdateLinting,
onUpdateLinting: ((annotations) => {
this.props.hideRuntimeErrorWarning();
this.updateLintingMessageAccessibility(annotations);
}),
options: {
'asi': true,
'eqeqeq': false,
@ -153,22 +167,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)) {