Skip to content

Adds JSONEditor.plugins.selectize.remove_button option and Semantic UI theme #644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
175 changes: 169 additions & 6 deletions dist/jsoneditor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/jsoneditor.js.map

Large diffs are not rendered by default.

16 changes: 14 additions & 2 deletions dist/jsoneditor.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/jsoneditor.min.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ JSONEditor.defaults.resolvers.unshift(function(schema) {
return "checkbox";
}
// Otherwise, default to select menu
return (JSONEditor.plugins.selectize.enable) ? 'selectize' : 'select';
return (JSONEditor.plugins.selectize.enable && !JSONEditor.plugins.selectize.multiArrayOnly) ? 'selectize' : 'select';
}
});
// Use the multiple editor for schemas where the `type` is set to "any"
Expand Down Expand Up @@ -280,7 +280,7 @@ JSONEditor.defaults.resolvers.unshift(function(schema) {
});
// Use the `select` editor for dynamic enumSource enums
JSONEditor.defaults.resolvers.unshift(function(schema) {
if(schema.enumSource) return (JSONEditor.plugins.selectize.enable) ? 'selectize' : 'select';
if(schema.enumSource) return (JSONEditor.plugins.selectize.enable && !JSONEditor.plugins.selectize.multiArrayOnly) ? 'selectize' : 'select';
});
// Use the `enum` or `select` editors for schemas with enumerated properties
JSONEditor.defaults.resolvers.unshift(function(schema) {
Expand All @@ -289,7 +289,7 @@ JSONEditor.defaults.resolvers.unshift(function(schema) {
return "enum";
}
else if(schema.type === "number" || schema.type === "integer" || schema.type === "string") {
return (JSONEditor.plugins.selectize.enable) ? 'selectize' : 'select';
return (JSONEditor.plugins.selectize.enable && !JSONEditor.plugins.selectize.multiArrayOnly) ? 'selectize' : 'select';
}
}
});
Expand Down
1 change: 1 addition & 0 deletions src/editors/array/selectize.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ JSONEditor.defaults.editors.arraySelectize = JSONEditor.AbstractEditor.extend({
this.container.appendChild(this.error_holder);

window.jQuery(this.input).selectize({
plugins: JSONEditor.plugins.selectize.remove_button ? ["remove_button"] : [],
delimiter: false,
createOnBlur: true,
create: true
Expand Down
5 changes: 2 additions & 3 deletions src/editors/object.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
}
// Normal layout
else {
container = document.createElement('div');
container = this.row_container;
container.innerHTML = '';
$each(this.property_order, function(i,key) {
var editor = self.editors[key];
if(editor.property_removed) return;
Expand All @@ -164,8 +165,6 @@ JSONEditor.defaults.editors.object = JSONEditor.AbstractEditor.extend({
row.appendChild(editor.container);
});
}
this.row_container.innerHTML = '';
this.row_container.appendChild(container);
},
getPropertySchema: function(key) {
// Schema declared directly in properties
Expand Down
Loading