Skip to content

Commit 5aa5dc8

Browse files
committed
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
1 parent 5d4e22d commit 5aa5dc8

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

processes/on-editor-load.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,13 +134,14 @@
134134

135135
// Indicate if the nesting structure of the code is OK
136136
top.ICEcoder.updateNestingIndicator = function() {
137-
var cM, nestOK, fileName;
137+
var cM, testToken, nestOK, fileName;
138138

139139
cM = top.ICEcoder.getcMInstance();
140140
nestOK = true;
141141
fileName = top.ICEcoder.openFiles[top.ICEcoder.selectedTab-1];
142142
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) {
143-
nestOK = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length}).className != "error" ? true : false;
143+
testToken = cM.getTokenAt({line:cM.lineCount(),ch:cM.lineInfo(cM.lineCount()-1).text.length});
144+
nestOK = testToken.type && testToken.type.indexOf("error") == -1 ? true : false;
144145
}
145146
top.ICEcoder.nestValid.style.background = nestOK ? "#0b0" : "#f00";
146147
top.ICEcoder.nestValid.title = nestOK ? "Nesting OK" : "Nesting Broken";

0 commit comments

Comments
 (0)