diff --git a/client/modules/IDE/components/PreviewFrame.js b/client/modules/IDE/components/PreviewFrame.js index a62e7127..5b0aa80c 100644 --- a/client/modules/IDE/components/PreviewFrame.js +++ b/client/modules/IDE/components/PreviewFrame.js @@ -4,7 +4,7 @@ import escapeStringRegexp from 'escape-string-regexp'; import srcDoc from 'srcdoc-polyfill'; -const startTag = 'filestart-'; +const startTag = '@fs-'; function getAllScriptOffsets(htmlFile) { const offs = []; @@ -29,7 +29,39 @@ function getAllScriptOffsets(htmlFile) { return offs; } -function hijackConsoleScript(offs) { + +function hijackConsoleLogsScript() { + const s = ``; + return s; +} +function hijackConsoleErrorsScript(offs) { const s = ``; return s; } @@ -144,6 +146,9 @@ class PreviewFrame extends React.Component { // have to build the array manually because the spread operator is only // one level down... + + htmlFile = hijackConsoleLogsScript() + htmlFile; + const jsFiles = []; this.props.jsFiles.forEach(jsFile => { const newJSFile = { ...jsFile }; @@ -195,7 +200,8 @@ class PreviewFrame extends React.Component { } scriptOffs = getAllScriptOffsets(htmlFile); - htmlFile += hijackConsoleScript(JSON.stringify(scriptOffs)); + htmlFile += hijackConsoleErrorsScript(JSON.stringify(scriptOffs)); + return htmlFile; }