Skip to content
This repository was archived by the owner on Jun 7, 2023. It is now read-only.

Commit 54c00a2

Browse files
author
Brad Miller
committed
Polish sql support
Add - coloring sql editor Fix - coloring in Java editor
1 parent 47c1394 commit 54c00a2

3 files changed

Lines changed: 401 additions & 2 deletions

File tree

runestone/activecode/activecode.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def setup(app):
4444

4545
app.add_autoversioned_javascript('jquery.highlight.js')
4646
app.add_autoversioned_javascript('bookfuncs.js')
47-
add_codemirror_css_and_js(app,'xml','css','python','htmlmixed','javascript')
47+
add_codemirror_css_and_js(app,'xml','css','python','htmlmixed','javascript', 'sql')
4848
add_i18n_js(app, {"en","sr-Cyrl"},"activecode-i18n")
4949
add_skulpt_js(app)
5050
app.add_autoversioned_javascript('activecode.js')

runestone/activecode/js/activecode.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,15 @@ ActiveCode.prototype.createEditor = function (index) {
121121
this.containerDiv.appendChild(linkdiv);
122122
}
123123
this.containerDiv.appendChild(codeDiv);
124+
var edmode = this.containerDiv.lang;
125+
if (edmode === 'sql') {
126+
edmode = 'text/x-sql'
127+
} else if (edmode === 'java') {
128+
edmode = 'text/x-java'
129+
}
130+
124131
var editor = CodeMirror(codeDiv, {value: this.code, lineNumbers: true,
125-
mode: this.containerDiv.lang, indentUnit: 4,
132+
mode: edmode, indentUnit: 4,
126133
matchBrackets: true, autoMatchParens: true,
127134
extraKeys: {"Tab": "indentMore", "Shift-Tab": "indentLess"}
128135
});

0 commit comments

Comments
 (0)