Saving now works, fixed styling
This commit is contained in:
parent
b87ab87ce0
commit
a6f3bb5c82
|
@ -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
11
edit.js
|
@ -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);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user