Index: experimental/webtry/res/js/webtry.js |
diff --git a/experimental/webtry/js/webtry.js b/experimental/webtry/res/js/webtry.js |
similarity index 94% |
rename from experimental/webtry/js/webtry.js |
rename to experimental/webtry/res/js/webtry.js |
index aafadf3b67bb4165ebb948558db2acdb953e99d1..6a1a68b905ada624f7496de7471a007f00466b6c 100644 |
--- a/experimental/webtry/js/webtry.js |
+++ b/experimental/webtry/res/js/webtry.js |
@@ -128,6 +128,19 @@ |
var parser = new DOMParser(); |
var tryTemplate = document.getElementById('tryTemplate'); |
+ var editor = CodeMirror.fromTextArea(code, { |
jcgregorio
2014/05/01 13:27:30
Can we fix the editor so that it defaults to 100 c
f(malita)
2014/05/01 14:24:40
Done.
|
+ theme: "ambiance", |
+ lineNumbers: true, |
+ matchBrackets: true, |
+ mode: "text/x-c++src", |
+ indentUnit: 4, |
+ }); |
+ |
+ // Suppress changes to the first/last line (draw wrapper method) |
+ editor.on('beforeChange', function(cm, change) { |
+ if (change.from.line < 1 || change.from.line == cm.lineCount() - 1) |
+ change.cancel(); |
+ }); |
function beginWait() { |
document.body.classList.add('waiting'); |
@@ -258,7 +271,7 @@ |
req.overrideMimeType('application/json'); |
req.open('POST', '/', true); |
req.setRequestHeader('content-type', 'application/json'); |
- req.send(JSON.stringify({'code': code.value, 'name': workspaceName})); |
+ req.send(JSON.stringify({'code': editor.getValue(), 'name': workspaceName})); |
} |
run.addEventListener('click', onSubmitCode); |