From d332692804e8ad1f9dac581a8f994ce82dd42e3f Mon Sep 17 00:00:00 2001 From: Lailend Date: Mon, 25 Aug 2014 10:13:28 +0200 Subject: [PATCH 1/2] Added options to disabled support for Select2 --- src/editors/select.js | 3 ++- src/editors/string.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/editors/select.js b/src/editors/select.js index aef682cb1..60a218378 100644 --- a/src/editors/select.js +++ b/src/editors/select.js @@ -121,7 +121,8 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({ this.theme.afterInputReady(this.input); // If the Select2 library is loaded use it when we have lots of items - if(window.jQuery && window.jQuery.fn && window.jQuery.fn.select2 && this.enum_options.length > 2) { + var select2 = this.options.jsoneditor.options.select2; + if((select2 || select2 === undefined) && window.jQuery && window.jQuery.fn && window.jQuery.fn.select2 && this.enum_options.length > 2) { window.jQuery(this.input).select2(); } }, diff --git a/src/editors/string.js b/src/editors/string.js index 9ca6e58c0..ab347dd4a 100644 --- a/src/editors/string.js +++ b/src/editors/string.js @@ -286,7 +286,8 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({ this.container.appendChild(this.control); // If the Select2 library is loaded - if(this.input_type === "select" && window.jQuery && window.jQuery.fn && window.jQuery.fn.select2) { + var select2 = self.options.jsoneditor.options.select2; + if((select2 || select2 === undefined) && this.input_type === "select" && window.jQuery && window.jQuery.fn && window.jQuery.fn.select2) { window.jQuery(this.input).select2(); } From f898f74d0b7e858b245dccc81d08b1314a6e8ba6 Mon Sep 17 00:00:00 2001 From: Dirk-Jan Wassink Date: Mon, 25 Aug 2014 10:22:12 +0200 Subject: [PATCH 2/2] Also added option in source to disabled Select2 --- dist/jsoneditor.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/dist/jsoneditor.js b/dist/jsoneditor.js index ffbadaf8e..842d8a64e 100644 --- a/dist/jsoneditor.js +++ b/dist/jsoneditor.js @@ -2005,7 +2005,8 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({ this.container.appendChild(this.control); // If the Select2 library is loaded - if(this.input_type === "select" && window.jQuery && window.jQuery.fn && window.jQuery.fn.select2) { + var select2 = self.options.jsoneditor.options.select2; + if((select2 || select2 === undefined) && this.input_type === "select" && window.jQuery && window.jQuery.fn && window.jQuery.fn.select2) { window.jQuery(this.input).select2(); } @@ -4867,7 +4868,8 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({ this.theme.afterInputReady(this.input); // If the Select2 library is loaded use it when we have lots of items - if(window.jQuery && window.jQuery.fn && window.jQuery.fn.select2 && this.enum_options.length > 2) { + var select2 = this.options.jsoneditor.options.select2; + if((select2 || select2 === undefined) && window.jQuery && window.jQuery.fn && window.jQuery.fn.select2 && this.enum_options.length > 2) { window.jQuery(this.input).select2(); } },