for #769
This commit is contained in:
parent
d5f2380c31
commit
ef98190e25
2 changed files with 9 additions and 6 deletions
|
@ -194,8 +194,8 @@ 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.arguments.indexOf(')') > -1) {
|
||||
const n = consoleEvent.arguments.replace(')', '').split(' ');
|
||||
if (consoleEvent.data[0].indexOf(')') > -1) {
|
||||
const n = consoleEvent.data[0].replace(')', '').split(' ');
|
||||
const lineNumber = parseInt(n[n.length - 1], 10) - 1;
|
||||
this._cm.addLineClass(lineNumber, 'background', 'line-runtime-error');
|
||||
}
|
||||
|
|
|
@ -31,8 +31,11 @@ export const hijackConsoleErrorsScript = (offs) => {
|
|||
data = msg + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')';
|
||||
}
|
||||
window.parent.postMessage([{
|
||||
method: 'error',
|
||||
arguments: data,
|
||||
log: [{
|
||||
method: 'error',
|
||||
data: [data],
|
||||
id: Date.now().toString()
|
||||
}],
|
||||
source: fileInfo[1]
|
||||
}], '*');
|
||||
return false;
|
||||
|
@ -58,8 +61,8 @@ export const getAllScriptOffsets = (htmlFile) => {
|
|||
} else {
|
||||
endFilenameInd = htmlFile.indexOf('.js', ind + startTag.length + 3);
|
||||
filename = htmlFile.substring(ind + startTag.length, endFilenameInd);
|
||||
// the length of hijackConsoleErrorsScript is 33 lines
|
||||
lineOffset = htmlFile.substring(0, ind).split('\n').length + 33;
|
||||
// the length of hijackConsoleErrorsScript is 37 lines
|
||||
lineOffset = htmlFile.substring(0, ind).split('\n').length + 37;
|
||||
offs.push([lineOffset, filename]);
|
||||
lastInd = ind + 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue