parent
3f821ffb32
commit
d0832ea4b7
1 changed files with 7 additions and 2 deletions
|
@ -192,12 +192,17 @@ class Editor extends React.Component {
|
|||
if (this.props.runtimeErrorWarningVisible && this._cm.getDoc().modeOption === 'javascript') {
|
||||
this.props.consoleEvents.forEach((consoleEvent) => {
|
||||
if (consoleEvent.method === 'error') {
|
||||
if (consoleEvent.data[0].indexOf(')') > -1) {
|
||||
if (consoleEvent.data &&
|
||||
consoleEvent.data[0] &&
|
||||
consoleEvent.data[0].indexOf &&
|
||||
consoleEvent.data[0].indexOf(')') > -1) {
|
||||
const n = consoleEvent.data[0].replace(')', '').split(' ');
|
||||
const lineNumber = parseInt(n[n.length - 1], 10) - 1;
|
||||
if (!Number.isNaN(lineNumber)) {
|
||||
this._cm.addLineClass(lineNumber, 'background', 'line-runtime-error');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue