Skip to content

Commit 9746389

Browse files
committed
Version bump to 0.7.14
1 parent b1578f3 commit 9746389

File tree

5 files changed

+73
-23
lines changed

5 files changed

+73
-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.13",
3+
"version": "0.7.14",
44
"authors": [
55
"Jeremy Dorn <[email protected]>"
66
],

dist/jsoneditor.js

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

88
/**
@@ -1795,6 +1795,8 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
17951795

17961796
if(initial) this.is_dirty = false;
17971797
else if(this.jsoneditor.options.show_errors === "change") this.is_dirty = true;
1798+
1799+
if(this.adjust_height) this.adjust_height(this.input);
17981800

17991801
// Bubble this setValue to parents if the value changed
18001802
this.onChange(changed);
@@ -1921,7 +1923,12 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
19211923
if(typeof this.schema.pattern !== "undefined") this.input.setAttribute('pattern',this.schema.pattern);
19221924
else if(typeof this.schema.minLength !== "undefined") this.input.setAttribute('pattern','.{'+this.schema.minLength+',}');
19231925

1924-
if(this.options.compact) this.container.setAttribute('class',this.container.getAttribute('class')+' compact');
1926+
if(this.options.compact) {
1927+
this.container.className += ' compact';
1928+
}
1929+
else {
1930+
if(this.options.input_width) this.input.style.width = this.options.input_width;
1931+
}
19251932

19261933
if(this.schema.readOnly || this.schema.readonly || this.schema.template) {
19271934
this.always_disabled = true;
@@ -1952,6 +1959,42 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
19521959
self.refreshValue();
19531960
self.onChange(true);
19541961
});
1962+
1963+
if(this.options.input_height) this.input.style.height = this.options.input_height;
1964+
if(this.options.expand_height) {
1965+
this.adjust_height = function(el) {
1966+
if(!el) return;
1967+
var i, ch=el.offsetHeight;
1968+
// Input too short
1969+
if(el.offsetHeight < el.scrollHeight) {
1970+
i=0;
1971+
while(el.offsetHeight < el.scrollHeight+3) {
1972+
if(i>100) break;
1973+
i++;
1974+
ch++;
1975+
el.style.height = ch+'px';
1976+
}
1977+
}
1978+
else {
1979+
i=0;
1980+
while(el.offsetHeight >= el.scrollHeight+3) {
1981+
if(i>100) break;
1982+
i++;
1983+
ch--;
1984+
el.style.height = ch+'px';
1985+
}
1986+
el.style.height = (ch+1)+'px';
1987+
}
1988+
};
1989+
1990+
this.input.addEventListener('keyup',function(e) {
1991+
self.adjust_height(this);
1992+
});
1993+
this.input.addEventListener('change',function(e) {
1994+
self.adjust_height(this);
1995+
});
1996+
this.adjust_height();
1997+
}
19551998

19561999
if(this.format) this.input.setAttribute('data-schemaformat',this.format);
19572000

@@ -1964,6 +2007,7 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
19642007
// otherwise, in the case of an ace_editor creation,
19652008
// it will generate an error trying to append it to the missing parentNode
19662009
if(self.input.parentNode) self.afterInputReady();
2010+
if(self.adjust_height) self.adjust_height(self.input);
19672011
});
19682012

19692013
// Compile and store the template
@@ -2248,7 +2292,7 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
22482292
var editor = self.editors[key];
22492293
if(editor.property_removed) return;
22502294
var found = false;
2251-
var width = editor.options.hidden? 0 : editor.getNumColumns();
2295+
var width = editor.options.hidden? 0 : (editor.options.grid_columns || editor.getNumColumns());
22522296
var height = editor.options.hidden? 0 : editor.container.offsetHeight;
22532297
// See if the editor will fit in any of the existing rows first
22542298
for(var i=0; i<rows.length; i++) {
@@ -2389,7 +2433,7 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
23892433
});
23902434
self.editors[key].preBuild();
23912435

2392-
var width = self.editors[key].options.hidden? 0 : self.editors[key].getNumColumns();
2436+
var width = self.editors[key].options.hidden? 0 : (self.editors[key].options.grid_columns || self.editors[key].getNumColumns());
23932437

23942438
self.minwidth += width;
23952439
self.maxwidth += width;
@@ -2412,8 +2456,8 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
24122456
self.addObjectProperty(key, true);
24132457

24142458
if(self.editors[key]) {
2415-
self.minwidth = Math.max(self.minwidth,self.editors[key].getNumColumns());
2416-
self.maxwidth += self.editors[key].getNumColumns();
2459+
self.minwidth = Math.max(self.minwidth,(self.editors[key].options.grid_columns || self.editors[key].getNumColumns()));
2460+
self.maxwidth += (self.editors[key].options.grid_columns || self.editors[key].getNumColumns());
24172461
}
24182462
});
24192463
}
@@ -2446,6 +2490,9 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
24462490
if(self.editors[key].options.hidden) {
24472491
holder.style.display = 'none';
24482492
}
2493+
if(self.editors[key].options.input_width) {
2494+
holder.style.width = self.editors[key].options.input_width;
2495+
}
24492496
});
24502497
}
24512498
// If the object should be rendered as a table
@@ -3369,6 +3416,7 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
33693416
self.active_tab = new_active_tab;
33703417

33713418
self.refreshValue(initial);
3419+
self.refreshTabs(true);
33723420
self.refreshTabs();
33733421

33743422
self.onChange();
@@ -3798,11 +3846,13 @@ JSONEditor.defaults.editors.table = JSONEditor.defaults.editors.array.extend({
37983846
this.panel.appendChild(this.controls);
37993847

38003848
if(this.item_has_child_editors) {
3801-
$each(tmp.getChildEditors(), function(i,editor) {
3802-
var th = self.theme.getTableHeaderCell(editor.getTitle());
3803-
if(editor.options.hidden) th.style.display = 'none';
3849+
var ce = tmp.getChildEditors();
3850+
var order = tmp.property_order || Object.keys(ce);
3851+
for(var i=0; i<order.length; i++) {
3852+
var th = self.theme.getTableHeaderCell(ce[order[i]].getTitle());
3853+
if(ce[order[i]].options.hidden) th.style.display = 'none';
38043854
self.header_row.appendChild(th);
3805-
});
3855+
}
38063856
}
38073857
else {
38083858
self.header_row.appendChild(self.theme.getTableHeaderCell(this.item_title));
@@ -4672,7 +4722,7 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({
46724722
}
46734723
// Boolean
46744724
else if(this.schema.type === "boolean") {
4675-
self.enum_display = ['true','false'];
4725+
self.enum_display = this.schema.options && this.schema.options.enum_titles || ['true','false'];
46764726
self.enum_options = ['1',''];
46774727
self.enum_values = [true,false];
46784728
}
@@ -4743,7 +4793,7 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({
47434793
if(!this.options.compact) this.header = this.label = this.theme.getFormInputLabel(this.getTitle());
47444794
if(this.schema.description) this.description = this.theme.getFormInputDescription(this.schema.description);
47454795

4746-
if(this.options.compact) this.container.setAttribute('class',this.container.getAttribute('class')+' compact');
4796+
if(this.options.compact) this.container.className += ' compact';
47474797

47484798
this.input = this.theme.getSelectInput(this.enum_options);
47494799
this.theme.setSelectOptions(this.input,this.enum_options,this.enum_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.13",
5+
"version": "0.7.14",
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.13 - JSON Schema -> HTML Editor
1+
/*! JSON Editor v0.7.14 - JSON Schema -> HTML Editor
22
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
33
* Released under the MIT license
44
*
5-
* Date: 2014-11-11
5+
* Date: 2015-01-25
66
*/
77

88
/**

0 commit comments

Comments
 (0)