The FCC editor will now catch un-closed comments! This can be extended to catch quotes as well if needed. Fix #1839
This commit is contained in:
@@ -71,6 +71,17 @@ editor.on("keyup", function () {
|
||||
var nodeEnv = prodOrDev === 'production' ? 'http://www.freecodecamp.com' : 'http://localhost:3001';
|
||||
function updatePreview() {
|
||||
editorValueForIFrame = editor.getValue();
|
||||
var failedCommentTest = false;
|
||||
if(editorValueForIFrame.match(/\<\!\-\-/gi) && editorValueForIFrame.match(/\-\-\>/gi) == null){
|
||||
failedCommentTest = true;
|
||||
}
|
||||
else if(editorValueForIFrame.match(/\<\!\-\-/gi) && editorValueForIFrame.match(/\<\!\-\-/gi).length > editorValueForIFrame.match(/\-\-\>/gi).length){
|
||||
failedCommentTest = true;
|
||||
}
|
||||
if(failedCommentTest){
|
||||
editor.setValue(editor.getValue()+ "-->");
|
||||
editorValueForIFrame = editorValueForIFrame + "-->";
|
||||
}
|
||||
goodTests = 0;
|
||||
var previewFrame = document.getElementById('preview');
|
||||
var preview = previewFrame.contentDocument || previewFrame.contentWindow.document;
|
||||
|
Reference in New Issue
Block a user