json-editor
Advanced tools
Comparing version
{ | ||
"name": "json-editor", | ||
"version": "0.7.11", | ||
"version": "0.7.12", | ||
"authors": [ | ||
@@ -5,0 +5,0 @@ "Jeremy Dorn <jeremy@jeremydorn.com>" |
@@ -5,3 +5,3 @@ { | ||
"description": "JSON Schema based editor", | ||
"version": "0.7.11", | ||
"version": "0.7.12", | ||
"main": "dist/jsoneditor.js", | ||
@@ -8,0 +8,0 @@ "author": { |
@@ -112,2 +112,4 @@ var JSONEditor = function(element,options) { | ||
this.callbacks[event].push(callback); | ||
return this; | ||
}, | ||
@@ -135,2 +137,4 @@ off: function(event, callback) { | ||
} | ||
return this; | ||
}, | ||
@@ -143,3 +147,17 @@ trigger: function(event) { | ||
} | ||
return this; | ||
}, | ||
setOption: function(option, value) { | ||
if(option === "show_errors") { | ||
this.options.show_errors = value; | ||
this.onChange(); | ||
} | ||
// Only the `show_errors` option is supported for now | ||
else { | ||
throw "Option "+option+" must be set during instantiation and cannot be changed later"; | ||
} | ||
return this; | ||
}, | ||
getEditorClass: function(schema) { | ||
@@ -186,2 +204,5 @@ var classname; | ||
} | ||
else { | ||
self.root.showValidationErrors([]); | ||
} | ||
@@ -191,2 +212,4 @@ // Fire change event | ||
}); | ||
return this; | ||
}, | ||
@@ -497,6 +520,6 @@ compileTemplate: function(template, name) { | ||
// Type should be intersected and is either an array or string | ||
else if(prop === 'type') { | ||
else if(prop === 'type' && (typeof val === "string" || Array.isArray(val))) { | ||
// Make sure we're dealing with arrays | ||
if(typeof val !== "object") val = [val]; | ||
if(typeof obj2.type !== "object") obj2.type = [obj2.type]; | ||
if(typeof val === "string") val = [val]; | ||
if(typeof obj2.type === "string") obj2.type = [obj2.type]; | ||
@@ -503,0 +526,0 @@ |
@@ -385,5 +385,5 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({ | ||
if(this.jsoneditor.options.show_errors === "always") {} | ||
else if(!this.is_dirty) return; | ||
else if(!this.is_dirty && this.previous_error_setting===this.jsoneditor.options.show_errors) return; | ||
this.previous_error_setting = this.jsoneditor.options.show_errors; | ||
@@ -390,0 +390,0 @@ var messages = []; |
@@ -1,6 +0,6 @@ | ||
/*! JSON Editor v0.7.11 - JSON Schema -> HTML Editor | ||
/*! JSON Editor v0.7.12 - JSON Schema -> HTML Editor | ||
* By Jeremy Dorn - https://github.com/jdorn/json-editor/ | ||
* Released under the MIT license | ||
* | ||
* Date: 2014-09-28 | ||
* Date: 2014-10-05 | ||
*/ | ||
@@ -7,0 +7,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
663495
0.27%13182
0.3%