From 5aa5dc82bb51110827c159f390ea03b0c1e18a63 Mon Sep 17 00:00:00 2001 From: Matt Pass Date: Wed, 18 Jun 2014 16:52:01 +0100 Subject: [PATCH] className gone, need to use type className dropped by CodeMirror, need to pick up "error" from type As it may not be there, we need to test for its existence and it's also be part of a string eg "tag brackets error", so indexOf is needed --- processes/on-editor-load.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/processes/on-editor-load.php b/processes/on-editor-load.php index 9a7a8de..bb1282d 100644 --- a/processes/on-editor-load.php +++ b/processes/on-editor-load.php @@ -134,13 +134,14 @@ top.ICEcoder.getNestLocationSub = function(nestCheck, fileName) { // Indicate if the nesting structure of the code is OK top.ICEcoder.updateNestingIndicator = function() { - var cM, nestOK, fileName; + var cM, testToken, nestOK, fileName; cM = top.ICEcoder.getcMInstance(); nestOK = true; fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1]; if (cM && fileName && ["js","coffee","css","less","sql","erl","yaml","java","jl","c","cpp","cs","go","lua","pl","rs","scss"].indexOf(fileName.split(".")[1])==-1) { - nestOK = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length}).className != "error" ? true : false; + testToken = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length}); + nestOK = testToken.type && testToken.type.indexOf("error") == -1 ? true : false; } top.ICEcoder.nestValid.style.background = nestOK ? "#0b0" : "#f00"; top.ICEcoder.nestValid.title = nestOK ? "Nesting OK" : "Nesting Broken";