Saving now works, fixed styling

This commit is contained in:
Eric Wood 2012-11-27 12:18:06 -06:00
parent b87ab87ce0
commit a6f3bb5c82
2 changed files with 13 additions and 1 deletions

View File

@ -50,6 +50,9 @@
height: 10em; height: 10em;
width: 40em; width: 40em;
} }
.CodeMirror {
border: solid #CCC 1px;
}
.applies-to ul { .applies-to ul {
display: inline-block; display: inline-block;
margin: 0; margin: 0;

11
edit.js
View File

@ -15,7 +15,11 @@ sectionTemplate.innerHTML = '<label>' + t('sectionCode') + '</label><textarea cl
var editors = [] // array of all CodeMirror instances var editors = [] // array of all CodeMirror instances
// replace given textarea with the CodeMirror editor // replace given textarea with the CodeMirror editor
function setupCodeMirror(textarea) { function setupCodeMirror(textarea) {
var cm = CodeMirror.fromTextArea(textarea, { mode: 'css' }); var cm = CodeMirror.fromTextArea(textarea, {
mode: 'css',
lineNumbers: true,
lineWrapping: true
});
editors.push(cm); editors.push(cm);
} }
@ -187,6 +191,11 @@ function validate() {
} }
function save() { function save() {
// save the contents of the CodeMirror editors back into the textareas
for(var i=0; i < editors.length; i++) {
editors[i].save();
}
var error = validate(); var error = validate();
if (error) { if (error) {
alert(error); alert(error);