Skip to content

Commit 16ec92f

Browse files
yiwenliuyiwenliu
yiwenliu
authored and
yiwenliu
committed
If function disable is called with param always_disabled set to true, update flag always_disabled for any editor
1 parent fc0ea1b commit 16ec92f

11 files changed

+22
-11
lines changed

src/editors/array.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ JSONEditor.defaults.editors.array = JSONEditor.AbstractEditor.extend({
4646
this._super();
4747
}
4848
},
49-
disable: function() {
49+
disable: function(always_disabled) {
50+
if(always_disabled) this.always_disabled = true;
5051
if(this.add_row_button) this.add_row_button.disabled = true;
5152
if(this.remove_all_rows_button) this.remove_all_rows_button.disabled = true;
5253
if(this.delete_last_row_button) this.delete_last_row_button.disabled = true;

src/editors/base64.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,8 @@ JSONEditor.defaults.editors.base64 = JSONEditor.AbstractEditor.extend({
7272
this._super();
7373
}
7474
},
75-
disable: function() {
75+
disable: function(always_disabled) {
76+
if(always_disabled) this.always_disabled = true;
7677
if(this.uploader) this.uploader.disabled = true;
7778
this._super();
7879
},

src/editors/checkbox.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ JSONEditor.defaults.editors.checkbox = JSONEditor.AbstractEditor.extend({
4848
this._super();
4949
}
5050
},
51-
disable: function() {
51+
disable: function(always_disabled) {
52+
if(always_disabled) this.always_disabled = true;
5253
this.input.disabled = true;
5354
this._super();
5455
},

src/editors/enum.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ JSONEditor.defaults.editors["enum"] = JSONEditor.AbstractEditor.extend({
6767
this._super();
6868
}
6969
},
70-
disable: function() {
70+
disable: function(always_disabled) {
71+
if(always_disabled) this.always_disabled = true;
7172
this.switcher.disabled = true;
7273
this._super();
7374
},

src/editors/multiple.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ JSONEditor.defaults.editors.multiple = JSONEditor.AbstractEditor.extend({
3535
this._super();
3636
}
3737
},
38-
disable: function() {
38+
disable: function(always_disabled) {
39+
if(always_disabled) this.always_disabled = true;
3940
if(this.editors) {
4041
for(var i=0; i<this.editors.length; i++) {
4142
if(!this.editors[i]) continue;

src/editors/multiselect.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ JSONEditor.defaults.editors.multiselect = JSONEditor.AbstractEditor.extend({
179179
this._super();
180180
}
181181
},
182-
disable: function() {
182+
disable: function(always_disabled) {
183+
if(always_disabled) this.always_disabled = true;
183184
if(this.input) {
184185
this.input.disabled = true;
185186
}

src/editors/object.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
4040
}
4141
}
4242
},
43-
disable: function() {
43+
disable: function(always_disabled) {
44+
if(always_disabled) this.always_disabled = true;
4445
if(this.editjson_button) this.editjson_button.disabled = true;
4546
if(this.addproperty_button) this.addproperty_button.disabled = true;
4647
this.hideEditJSON();

src/editors/select.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,8 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({
336336
this._super();
337337
}
338338
},
339-
disable: function() {
339+
disable: function(always_disabled) {
340+
if(always_disabled) this.always_disabled = true;
340341
this.input.disabled = true;
341342
if(this.select2) this.select2.select2("enable",false);
342343
this._super();

src/editors/selectize.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,8 @@ JSONEditor.defaults.editors.selectize = JSONEditor.AbstractEditor.extend({
327327
this._super();
328328
}
329329
},
330-
disable: function() {
330+
disable: function(always_disabled) {
331+
if(always_disabled) this.always_disabled = true;
331332
this.input.disabled = true;
332333
if(this.selectize) {
333334
this.selectize[0].selectize.lock();

src/editors/string.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,8 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({
280280
this._super();
281281
}
282282
},
283-
disable: function() {
283+
disable: function(always_disabled) {
284+
if(always_disabled) this.always_disabled = true;
284285
this.input.disabled = true;
285286
// TODO: WYSIWYG and Markdown editors
286287
this._super();

src/editors/upload.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ JSONEditor.defaults.editors.upload = JSONEditor.AbstractEditor.extend({
114114
this._super();
115115
}
116116
},
117-
disable: function() {
117+
disable: function(always_disabled) {
118+
if(always_disabled) this.always_disabled = true;
118119
if(this.uploader) this.uploader.disabled = true;
119120
this._super();
120121
},

0 commit comments

Comments
 (0)