Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

json-editor

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

json-editor - npm Package Compare versions

Comparing version 0.7.21 to 0.7.22

2

package.json

@@ -5,3 +5,3 @@ {

"description": "JSON Schema based editor",
"version": "0.7.21",
"version": "0.7.22",
"main": "dist/jsoneditor.js",

@@ -8,0 +8,0 @@ "author": {

@@ -139,2 +139,7 @@ JSON Editor

<tr>
<td>keep_oneof_values</td>
<td>If <code>true</code>, makes oneOf copy properties over when switching.</td>
<td><code>true</code></td>
</tr>
<tr>
<td>schema</td>

@@ -141,0 +146,0 @@ <td>A valid JSON Schema to use for the editor. Version 3 and Version 4 of the draft specification are supported.</td>

@@ -11,2 +11,5 @@ var JSONEditor = function(element,options) {

JSONEditor.prototype = {
// necessary since we remove the ctor property by doing a literal assignment. Without this
// the $isplainobject function will think that this is a plain object.
constructor: JSONEditor,
init: function() {

@@ -13,0 +16,0 @@ var self = this;

@@ -371,2 +371,8 @@ /**

},
isRequired: function() {
if(typeof this.schema.required === "boolean") return this.schema.required;
else if(this.parent && this.parent.schema && Array.isArray(this.parent.schema.required)) return this.parent.schema.required.indexOf(this.key) > -1;
else if(this.jsoneditor.options.required_by_default) return true;
else return false;
},
getDisplayText: function(arr) {

@@ -373,0 +379,0 @@ var disp = [];

@@ -27,13 +27,7 @@ // Enum Editor (used for objects and arrays with enumerated values)

this.container.appendChild(this.switcher);
this.switcher.style.width = 'auto';
this.switcher.style.display = 'inline-block';
this.switcher.style.marginLeft = '5px';
this.switcher.style.marginBottom = 0;
// Display area
this.display_area = this.theme.getIndentedPanel();
this.display_area.style.paddingTop = 0;
this.display_area.style.paddingBottom = 0;
this.container.appendChild(this.display_area);
if(this.options.hide_display) this.display_area.style.display = "none";

@@ -102,3 +96,3 @@

});
if(Array.isArray(el)) ret = '<ol>'+ret+'</ol>';

@@ -105,0 +99,0 @@ else ret = "<ul style='margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0;'>"+ret+'</ul>';

@@ -48,7 +48,7 @@ // Multiple Editor (for when `type` is an array)

var self = this;
if(!this.editors[i]) {
this.buildChildEditor(i);
}
self.type = i;

@@ -78,3 +78,3 @@

var schema;
if(typeof type === "string") {

@@ -107,7 +107,7 @@ schema = $extend({},self.schema);

self.editors[i].postBuild();
if(self.editors[i].header) self.editors[i].header.style.display = 'none';
self.editors[i].option = self.switcher_options[i];
holder.addEventListener('change_header_text',function() {

@@ -126,3 +126,3 @@ self.refreshHeaderText();

this.validators = [];
this.keep_values = true;

@@ -180,10 +180,6 @@ if(typeof this.jsoneditor.options.keep_oneof_values !== "undefined") this.keep_values = this.jsoneditor.options.keep_oneof_values;

e.stopPropagation();
self.switchEditor(self.display_text.indexOf(this.value));
self.onChange(true);
});
this.switcher.style.marginBottom = 0;
this.switcher.style.width = 'auto';
this.switcher.style.display = 'inline-block';
this.switcher.style.marginLeft = '5px';

@@ -196,5 +192,5 @@ this.editor_holder = document.createElement('div');

self.editors[i] = false;
var schema;
if(typeof type === "string") {

@@ -215,3 +211,3 @@ schema = $extend({},self.schema);

});
this.switchEditor(0);

@@ -224,3 +220,3 @@ },

}
this._super();

@@ -247,3 +243,3 @@ },

});
this.switchEditor(this.type);

@@ -266,3 +262,3 @@

var self = this;
// oneOf error paths need to remove the oneOf[i] part before passing to child editors

@@ -281,3 +277,3 @@ if(this.oneOf) {

});
editor.showValidationErrors(new_errors);

@@ -284,0 +280,0 @@ });

@@ -71,2 +71,9 @@ JSONEditor.defaults.editors.select = JSONEditor.AbstractEditor.extend({

});
if(!this.isRequired()){
self.enum_display.unshift(' ');
self.enum_options.unshift('undefined');
self.enum_values.unshift(undefined);
}
}

@@ -78,2 +85,9 @@ // Boolean

self.enum_values = [true,false];
if(!this.isRequired()){
self.enum_display.unshift(' ');
self.enum_options.unshift('undefined');
self.enum_values.unshift(undefined);
}
}

@@ -235,3 +249,3 @@ // Dynamic Enum

for(j=0; j<items.length; j++) {
if(this.enumSource[i].filter({i:j,item:items[j]})) new_items.push(items[j]);
if(this.enumSource[i].filter({i:j,item:items[j],watched:vars})) new_items.push(items[j]);
}

@@ -238,0 +252,0 @@ items = new_items;

@@ -19,3 +19,3 @@ JSONEditor.defaults.editors.string = JSONEditor.AbstractEditor.extend({

if(value === null) value = "";
if(value === null || typeof value === 'undefined') value = "";
else if(typeof value === "object") value = JSON.stringify(value);

@@ -22,0 +22,0 @@ else if(typeof value !== "string") value = ""+value;

@@ -1,6 +0,6 @@

/*! JSON Editor v0.7.21 - JSON Schema -> HTML Editor
/*! JSON Editor v0.7.22 - JSON Schema -> HTML Editor
* By Jeremy Dorn - https://github.com/jdorn/json-editor/
* Released under the MIT license
*
* Date: 2015-07-03
* Date: 2015-08-12
*/

@@ -7,0 +7,0 @@

JSONEditor.defaults.templates["default"] = function() {
return {
compile: function(template) {
var matches = template.match(/{{\s*([a-zA-Z0-9\-_\.]+)\s*}}/g);
var l = matches.length;
var matches = template.match(/{{\s*([a-zA-Z0-9\-_ \.]+)\s*}}/g);
var l = matches && matches.length;

@@ -14,3 +14,3 @@ // Shortcut if the template contains no variables

var get_replacement = function(i) {
var p = matches[i].replace(/[{}\s]+/g,'').split('.');
var p = matches[i].replace(/[{}]+/g,'').trim().split('.');
var n = p.length;

@@ -17,0 +17,0 @@ var func;

@@ -0,1 +1,11 @@

var matchKey = (function () {
var elem = document.documentElement;
if (elem.matches) return 'matches';
else if (elem.webkitMatchesSelector) return 'webkitMatchesSelector';
else if (elem.mozMatchesSelector) return 'mozMatchesSelector';
else if (elem.msMatchesSelector) return 'msMatchesSelector';
else if (elem.oMatchesSelector) return 'oMatchesSelector';
})();
JSONEditor.AbstractTheme = Class.extend({

@@ -36,3 +46,3 @@ getContainer: function() {

setGridColumnSize: function(el,size) {
},

@@ -75,3 +85,3 @@ getLink: function(text) {

}
return el;

@@ -112,6 +122,10 @@ },

switcher.style.backgroundColor = 'transparent';
switcher.style.height = 'auto';
switcher.style.display = 'inline-block';
switcher.style.fontStyle = 'italic';
switcher.style.fontWeight = 'normal';
switcher.style.height = 'auto';
switcher.style.marginBottom = 0;
switcher.style.marginLeft = '5px';
switcher.style.padding = '0 0 0 3px';
switcher.style.width = 'auto';
return switcher;

@@ -156,3 +170,3 @@ },

afterInputReady: function(input) {
},

@@ -169,3 +183,3 @@ getFormControl: function(label, input, description) {

}
if(description) el.appendChild(description);

@@ -266,8 +280,5 @@ return el;

closest: function(elem, selector) {
var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;
while (elem && elem !== document) {
try {
var f = matchesSelector.bind(elem);
if (f(selector)) {
if (matchKey) {
if (elem[matchKey](selector)) {
return elem;

@@ -278,3 +289,3 @@ } else {

}
catch(e) {
else {
return false;

@@ -281,0 +292,0 @@ }

/**
* Taken from jQuery 1
* Taken from jQuery 2.1.3
*
* @param obj
* @returns {*}
* @returns {boolean}
*/
var $isplainobject = function( obj ) {
var key;
// Must be an Object.
// Because of IE, we also have to check the presence of the constructor property.
// Make sure that DOM nodes and window objects don't pass through, as well
if ( !obj || typeof obj !== "object" || obj.nodeType || obj === window ) {
// Not plain objects:
// - Any object or value whose internal [[Class]] property is not "[object Object]"
// - DOM nodes
// - window
if (typeof obj !== "object" || obj.nodeType || (obj !== null && obj === obj.window)) {
return false;
}
// Not own constructor property must be Object
if (obj.constructor &&
!obj.hasOwnProperty('constructor') &&
!obj.constructor.prototype.hasOwnProperty('isPrototypeOf')) {
if (obj.constructor && !Object.prototype.hasOwnProperty.call(obj.constructor.prototype, "isPrototypeOf")) {
return false;
}
try {
// Not own constructor property must be Object
if ( obj.constructor &&
!obj.hasOwnProperty("constructor") &&
!obj.constructor.prototype.hasOwnProperty('isPrototypeOf') ) {
return false;
}
} catch ( e ) {
// IE8,9 Will throw exceptions on certain host objects #9897
return false;
}
// Support: IE<9
// Handle iteration over inherited properties before own properties.
if ( /msie 8\.0/i.test( window.navigator.userAgent ) ) {
for ( key in obj ) {
return obj.hasOwnProperty(key);
}
}
// Own properties are enumerated firstly, so to speed up,
// if last one is own, then all properties are own.
for ( key in obj ) {}
return key === undefined || obj.hasOwnProperty(key);
// If the function hasn't returned already, we're confident that
// |obj| is a plain object, created by {} or constructed with new Object
return true;
};

@@ -77,6 +52,14 @@

else {
for(i in obj) {
if(!obj.hasOwnProperty(i)) continue;
if(callback(i,obj[i])===false) return;
if (Object.keys) {
var keys = Object.keys(obj);
for(i=0; i<keys.length; i++) {
if(callback(keys[i],obj[keys[i]])===false) return;
}
}
else {
for(i in obj) {
if(!obj.hasOwnProperty(i)) continue;
if(callback(i,obj[i])===false) return;
}
}
}

@@ -83,0 +66,0 @@ };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc