Skip to content

Commit ef98190

Browse files
committed
1 parent d5f2380 commit ef98190

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

client/modules/IDE/components/Editor.jsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ class Editor extends React.Component {
194194
if (this.props.runtimeErrorWarningVisible && this._cm.getDoc().modeOption === 'javascript') {
195195
this.props.consoleEvents.forEach((consoleEvent) => {
196196
if (consoleEvent.method === 'error') {
197-
if (consoleEvent.arguments.indexOf(')') > -1) {
198-
const n = consoleEvent.arguments.replace(')', '').split(' ');
197+
if (consoleEvent.data[0].indexOf(')') > -1) {
198+
const n = consoleEvent.data[0].replace(')', '').split(' ');
199199
const lineNumber = parseInt(n[n.length - 1], 10) - 1;
200200
this._cm.addLineClass(lineNumber, 'background', 'line-runtime-error');
201201
}

client/utils/consoleUtils.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@ export const hijackConsoleErrorsScript = (offs) => {
3131
data = msg + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')';
3232
}
3333
window.parent.postMessage([{
34-
method: 'error',
35-
arguments: data,
34+
log: [{
35+
method: 'error',
36+
data: [data],
37+
id: Date.now().toString()
38+
}],
3639
source: fileInfo[1]
3740
}], '*');
3841
return false;
@@ -58,8 +61,8 @@ export const getAllScriptOffsets = (htmlFile) => {
5861
} else {
5962
endFilenameInd = htmlFile.indexOf('.js', ind + startTag.length + 3);
6063
filename = htmlFile.substring(ind + startTag.length, endFilenameInd);
61-
// the length of hijackConsoleErrorsScript is 33 lines
62-
lineOffset = htmlFile.substring(0, ind).split('\n').length + 33;
64+
// the length of hijackConsoleErrorsScript is 37 lines
65+
lineOffset = htmlFile.substring(0, ind).split('\n').length + 37;
6366
offs.push([lineOffset, filename]);
6467
lastInd = ind + 1;
6568
}

0 commit comments

Comments
 (0)