File tree Expand file tree Collapse file tree 11 files changed +49
-37
lines changed
Expand file tree Collapse file tree 11 files changed +49
-37
lines changed Original file line number Diff line number Diff line change @@ -29,20 +29,22 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
2929 }
3030 } ,
3131 enable : function ( ) {
32- if ( this . add_row_button ) this . add_row_button . disabled = false ;
33- if ( this . remove_all_rows_button ) this . remove_all_rows_button . disabled = false ;
34- if ( this . delete_last_row_button ) this . delete_last_row_button . disabled = false ;
35-
36- if ( this . rows ) {
37- for ( var i = 0 ; i < this . rows . length ; i ++ ) {
38- this . rows [ i ] . enable ( ) ;
39-
40- if ( this . rows [ i ] . moveup_button ) this . rows [ i ] . moveup_button . disabled = false ;
41- if ( this . rows [ i ] . movedown_button ) this . rows [ i ] . movedown_button . disabled = false ;
42- if ( this . rows [ i ] . delete_button ) this . rows [ i ] . delete_button . disabled = false ;
32+ if ( ! this . always_disabled ) {
33+ if ( this . add_row_button ) this . add_row_button . disabled = false ;
34+ if ( this . remove_all_rows_button ) this . remove_all_rows_button . disabled = false ;
35+ if ( this . delete_last_row_button ) this . delete_last_row_button . disabled = false ;
36+
37+ if ( this . rows ) {
38+ for ( var i = 0 ; i < this . rows . length ; i ++ ) {
39+ this . rows [ i ] . enable ( ) ;
40+
41+ if ( this . rows [ i ] . moveup_button ) this . rows [ i ] . moveup_button . disabled = false ;
42+ if ( this . rows [ i ] . movedown_button ) this . rows [ i ] . movedown_button . disabled = false ;
43+ if ( this . rows [ i ] . delete_button ) this . rows [ i ] . delete_button . disabled = false ;
44+ }
4345 }
46+ this . _super ( ) ;
4447 }
45- this . _super ( ) ;
4648 } ,
4749 disable : function ( ) {
4850 if ( this . add_row_button ) this . add_row_button . disabled = true ;
Original file line number Diff line number Diff line change @@ -67,8 +67,10 @@ JSONEditor.defaults.editors.base64 = JSONEditor.AbstractEditor.extend({
6767 }
6868 } ,
6969 enable : function ( ) {
70- if ( this . uploader ) this . uploader . disabled = false ;
71- this . _super ( ) ;
70+ if ( ! this . always_disabled ) {
71+ if ( this . uploader ) this . uploader . disabled = false ;
72+ this . _super ( ) ;
73+ }
7274 } ,
7375 disable : function ( ) {
7476 if ( this . uploader ) this . uploader . disabled = true ;
Original file line number Diff line number Diff line change @@ -45,8 +45,8 @@ JSONEditor.defaults.editors.checkbox = JSONEditor.AbstractEditor.extend({
4545 enable : function ( ) {
4646 if ( ! this . always_disabled ) {
4747 this . input . disabled = false ;
48+ this . _super ( ) ;
4849 }
49- this . _super ( ) ;
5050 } ,
5151 disable : function ( ) {
5252 this . input . disabled = true ;
Original file line number Diff line number Diff line change @@ -62,8 +62,10 @@ JSONEditor.defaults.editors["enum"] = JSONEditor.AbstractEditor.extend({
6262 this . display_area . innerHTML = this . html_values [ this . selected ] ;
6363 } ,
6464 enable : function ( ) {
65- if ( ! this . always_disabled ) this . switcher . disabled = false ;
66- this . _super ( ) ;
65+ if ( ! this . always_disabled ) {
66+ this . switcher . disabled = false ;
67+ this . _super ( ) ;
68+ }
6769 } ,
6870 disable : function ( ) {
6971 this . switcher . disabled = true ;
Original file line number Diff line number Diff line change @@ -24,14 +24,16 @@ JSONEditor.defaults.editors.multiple = JSONEditor.AbstractEditor.extend({
2424 return Math . max ( this . editors [ this . type ] . getNumColumns ( ) , 4 ) ;
2525 } ,
2626 enable : function ( ) {
27- if ( this . editors ) {
28- for ( var i = 0 ; i < this . editors . length ; i ++ ) {
29- if ( ! this . editors [ i ] ) continue ;
30- this . editors [ i ] . enable ( ) ;
27+ if ( ! this . always_disabled ) {
28+ if ( this . editors ) {
29+ for ( var i = 0 ; i < this . editors . length ; i ++ ) {
30+ if ( ! this . editors [ i ] ) continue ;
31+ this . editors [ i ] . enable ( ) ;
32+ }
3133 }
34+ this . switcher . disabled = false ;
35+ this . _super ( ) ;
3236 }
33- this . switcher . disabled = false ;
34- this . _super ( ) ;
3537 } ,
3638 disable : function ( ) {
3739 if ( this . editors ) {
Original file line number Diff line number Diff line change @@ -176,8 +176,8 @@ JSONEditor.defaults.editors.multiselect = JSONEditor.AbstractEditor.extend({
176176 }
177177 }
178178 if ( this . select2 ) this . select2 . select2 ( "enable" , true ) ;
179+ this . _super ( ) ;
179180 }
180- this . _super ( ) ;
181181 } ,
182182 disable : function ( ) {
183183 if ( this . input ) {
Original file line number Diff line number Diff line change @@ -27,14 +27,16 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
2727 return Math . max ( Math . min ( 12 , this . maxwidth ) , 3 ) ;
2828 } ,
2929 enable : function ( ) {
30- if ( this . editjson_button ) this . editjson_button . disabled = false ;
31- if ( this . addproperty_button ) this . addproperty_button . disabled = false ;
32-
33- this . _super ( ) ;
34- if ( this . editors ) {
35- for ( var i in this . editors ) {
36- if ( ! this . editors . hasOwnProperty ( i ) ) continue ;
37- this . editors [ i ] . enable ( ) ;
30+ if ( ! this . always_disabled ) {
31+ if ( this . editjson_button ) this . editjson_button . disabled = false ;
32+ if ( this . addproperty_button ) this . addproperty_button . disabled = false ;
33+
34+ this . _super ( ) ;
35+ if ( this . editors ) {
36+ for ( var i in this . editors ) {
37+ if ( ! this . editors . hasOwnProperty ( i ) ) continue ;
38+ this . editors [ i ] . enable ( ) ;
39+ }
3840 }
3941 }
4042 } ,
Original file line number Diff line number Diff line change @@ -333,8 +333,8 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({
333333 if ( ! this . always_disabled ) {
334334 this . input . disabled = false ;
335335 if ( this . select2 ) this . select2 . select2 ( "enable" , true ) ;
336+ this . _super ( ) ;
336337 }
337- this . _super ( ) ;
338338 } ,
339339 disable : function ( ) {
340340 this . input . disabled = true ;
Original file line number Diff line number Diff line change @@ -324,8 +324,8 @@ JSONEditor.defaults.editors.selectize = JSONEditor.AbstractEditor.extend({
324324 if ( this . selectize ) {
325325 this . selectize [ 0 ] . selectize . unlock ( ) ;
326326 }
327+ this . _super ( ) ;
327328 }
328- this . _super ( ) ;
329329 } ,
330330 disable : function ( ) {
331331 this . input . disabled = true ;
Original file line number Diff line number Diff line change @@ -277,8 +277,8 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
277277 if ( ! this . always_disabled ) {
278278 this . input . disabled = false ;
279279 // TODO: WYSIWYG and Markdown editors
280+ this . _super ( ) ;
280281 }
281- this . _super ( ) ;
282282 } ,
283283 disable : function ( ) {
284284 this . input . disabled = true ;
You can’t perform that action at this time.
0 commit comments