Turn off line wrapping.

This commit is contained in:
cahrens
2013-02-12 15:27:38 -05:00
parent dd50313f82
commit f56729dbdb

View File

@@ -56,16 +56,21 @@ CMS.Views.Settings.Advanced = CMS.Views.ValidatingView.extend({
attachJSONEditor : function (textarea) {
var self = this;
CodeMirror.fromTextArea(textarea, {
mode: "application/json", lineNumbers: false, lineWrapping: true,
mode: "application/json", lineNumbers: false, lineWrapping: false,
onChange: function() {
self.showSaveCancelButtons();
},
onBlur: function (mirror) {
var key = $(mirror.getWrapperElement()).closest('.row').children('.key').attr('id');
var quotedValue = mirror.getValue();
// TODO: error checking
var JSONValue = JSON.parse(quotedValue);
self.model.set(key, JSONValue, {validate: true});
try {
var JSONValue = JSON.parse(quotedValue);
self.model.set(key, JSONValue, {validate: true});
}
catch (e) {
// TODO: error checking
console.log(e);
}
}
});
},