Skip to content

Commit

Permalink
Version bump - 0.7.13
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeremy Dorn committed Nov 11, 2014
1 parent 4b653e6 commit f56263e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 23 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "json-editor",
"version": "0.7.12",
"version": "0.7.13",
"authors": [
"Jeremy Dorn <[email protected]>"
],
Expand Down
48 changes: 35 additions & 13 deletions dist/jsoneditor.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*! JSON Editor v0.7.12 - JSON Schema -> HTML Editor
/*! JSON Editor v0.7.13 - JSON Schema -> HTML Editor
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
* Released under the MIT license
*
* Date: 2014-10-05
* Date: 2014-11-11
*/

/**
Expand Down Expand Up @@ -253,6 +253,7 @@ JSONEditor.prototype = {

// Fire ready event asynchronously
window.requestAnimationFrame(function() {
if(!self.ready) return;
self.validation_results = self.validator.validate(self.root.getValue());
self.root.showValidationErrors(self.validation_results);
self.trigger('ready');
Expand Down Expand Up @@ -389,7 +390,8 @@ JSONEditor.prototype = {

window.requestAnimationFrame(function() {
self.firing_change = false;

if(!self.ready) return;

// Validate and cache results
self.validation_results = self.validator.validate(self.root.getValue());

Expand Down Expand Up @@ -2677,19 +2679,40 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
if(this.editing_json) this.hideEditJSON();
else this.showEditJSON();
},
insertPropertyControlUsingPropertyOrder: function (property, control, container) {
var propertyOrder = this.schema.properties[property].propertyOrder;
if (typeof propertyOrder !== "number") propertyOrder = 1000;
control.propertyOrder = propertyOrder;

for (var i = 0; i < container.childNodes.length; i++) {
var child = container.childNodes[i];
if (control.propertyOrder < child.propertyOrder) {
this.addproperty_list.insertBefore(control, child);
control = null;
break;
}
}
if (control) {
this.addproperty_list.appendChild(control);
}
},
addPropertyCheckbox: function(key) {
var self = this;
var checkbox, label, control;
var checkbox, label, labelText, control;

checkbox = self.theme.getCheckbox();
checkbox.style.width = 'auto';
label = self.theme.getCheckboxLabel(key);

labelText = this.schema.properties[key].title ? this.schema.properties[key].title : key;
label = self.theme.getCheckboxLabel(labelText);

control = self.theme.getFormControl(label,checkbox);
control.style.paddingBottom = control.style.marginBottom = control.style.paddingTop = control.style.marginTop = 0;
control.style.height = 'auto';
//control.style.overflowY = 'hidden';
self.addproperty_list.appendChild(control);


this.insertPropertyControlUsingPropertyOrder(key, control, this.addproperty_list);

checkbox.checked = key in this.editors;
checkbox.addEventListener('change',function() {
if(checkbox.checked) {
Expand Down Expand Up @@ -2797,7 +2820,7 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
this._super(editor);
},
canHaveAdditionalProperties: function() {
return this.schema.additionalProperties !== false && !this.jsoneditor.options.no_additional_properties;
return (this.schema.additionalProperties === true) || !this.jsoneditor.options.no_additional_properties;
},
destroy: function() {
$each(this.cached_editors, function(i,el) {
Expand Down Expand Up @@ -2837,7 +2860,7 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
if(this.adding_property) this.refreshAddProperties();
},
refreshAddProperties: function() {
if(this.options.disable_properties || this.jsoneditor.options.disable_properties) {
if(this.options.disable_properties || (this.options.disable_properties !== false && this.jsoneditor.options.disable_properties)) {
this.addproperty_controls.style.display = 'none';
return;
}
Expand Down Expand Up @@ -2897,7 +2920,6 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
if(this.cached_editors[i]) continue;
show_modal = true;
this.addPropertyCheckbox(i);
this.addproperty_checkboxes[i].disabled = !can_add;
}

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

if(!input.errmsg) {
input.insertAdjacentHTML('afterend','<small class="errormsg"></small>');
input.errmsg = input.parentNode.getElementsByClassName('errormsg')[0];
input.insertAdjacentHTML('afterend','<small class="error"></small>');
input.errmsg = input.parentNode.getElementsByClassName('error')[0];
}
else {
input.errmsg.style.display = '';
Expand Down
12 changes: 6 additions & 6 deletions dist/jsoneditor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "json-editor",
"title": "JSONEditor",
"description": "JSON Schema based editor",
"version": "0.7.12",
"version": "0.7.13",
"main": "dist/jsoneditor.js",
"author": {
"name": "Jeremy Dorn",
Expand Down
4 changes: 2 additions & 2 deletions src/intro.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/*! JSON Editor v0.7.12 - JSON Schema -> HTML Editor
/*! JSON Editor v0.7.13 - JSON Schema -> HTML Editor
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
* Released under the MIT license
*
* Date: 2014-10-05
* Date: 2014-11-11
*/

/**
Expand Down

0 comments on commit f56263e

Please sign in to comment.