resolves behavior in #428 where syntax errors in auto refresh mode are unrecoverable
This commit is contained in:
parent
001abce896
commit
8e63b3204d
1 changed files with 13 additions and 5 deletions
|
@ -4,6 +4,7 @@ import ReactDOM from 'react-dom';
|
|||
import srcDoc from 'srcdoc-polyfill';
|
||||
|
||||
import loopProtect from 'loop-protect';
|
||||
import { JSHINT } from 'jshint';
|
||||
import { getBlobUrl } from '../actions/files';
|
||||
import { resolvePathToFile } from '../../../../server/utils/filePath';
|
||||
|
||||
|
@ -289,11 +290,18 @@ class PreviewFrame extends React.Component {
|
|||
}
|
||||
}
|
||||
});
|
||||
newContent = decomment(newContent, {
|
||||
ignore: /noprotect/g,
|
||||
space: true
|
||||
});
|
||||
newContent = loopProtect(newContent);
|
||||
|
||||
// check the code for js errors before sending it to strip comments
|
||||
// or loops.
|
||||
JSHINT(newContent);
|
||||
|
||||
if (!JSHINT.errors) {
|
||||
newContent = decomment(newContent, {
|
||||
ignore: /noprotect/g,
|
||||
space: true
|
||||
});
|
||||
newContent = loopProtect(newContent);
|
||||
}
|
||||
return newContent;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue