From 553c60a760a4d95f390cb8e3eab3ab372f28a4a8 Mon Sep 17 00:00:00 2001 From: Vincent Peybernes Date: Tue, 16 Aug 2016 15:40:13 +0200 Subject: [PATCH 1/3] Update demo to setup the new option "disable_type_switcher" --- demo.html | 1 + 1 file changed, 1 insertion(+) diff --git a/demo.html b/demo.html index 55c172b72..d84f8b644 100644 --- a/demo.html +++ b/demo.html @@ -94,6 +94,7 @@

Options

+ From 6a5d81dfaa3b7a53754783a864953fd0e9bdcade Mon Sep 17 00:00:00 2001 From: Vincent Peybernes Date: Tue, 16 Aug 2016 15:50:59 +0200 Subject: [PATCH 2/3] Implement switcher hiding by "disable_type_switcher" option. --- src/editors/multiple.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/editors/multiple.js b/src/editors/multiple.js index 71279e0a6..9e2d41b5d 100644 --- a/src/editors/multiple.js +++ b/src/editors/multiple.js @@ -171,6 +171,12 @@ JSONEditor.defaults.editors.multiple = JSONEditor.AbstractEditor.extend({ this.container.appendChild(this.header); this.switcher = this.theme.getSwitcher(this.display_text); + + // Disable the type switcher if specified + if(this.jsoneditor.options.disable_type_switcher){ + this.switcher.style.display = "none"; + } + container.appendChild(this.switcher); this.switcher.addEventListener('change',function(e) { e.preventDefault(); From 36c74c4054138dd8cc7cef5744c7a1e24b5fb2f3 Mon Sep 17 00:00:00 2001 From: Vincent Peybernes Date: Tue, 16 Aug 2016 16:13:42 +0200 Subject: [PATCH 3/3] Add documentation for "disable_type_switcher" option. --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index f1cfaba5d..456d23add 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,11 @@ Here are all the available options: If true, remove all Edit Properties buttons from objects. false + + disable_type_switcher + If true, remove all type switcher from objects. It's recommended to use it with disable_properties option. + false + form_name_root The first part of the `name` attribute of form inputs in the editor. An full example name is `root[person][name]` where "root" is the form_name_root.