1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-08-02 20:15:26 +02:00

CodeMirror dependency upgraded to v5.32.0

For handling Markdown and Code section types
This commit is contained in:
Harvey Kandola 2017-12-18 13:10:51 +00:00
parent 3337db6b27
commit 0336f84a83
351 changed files with 3408 additions and 1945 deletions

79
gui/public/codemirror/mode/vb/index.html vendored Executable file → Normal file
View file

@ -30,73 +30,20 @@
<article>
<h2>VB.NET mode</h2>
<script type="text/javascript">
function test(golden, text) {
var ok = true;
var i = 0;
function callback(token, style, lineNo, pos){
//console.log(String(token) + " " + String(style) + " " + String(lineNo) + " " + String(pos));
var result = [String(token), String(style)];
if (golden[i][0] != result[0] || golden[i][1] != result[1]){
return "Error, expected: " + String(golden[i]) + ", got: " + String(result);
ok = false;
}
i++;
}
CodeMirror.runMode(text, "text/x-vb",callback);
if (ok) return "Tests OK";
}
function testTypes() {
var golden = [['Integer','keyword'],[' ','null'],['Float','keyword']]
var text = "Integer Float";
return test(golden,text);
}
function testIf(){
var golden = [['If','keyword'],[' ','null'],['True','keyword'],[' ','null'],['End','keyword'],[' ','null'],['If','keyword']];
var text = 'If True End If';
return test(golden, text);
}
function testDecl(){
var golden = [['Dim','keyword'],[' ','null'],['x','variable'],[' ','null'],['as','keyword'],[' ','null'],['Integer','keyword']];
var text = 'Dim x as Integer';
return test(golden, text);
}
function testAll(){
var result = "";
result += testTypes() + "\n";
result += testIf() + "\n";
result += testDecl() + "\n";
return result;
}
function initText(editor) {
var content = 'Class rocket\nPrivate quality as Double\nPublic Sub launch() as String\nif quality > 0.8\nlaunch = "Successful"\nElse\nlaunch = "Failed"\nEnd If\nEnd sub\nEnd class\n';
editor.setValue(content);
for (var i =0; i< editor.lineCount(); i++) editor.indentLine(i);
}
function init() {
editor = CodeMirror.fromTextArea(document.getElementById("solution"), {
lineNumbers: true,
mode: "text/x-vb",
readOnly: false
});
runTest();
}
function runTest() {
document.getElementById('testresult').innerHTML = testAll();
initText(editor);
}
document.body.onload = init;
</script>
<div id="edit">
<textarea style="width:95%;height:200px;padding:5px;" name="solution" id="solution" ></textarea>
<textarea name="code" id="code" >
Class rocket
Private quality as Double
Public Sub launch() as String
If quality > 0.8
launch = "Successful"
Else
launch = "Failed"
End If
End sub
End class
</textarea>
</div>
<pre id="testresult"></pre>
<p>MIME type defined: <code>text/x-vb</code>.</p>
<script>CodeMirror.fromTextArea(document.getElementById("code"))</script>
</article>

1
gui/public/codemirror/mode/vb/vb.js vendored Executable file → Normal file
View file

@ -202,7 +202,6 @@ CodeMirror.defineMode("vb", function(conf, parserConf) {
// Handle '.' connected identifiers
if (current === '.') {
style = state.tokenize(stream, state);
current = stream.current();
if (style === 'variable') {
return 'variable';
} else {