Add a randomly generated classname to each variable so that CodeMirror does not merge adjacent variables into the same SPAN.

This commit is contained in:
Brahma Dev 2023-09-29 21:38:08 +00:00
parent a02d2b9c58
commit 0b83fbb7ce

View File

@ -25,10 +25,11 @@ export const defineCodeMirrorBrunoVariablesMode = (variables, mode) => {
stream.eat('}');
let found = pathFoundInVariables(word, variables);
if (found) {
return 'variable-valid';
return 'variable-valid ' + (Math.random() + 1).toString(36).substring(9);
} else {
return 'variable-invalid';
return 'variable-invalid ' + (Math.random() + 1).toString(36).substring(9);
}
// Random classname added so adjacent variables are not rendered in the same SPAN by CodeMirror.
}
word += ch;
}