Fix broken accessibility feature

This commit is contained in:
Zach Rispoli 2017-07-26 15:17:05 -04:00 committed by Cassie Tarakajian
parent 682dd7e2fc
commit bca73885b2

View file

@ -49,7 +49,18 @@ class Editor extends React.Component {
constructor(props) { constructor(props) {
super(props); super(props);
this.tidyCode = this.tidyCode.bind(this); 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() { componentDidMount() {
this.beep = new Audio(beepUrl); this.beep = new Audio(beepUrl);
@ -65,7 +76,10 @@ class Editor extends React.Component {
keyMap: 'sublime', keyMap: 'sublime',
highlightSelectionMatches: true, // highlight current search match highlightSelectionMatches: true, // highlight current search match
lint: { lint: {
onUpdateLinting: this.onUpdateLinting, onUpdateLinting: ((annotations) => {
this.props.hideRuntimeErrorWarning();
this.updateLintingMessageAccessibility(annotations);
}),
options: { options: {
'asi': true, 'asi': true,
'eqeqeq': false, 'eqeqeq': false,
@ -166,22 +180,6 @@ class Editor extends React.Component {
this._cm = null; 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) { getFileMode(fileName) {
let mode; let mode;
if (fileName.match(/.+\.js$/i)) { if (fileName.match(/.+\.js$/i)) {