|
1 |
| -/*! JSON Editor v0.6.12 - JSON Schema -> HTML Editor |
| 1 | +/*! JSON Editor v0.6.13 - JSON Schema -> HTML Editor |
2 | 2 | * By Jeremy Dorn - https://github.com/jdorn/json-editor/
|
3 | 3 | * Released under the MIT license
|
4 | 4 | *
|
@@ -234,6 +234,8 @@ JSONEditor.prototype = {
|
234 | 234 | // Starting data
|
235 | 235 | if(self.options.startval) self.root.setValue(self.options.startval);
|
236 | 236 |
|
| 237 | + self.validation_results = self.validator.validate(self.root.getValue()); |
| 238 | + self.root.showValidationErrors(self.validation_results); |
237 | 239 | self.ready = true;
|
238 | 240 |
|
239 | 241 | // Fire ready event asynchronously
|
@@ -2179,6 +2181,7 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
|
2179 | 2181 | $('#sceditor-start-marker,#sceditor-end-marker,.sceditor-nlf',val).remove();
|
2180 | 2182 | // Set the value and update
|
2181 | 2183 | self.input.value = val.html();
|
| 2184 | + self.value = self.input.value; |
2182 | 2185 | if(self.parent) self.parent.onChildEditorChange(self);
|
2183 | 2186 | else self.jsoneditor.onChange();
|
2184 | 2187 | self.jsoneditor.notifyWatchers(self.path);
|
@@ -2723,11 +2726,6 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
|
2723 | 2726 | self.maxwidth += self.editors[key].getNumColumns();
|
2724 | 2727 | });
|
2725 | 2728 |
|
2726 |
| - // Initial layout |
2727 |
| - this.layoutEditors(); |
2728 |
| - // Do it again now that we know the approximate heights of elements |
2729 |
| - this.layoutEditors(); |
2730 |
| - |
2731 | 2729 | // Control buttons
|
2732 | 2730 | this.title_controls = this.getTheme().getHeaderButtonHolder();
|
2733 | 2731 | this.editjson_controls = this.getTheme().getHeaderButtonHolder();
|
@@ -2792,6 +2790,27 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
|
2792 | 2790 | this.refreshAddProperties();
|
2793 | 2791 | }
|
2794 | 2792 |
|
| 2793 | + // Sort editors by propertyOrder |
| 2794 | + var sorted = {}; |
| 2795 | + var keys = Object.keys(this.editors); |
| 2796 | + keys = keys.sort(function(a,b) { |
| 2797 | + var ordera = self.editors[a].schema.propertyOrder; |
| 2798 | + var orderb = self.editors[b].schema.propertyOrder; |
| 2799 | + if(typeof ordera !== "number") ordera = 1000; |
| 2800 | + if(typeof orderb !== "number") orderb = 1000; |
| 2801 | + |
| 2802 | + return ordera - orderb; |
| 2803 | + }); |
| 2804 | + for(var i=0; i<keys.length; i++) { |
| 2805 | + sorted[keys[i]] = this.editors[keys[i]]; |
| 2806 | + } |
| 2807 | + this.editors = sorted; |
| 2808 | + |
| 2809 | + // Initial layout |
| 2810 | + this.layoutEditors(); |
| 2811 | + // Do it again now that we know the approximate heights of elements |
| 2812 | + this.layoutEditors(); |
| 2813 | + |
2795 | 2814 | this.jsoneditor.notifyWatchers(this.path);
|
2796 | 2815 | },
|
2797 | 2816 | showEditJSON: function() {
|
|
0 commit comments