This commit is contained in:
parent
c596b74b27
commit
3f32ccc89c
2 changed files with 4 additions and 3 deletions
|
@ -7,6 +7,8 @@ import loopProtect from 'loop-protect';
|
|||
import { getBlobUrl } from '../actions/files';
|
||||
import { resolvePathToFile } from '../../../../server/utils/filePath';
|
||||
|
||||
const decomment = require('decomment');
|
||||
|
||||
const startTag = '@fs-';
|
||||
// eslint-disable-next-line max-len
|
||||
const MEDIA_FILE_REGEX = /^('|")(?!(http:\/\/|https:\/\/)).*\.(png|jpg|jpeg|gif|bmp|mp3|wav|aiff|ogg|json|txt|csv|svg|obj|mp4|ogg|webm|mov|otf|ttf|m4a)('|")$/i;
|
||||
|
@ -56,20 +58,17 @@ function hijackConsoleErrorsScript(offs) {
|
|||
}
|
||||
return [line - l, file];
|
||||
}
|
||||
|
||||
// catch reference errors, via http://stackoverflow.com/a/12747364/2994108
|
||||
window.onerror = function (msg, url, lineNumber, columnNo, error) {
|
||||
var string = msg.toLowerCase();
|
||||
var substring = "script error";
|
||||
var data = {};
|
||||
|
||||
if (string.indexOf(substring) !== -1){
|
||||
data = 'Script Error: See Browser Console for Detail';
|
||||
} else {
|
||||
var fileInfo = getScriptOff(lineNumber);
|
||||
data = msg + ' (' + fileInfo[1] + ': line ' + fileInfo[0] + ')';
|
||||
}
|
||||
|
||||
window.parent.postMessage([{
|
||||
method: 'error',
|
||||
arguments: data,
|
||||
|
@ -281,6 +280,7 @@ class PreviewFrame extends React.Component {
|
|||
}
|
||||
}
|
||||
});
|
||||
newContent = decomment(newContent);
|
||||
newContent = loopProtect(newContent);
|
||||
return newContent;
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@
|
|||
"cookie-parser": "^1.4.1",
|
||||
"cors": "^2.8.1",
|
||||
"csslint": "^0.10.0",
|
||||
"decomment": "^0.8.7",
|
||||
"dotenv": "^2.0.0",
|
||||
"dropzone": "^4.3.0",
|
||||
"escape-string-regexp": "^1.0.5",
|
||||
|
|
Loading…
Reference in a new issue