Skip to content

Commit f56263e

Browse files
author
Jeremy Dorn
committed
Version bump - 0.7.13
1 parent 4b653e6 commit f56263e

File tree

5 files changed

+45
-23
lines changed

5 files changed

+45
-23
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "json-editor",
3-
"version": "0.7.12",
3+
"version": "0.7.13",
44
"authors": [
55
"Jeremy Dorn <[email protected]>"
66
],

dist/jsoneditor.js

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*! JSON Editor v0.7.12 - JSON Schema -> HTML Editor
1+
/*! JSON Editor v0.7.13 - JSON Schema -> HTML Editor
22
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
33
* Released under the MIT license
44
*
5-
* Date: 2014-10-05
5+
* Date: 2014-11-11
66
*/
77

88
/**
@@ -253,6 +253,7 @@ JSONEditor.prototype = {
253253

254254
// Fire ready event asynchronously
255255
window.requestAnimationFrame(function() {
256+
if(!self.ready) return;
256257
self.validation_results = self.validator.validate(self.root.getValue());
257258
self.root.showValidationErrors(self.validation_results);
258259
self.trigger('ready');
@@ -389,7 +390,8 @@ JSONEditor.prototype = {
389390

390391
window.requestAnimationFrame(function() {
391392
self.firing_change = false;
392-
393+
if(!self.ready) return;
394+
393395
// Validate and cache results
394396
self.validation_results = self.validator.validate(self.root.getValue());
395397

@@ -2677,19 +2679,40 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
26772679
if(this.editing_json) this.hideEditJSON();
26782680
else this.showEditJSON();
26792681
},
2682+
insertPropertyControlUsingPropertyOrder: function (property, control, container) {
2683+
var propertyOrder = this.schema.properties[property].propertyOrder;
2684+
if (typeof propertyOrder !== "number") propertyOrder = 1000;
2685+
control.propertyOrder = propertyOrder;
2686+
2687+
for (var i = 0; i < container.childNodes.length; i++) {
2688+
var child = container.childNodes[i];
2689+
if (control.propertyOrder < child.propertyOrder) {
2690+
this.addproperty_list.insertBefore(control, child);
2691+
control = null;
2692+
break;
2693+
}
2694+
}
2695+
if (control) {
2696+
this.addproperty_list.appendChild(control);
2697+
}
2698+
},
26802699
addPropertyCheckbox: function(key) {
26812700
var self = this;
2682-
var checkbox, label, control;
2683-
2701+
var checkbox, label, labelText, control;
2702+
26842703
checkbox = self.theme.getCheckbox();
26852704
checkbox.style.width = 'auto';
2686-
label = self.theme.getCheckboxLabel(key);
2705+
2706+
labelText = this.schema.properties[key].title ? this.schema.properties[key].title : key;
2707+
label = self.theme.getCheckboxLabel(labelText);
2708+
26872709
control = self.theme.getFormControl(label,checkbox);
26882710
control.style.paddingBottom = control.style.marginBottom = control.style.paddingTop = control.style.marginTop = 0;
26892711
control.style.height = 'auto';
26902712
//control.style.overflowY = 'hidden';
2691-
self.addproperty_list.appendChild(control);
2692-
2713+
2714+
this.insertPropertyControlUsingPropertyOrder(key, control, this.addproperty_list);
2715+
26932716
checkbox.checked = key in this.editors;
26942717
checkbox.addEventListener('change',function() {
26952718
if(checkbox.checked) {
@@ -2797,7 +2820,7 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
27972820
this._super(editor);
27982821
},
27992822
canHaveAdditionalProperties: function() {
2800-
return this.schema.additionalProperties !== false && !this.jsoneditor.options.no_additional_properties;
2823+
return (this.schema.additionalProperties === true) || !this.jsoneditor.options.no_additional_properties;
28012824
},
28022825
destroy: function() {
28032826
$each(this.cached_editors, function(i,el) {
@@ -2837,7 +2860,7 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
28372860
if(this.adding_property) this.refreshAddProperties();
28382861
},
28392862
refreshAddProperties: function() {
2840-
if(this.options.disable_properties || this.jsoneditor.options.disable_properties) {
2863+
if(this.options.disable_properties || (this.options.disable_properties !== false && this.jsoneditor.options.disable_properties)) {
28412864
this.addproperty_controls.style.display = 'none';
28422865
return;
28432866
}
@@ -2897,7 +2920,6 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
28972920
if(this.cached_editors[i]) continue;
28982921
show_modal = true;
28992922
this.addPropertyCheckbox(i);
2900-
this.addproperty_checkboxes[i].disabled = !can_add;
29012923
}
29022924

29032925
// If no editors can be added or removed, hide the modal button
@@ -6050,8 +6072,8 @@ JSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({
60506072
input.group.className += ' error';
60516073

60526074
if(!input.errmsg) {
6053-
input.insertAdjacentHTML('afterend','<small class="errormsg"></small>');
6054-
input.errmsg = input.parentNode.getElementsByClassName('errormsg')[0];
6075+
input.insertAdjacentHTML('afterend','<small class="error"></small>');
6076+
input.errmsg = input.parentNode.getElementsByClassName('error')[0];
60556077
}
60566078
else {
60576079
input.errmsg.style.display = '';

dist/jsoneditor.min.js

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "json-editor",
33
"title": "JSONEditor",
44
"description": "JSON Schema based editor",
5-
"version": "0.7.12",
5+
"version": "0.7.13",
66
"main": "dist/jsoneditor.js",
77
"author": {
88
"name": "Jeremy Dorn",

src/intro.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
/*! JSON Editor v0.7.12 - JSON Schema -> HTML Editor
1+
/*! JSON Editor v0.7.13 - JSON Schema -> HTML Editor
22
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
33
* Released under the MIT license
44
*
5-
* Date: 2014-10-05
5+
* Date: 2014-11-11
66
*/
77

88
/**

0 commit comments

Comments
 (0)