|
1 | | -/*! JSON Editor v0.7.4 - JSON Schema -> HTML Editor |
| 1 | +/*! JSON Editor v0.7.5 - JSON Schema -> HTML Editor |
2 | 2 | * By Jeremy Dorn - https://github.com/jdorn/json-editor/ |
3 | 3 | * Released under the MIT license |
4 | 4 | * |
5 | | - * Date: 2014-07-29 |
| 5 | + * Date: 2014-08-10 |
6 | 6 | */ |
7 | 7 |
|
8 | 8 | /** |
@@ -1735,9 +1735,10 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({ |
1735 | 1735 | return; |
1736 | 1736 | } |
1737 | 1737 |
|
1738 | | - value = value || ''; |
1739 | | - if(typeof value === "object") value = JSON.stringify(value); |
1740 | | - if(typeof value !== "string") value = ""+value; |
| 1738 | + if(value === null) value = ""; |
| 1739 | + else if(typeof value === "object") value = JSON.stringify(value); |
| 1740 | + else if(typeof value !== "string") value = ""+value; |
| 1741 | + |
1741 | 1742 | if(value === this.serialized) return; |
1742 | 1743 |
|
1743 | 1744 | // Sanitize value before setting it |
@@ -1780,7 +1781,7 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({ |
1780 | 1781 | this.jsoneditor.notifyWatchers(this.path); |
1781 | 1782 | }, |
1782 | 1783 | getNumColumns: function() { |
1783 | | - var min = Math.ceil(this.getTitle().length/5); |
| 1784 | + var min = Math.ceil(Math.max(this.getTitle().length,this.schema.maxLength||0,this.schema.minLength||0)/5); |
1784 | 1785 | var num; |
1785 | 1786 |
|
1786 | 1787 | if(this.input_type === 'textarea') num = 6; |
@@ -3888,12 +3889,12 @@ JSONEditor.defaults.editors.table = JSONEditor.defaults.editors.array.extend({ |
3888 | 3889 | this.container.appendChild(this.title); |
3889 | 3890 | this.title_controls = this.theme.getHeaderButtonHolder(); |
3890 | 3891 | this.title.appendChild(this.title_controls); |
3891 | | - this.panel = this.theme.getIndentedPanel(); |
3892 | | - this.container.appendChild(this.panel); |
3893 | 3892 | if(this.schema.description) { |
3894 | 3893 | this.description = this.theme.getDescription(this.schema.description); |
3895 | | - this.panel.appendChild(this.description); |
| 3894 | + this.container.appendChild(this.description); |
3896 | 3895 | } |
| 3896 | + this.panel = this.theme.getIndentedPanel(); |
| 3897 | + this.container.appendChild(this.panel); |
3897 | 3898 | this.error_holder = document.createElement('div'); |
3898 | 3899 | this.panel.appendChild(this.error_holder); |
3899 | 3900 | } |
@@ -4842,9 +4843,10 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({ |
4842 | 4843 |
|
4843 | 4844 | self.value = self.enum_values[self.enum_options.indexOf(val)]; |
4844 | 4845 |
|
| 4846 | + self.watch_listener(); |
| 4847 | + self.notify(); |
4845 | 4848 | if(self.parent) self.parent.onChildEditorChange(self); |
4846 | 4849 | else self.jsoneditor.onChange(); |
4847 | | - self.jsoneditor.notifyWatchers(self.path); |
4848 | 4850 | }); |
4849 | 4851 |
|
4850 | 4852 | this.control = this.theme.getFormControl(this.label, this.input, this.description); |
|
0 commit comments