1
- /*! JSON Editor v0.6.8 - JSON Schema -> HTML Editor
1
+ /*! JSON Editor v0.6.9 - 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-05-09
5
+ * Date: 2014-05-23
6
6
*/
7
7
8
8
/**
@@ -179,12 +179,12 @@ JSONEditor.prototype = {
179
179
// Starting data
180
180
if ( self . options . startval ) self . root . setValue ( self . options . startval ) ;
181
181
182
- self . validation_results = self . validator . validate ( self . root . getValue ( ) ) ;
183
- self . root . showValidationErrors ( self . validation_results ) ;
184
182
self . ready = true ;
185
183
186
184
// Fire ready event asynchronously
187
185
requestAnimationFrame ( function ( ) {
186
+ self . validation_results = self . validator . validate ( self . root . getValue ( ) ) ;
187
+ self . root . showValidationErrors ( self . validation_results ) ;
188
188
self . trigger ( 'ready' ) ;
189
189
self . trigger ( 'change' ) ;
190
190
} ) ;
@@ -199,7 +199,6 @@ JSONEditor.prototype = {
199
199
if ( ! this . ready ) throw "JSON Editor not ready yet. Listen for 'ready' event before setting the value" ;
200
200
201
201
this . root . setValue ( value ) ;
202
- this . validation_results = this . validator . validate ( this . root . getValue ( ) ) ;
203
202
return this ;
204
203
} ,
205
204
validate : function ( value ) {
@@ -267,7 +266,7 @@ JSONEditor.prototype = {
267
266
this . callbacks [ event ] [ i ] ( ) ;
268
267
}
269
268
}
270
- } ,
269
+ } ,
271
270
getEditorClass : function ( schema , editor ) {
272
271
var classname ;
273
272
@@ -342,7 +341,7 @@ JSONEditor.prototype = {
342
341
uuid = this . uuid ++ ;
343
342
el . setAttribute ( 'data-jsoneditor-' + key , uuid ) ;
344
343
}
345
-
344
+
346
345
this . __data [ uuid ] = value ;
347
346
}
348
347
// Getting data
@@ -367,7 +366,7 @@ JSONEditor.prototype = {
367
366
if ( ! this . editors ) return ;
368
367
return this . editors [ path ] ;
369
368
} ,
370
- watch : function ( path , callback ) {
369
+ watch : function ( path , callback ) {
371
370
this . watchlist = this . watchlist || { } ;
372
371
this . watchlist [ path ] = this . watchlist [ path ] || [ ] ;
373
372
this . watchlist [ path ] . push ( callback ) ;
@@ -5110,6 +5109,7 @@ JSONEditor.AbstractTheme = Class.extend({
5110
5109
} ,
5111
5110
getFormControl : function ( label , input , description ) {
5112
5111
var el = document . createElement ( 'div' ) ;
5112
+ el . className = 'form-control' ;
5113
5113
if ( label ) el . appendChild ( label ) ;
5114
5114
if ( input . type === 'checkbox' ) {
5115
5115
label . insertBefore ( input , label . firstChild ) ;
@@ -5149,7 +5149,7 @@ JSONEditor.AbstractTheme = Class.extend({
5149
5149
getButtonHolder : function ( ) {
5150
5150
return document . createElement ( 'div' ) ;
5151
5151
} ,
5152
- getButton : function ( text , icon , title ) {
5152
+ getButton : function ( text , icon , title ) {
5153
5153
var el = document . createElement ( 'button' ) ;
5154
5154
this . setButtonText ( el , text , icon , title ) ;
5155
5155
return el ;
@@ -5329,7 +5329,7 @@ JSONEditor.defaults.themes.bootstrap2 = JSONEditor.AbstractTheme.extend({
5329
5329
afterInputReady : function ( input ) {
5330
5330
if ( input . controlgroup ) return ;
5331
5331
input . controlgroup = this . closest ( input , '.control-group' ) ;
5332
- input . controls = this . closest ( input , 'controls' ) ;
5332
+ input . controls = this . closest ( input , '. controls' ) ;
5333
5333
if ( this . closest ( input , '.compact' ) ) {
5334
5334
input . controlgroup . className = input . controlgroup . className . replace ( / c o n t r o l - g r o u p / g, '' ) . replace ( / [ ] { 2 , } / g, ' ' ) ;
5335
5335
input . controls . className = input . controlgroup . className . replace ( / c o n t r o l s / g, '' ) . replace ( / [ ] { 2 , } / g, ' ' ) ;
@@ -5590,7 +5590,7 @@ JSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({
5590
5590
var el = document . createElement ( 'div' ) ;
5591
5591
el . style . marginBottom = '15px' ;
5592
5592
return el ;
5593
- } ,
5593
+ } ,
5594
5594
getSelectInput : function ( options ) {
5595
5595
var el = this . _super ( options ) ;
5596
5596
el . style . minWidth = 'none' ;
@@ -5665,6 +5665,7 @@ JSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({
5665
5665
} ,
5666
5666
removeInputError : function ( input ) {
5667
5667
if ( ! input . errmsg ) return ;
5668
+ input . group . className = input . group . className . replace ( / e r r o r / g, '' ) ;
5668
5669
input . errmsg . style . display = 'none' ;
5669
5670
}
5670
5671
} ) ;
0 commit comments