diff --git a/bower.json b/bower.json index 299971637..f95b63d26 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "json-editor", - "version": "0.7.19", + "version": "0.7.20", "authors": [ "Jeremy Dorn " ], diff --git a/dist/jsoneditor.js b/dist/jsoneditor.js index ce8bbe0d5..001e5e901 100644 --- a/dist/jsoneditor.js +++ b/dist/jsoneditor.js @@ -1,4 +1,4 @@ -/*! JSON Editor v0.7.19 - JSON Schema -> HTML Editor +/*! JSON Editor v0.7.20 - JSON Schema -> HTML Editor * By Jeremy Dorn - https://github.com/jdorn/json-editor/ * Released under the MIT license * @@ -199,9 +199,9 @@ var $extend = function(destination) { }; var $each = function(obj,callback) { - if(!obj) return; + if(!obj || typeof obj !== "object") return; var i; - if(!obj.hasOwnProperty('length') && typeof obj.length === 'number') { + if(Array.isArray(obj) || (typeof obj.length === 'number' && obj.length > 0 && (obj.length - 1) in obj)) { for(i=0; i HTML Editor\n * By Jeremy Dorn - https://github.com/jdorn/json-editor/\n * Released under the MIT license\n *\n * Date: 2015-06-08\n */\n\n/**\n * See README.md for requirements and usage info\n */\n\n(function() {\n", + "/*! JSON Editor v0.7.20 - JSON Schema -> HTML Editor\n * By Jeremy Dorn - https://github.com/jdorn/json-editor/\n * Released under the MIT license\n *\n * Date: 2015-06-08\n */\n\n/**\n * See README.md for requirements and usage info\n */\n\n(function() {\n", "/*jshint loopfunc: true */\n/* Simple JavaScript Inheritance\n * By John Resig http://ejohn.org/\n * MIT Licensed.\n */\n// Inspired by base2 and Prototype\nvar Class;\n(function(){\n var initializing = false, fnTest = /xyz/.test(function(){window.postMessage(\"xyz\");}) ? /\\b_super\\b/ : /.*/;\n \n // The base Class implementation (does nothing)\n Class = function(){};\n \n // Create a new Class that inherits from this class\n Class.extend = function(prop) {\n var _super = this.prototype;\n \n // Instantiate a base class (but only create the instance,\n // don't run the init constructor)\n initializing = true;\n var prototype = new this();\n initializing = false;\n \n // Copy the properties over onto the new prototype\n for (var name in prop) {\n // Check if we're overwriting an existing function\n prototype[name] = typeof prop[name] == \"function\" &&\n typeof _super[name] == \"function\" && fnTest.test(prop[name]) ?\n (function(name, fn){\n return function() {\n var tmp = this._super;\n \n // Add a new ._super() method that is the same method\n // but on the super-class\n this._super = _super[name];\n \n // The method only need to be bound temporarily, so we\n // remove it when we're done executing\n var ret = fn.apply(this, arguments); \n this._super = tmp;\n \n return ret;\n };\n })(name, prop[name]) :\n prop[name];\n }\n \n // The dummy class constructor\n function Class() {\n // All construction is actually done in the init method\n if ( !initializing && this.init )\n this.init.apply(this, arguments);\n }\n \n // Populate our constructed prototype object\n Class.prototype = prototype;\n \n // Enforce the constructor to be what we expect\n Class.prototype.constructor = Class;\n \n // And make this class extendable\n Class.extend = arguments.callee;\n \n return Class;\n };\n \n return Class;\n})();\n", "// CustomEvent constructor polyfill\n// From MDN\n(function () {\n function CustomEvent ( event, params ) {\n params = params || { bubbles: false, cancelable: false, detail: undefined };\n var evt = document.createEvent( 'CustomEvent' );\n evt.initCustomEvent( event, params.bubbles, params.cancelable, params.detail );\n return evt;\n }\n\n CustomEvent.prototype = window.Event.prototype;\n\n window.CustomEvent = CustomEvent;\n})();\n\n// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel\n// MIT license\n(function() {\n var lastTime = 0;\n var vendors = ['ms', 'moz', 'webkit', 'o'];\n for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {\n window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];\n window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || \n window[vendors[x]+'CancelRequestAnimationFrame'];\n }\n \n if (!window.requestAnimationFrame)\n window.requestAnimationFrame = function(callback, element) {\n var currTime = new Date().getTime();\n var timeToCall = Math.max(0, 16 - (currTime - lastTime));\n var id = window.setTimeout(function() { callback(currTime + timeToCall); }, \n timeToCall);\n lastTime = currTime + timeToCall;\n return id;\n };\n \n if (!window.cancelAnimationFrame)\n window.cancelAnimationFrame = function(id) {\n clearTimeout(id);\n };\n}());\n\n// Array.isArray polyfill\n// From MDN\n(function() {\n\tif(!Array.isArray) {\n\t Array.isArray = function(arg) {\n\t\treturn Object.prototype.toString.call(arg) === '[object Array]';\n\t };\n\t}\n}());", - "/**\n * Taken from jQuery 1\n *\n * @param obj\n * @returns {*}\n */\nvar $isplainobject = function( obj ) {\n var key;\n\n // Must be an Object.\n // Because of IE, we also have to check the presence of the constructor property.\n // Make sure that DOM nodes and window objects don't pass through, as well\n if ( !obj || typeof obj !== \"object\" || obj.nodeType || obj === window ) {\n return false;\n }\n\n // Not own constructor property must be Object\n if (obj.constructor &&\n !obj.hasOwnProperty('constructor') &&\n !obj.constructor.prototype.hasOwnProperty('isPrototypeOf')) {\n return false;\n }\n\n try {\n // Not own constructor property must be Object\n if ( obj.constructor &&\n !obj.hasOwnProperty(\"constructor\") &&\n !obj.constructor.prototype.hasOwnProperty('isPrototypeOf') ) {\n return false;\n }\n } catch ( e ) {\n // IE8,9 Will throw exceptions on certain host objects #9897\n return false;\n }\n\n // Support: IE<9\n // Handle iteration over inherited properties before own properties.\n if ( /msie 8\\.0/i.test( window.navigator.userAgent ) ) {\n for ( key in obj ) {\n return obj.hasOwnProperty(key);\n }\n }\n\n // Own properties are enumerated firstly, so to speed up,\n // if last one is own, then all properties are own.\n for ( key in obj ) {}\n return key === undefined || obj.hasOwnProperty(key);\n};\n\nvar $extend = function(destination) {\n var source, i,property;\n for(i=1; i= waiting && !callback_fired) {\n callback_fired = true;\n callback();\n }\n });\n }\n // Request failed\n else {\n window.console.log(r);\n throw \"Failed to fetch ref via ajax- \"+url;\n }\n };\n r.send();\n });\n \n if(!waiting) {\n callback();\n }\n },\n expandRefs: function(schema) {\n schema = $extend({},schema);\n \n while (schema.$ref) {\n var ref = schema.$ref;\n delete schema.$ref;\n schema = this.extendSchemas(schema,this.refs[ref]);\n }\n return schema;\n },\n expandSchema: function(schema) {\n var self = this;\n var extended = $extend({},schema);\n var i;\n\n // Version 3 `type`\n if(typeof schema.type === 'object') {\n // Array of types\n if(Array.isArray(schema.type)) {\n $each(schema.type, function(key,value) {\n // Schema\n if(typeof value === 'object') {\n schema.type[key] = self.expandSchema(value);\n }\n });\n }\n // Schema\n else {\n schema.type = self.expandSchema(schema.type);\n }\n }\n // Version 3 `disallow`\n if(typeof schema.disallow === 'object') {\n // Array of types\n if(Array.isArray(schema.disallow)) {\n $each(schema.disallow, function(key,value) {\n // Schema\n if(typeof value === 'object') {\n schema.disallow[key] = self.expandSchema(value);\n }\n });\n }\n // Schema\n else {\n schema.disallow = self.expandSchema(schema.disallow);\n }\n }\n // Version 4 `anyOf`\n if(schema.anyOf) {\n $each(schema.anyOf, function(key,value) {\n schema.anyOf[key] = self.expandSchema(value);\n });\n }\n // Version 4 `dependencies` (schema dependencies)\n if(schema.dependencies) {\n $each(schema.dependencies,function(key,value) {\n if(typeof value === \"object\" && !(Array.isArray(value))) {\n schema.dependencies[key] = self.expandSchema(value);\n }\n });\n }\n // Version 4 `not`\n if(schema.not) {\n schema.not = this.expandSchema(schema.not);\n }\n \n // allOf schemas should be merged into the parent\n if(schema.allOf) {\n for(i=0; i 0 && (obj.length - 1) in obj)) {\n for(i=0; i= waiting && !callback_fired) {\n callback_fired = true;\n callback();\n }\n });\n }\n // Request failed\n else {\n window.console.log(r);\n throw \"Failed to fetch ref via ajax- \"+url;\n }\n };\n r.send();\n });\n \n if(!waiting) {\n callback();\n }\n },\n expandRefs: function(schema) {\n schema = $extend({},schema);\n \n while (schema.$ref) {\n var ref = schema.$ref;\n delete schema.$ref;\n \n if(!this.refs[ref]) ref = decodeURIComponent(ref);\n \n schema = this.extendSchemas(schema,this.refs[ref]);\n }\n return schema;\n },\n expandSchema: function(schema) {\n var self = this;\n var extended = $extend({},schema);\n var i;\n\n // Version 3 `type`\n if(typeof schema.type === 'object') {\n // Array of types\n if(Array.isArray(schema.type)) {\n $each(schema.type, function(key,value) {\n // Schema\n if(typeof value === 'object') {\n schema.type[key] = self.expandSchema(value);\n }\n });\n }\n // Schema\n else {\n schema.type = self.expandSchema(schema.type);\n }\n }\n // Version 3 `disallow`\n if(typeof schema.disallow === 'object') {\n // Array of types\n if(Array.isArray(schema.disallow)) {\n $each(schema.disallow, function(key,value) {\n // Schema\n if(typeof value === 'object') {\n schema.disallow[key] = self.expandSchema(value);\n }\n });\n }\n // Schema\n else {\n schema.disallow = self.expandSchema(schema.disallow);\n }\n }\n // Version 4 `anyOf`\n if(schema.anyOf) {\n $each(schema.anyOf, function(key,value) {\n schema.anyOf[key] = self.expandSchema(value);\n });\n }\n // Version 4 `dependencies` (schema dependencies)\n if(schema.dependencies) {\n $each(schema.dependencies,function(key,value) {\n if(typeof value === \"object\" && !(Array.isArray(value))) {\n schema.dependencies[key] = self.expandSchema(value);\n }\n });\n }\n // Version 4 `not`\n if(schema.not) {\n schema.not = this.expandSchema(schema.not);\n }\n \n // allOf schemas should be merged into the parent\n if(schema.allOf) {\n for(i=0; i= schema.maximum) {\n errors.push({\n path: path,\n property: 'maximum',\n message: this.translate('error_maximum_excl', [schema.maximum])\n });\n }\n else if(!schema.exclusiveMaximum && value > schema.maximum) {\n errors.push({\n path: path,\n property: 'maximum',\n message: this.translate('error_maximum_incl', [schema.maximum])\n });\n }\n }\n\n // `minimum`\n if(schema.hasOwnProperty('minimum')) {\n if(schema.exclusiveMinimum && value <= schema.minimum) {\n errors.push({\n path: path,\n property: 'minimum',\n message: this.translate('error_minimum_excl', [schema.minimum])\n });\n }\n else if(!schema.exclusiveMinimum && value < schema.minimum) {\n errors.push({\n path: path,\n property: 'minimum',\n message: this.translate('error_minimum_incl', [schema.minimum])\n });\n }\n }\n }\n // String specific validation\n else if(typeof value === \"string\") {\n // `maxLength`\n if(schema.maxLength) {\n if((value+\"\").length > schema.maxLength) {\n errors.push({\n path: path,\n property: 'maxLength',\n message: this.translate('error_maxLength', [schema.maxLength])\n });\n }\n }\n\n // `minLength`\n if(schema.minLength) {\n if((value+\"\").length < schema.minLength) { \n errors.push({\n path: path,\n property: 'minLength',\n message: this.translate((schema.minLength===1?'error_notempty':'error_minLength'), [schema.minLength])\n });\n }\n }\n\n // `pattern`\n if(schema.pattern) {\n if(!(new RegExp(schema.pattern)).test(value)) {\n errors.push({\n path: path,\n property: 'pattern',\n message: this.translate('error_pattern')\n });\n }\n }\n }\n // Array specific validation\n else if(typeof value === \"object\" && value !== null && Array.isArray(value)) {\n // `items` and `additionalItems`\n if(schema.items) {\n // `items` is an array\n if(Array.isArray(schema.items)) {\n for(i=0; i schema.maxItems) {\n errors.push({\n path: path,\n property: 'maxItems',\n message: this.translate('error_maxItems', [schema.maxItems])\n });\n }\n }\n\n // `minItems`\n if(schema.minItems) {\n if(value.length < schema.minItems) {\n errors.push({\n path: path,\n property: 'minItems',\n message: this.translate('error_minItems', [schema.minItems])\n });\n }\n }\n\n // `uniqueItems`\n if(schema.uniqueItems) {\n var seen = {};\n for(i=0; i schema.maxProperties) {\n errors.push({\n path: path,\n property: 'maxProperties',\n message: this.translate('error_maxProperties', [schema.maxProperties])\n });\n }\n }\n\n // `minProperties`\n if(schema.minProperties) {\n valid = 0;\n for(i in value) {\n if(!value.hasOwnProperty(i)) continue;\n valid++;\n }\n if(valid < schema.minProperties) {\n errors.push({\n path: path,\n property: 'minProperties',\n message: this.translate('error_minProperties', [schema.minProperties])\n });\n }\n }\n\n // Version 4 `required`\n if(schema.required && Array.isArray(schema.required)) {\n for(i=0; i=0) {\n holder = this.theme.getBlockLinkHolder();\n \n link = this.theme.getBlockLink();\n link.setAttribute('target','_blank');\n \n var media = document.createElement(type);\n media.setAttribute('controls','controls');\n \n this.theme.createMediaLink(holder,link,media);\n \n // When a watched field changes, update the url \n this.link_watchers.push(function(vars) {\n var url = href(vars);\n link.setAttribute('href',url);\n link.textContent = data.rel || url;\n media.setAttribute('src',url);\n });\n }\n // Text links\n else {\n holder = this.theme.getBlockLink();\n holder.setAttribute('target','_blank');\n holder.textContent = data.rel;\n \n // When a watched field changes, update the url \n this.link_watchers.push(function(vars) {\n var url = href(vars);\n holder.setAttribute('href',url);\n holder.textContent = data.rel || url;\n });\n }\n \n return holder;\n },\n refreshWatchedFieldValues: function() {\n if(!this.watched_values) return;\n var watched = {};\n var changed = false;\n var self = this;\n \n if(this.watched) {\n var val,editor;\n for(var name in this.watched) {\n if(!this.watched.hasOwnProperty(name)) continue;\n editor = self.jsoneditor.getEditor(this.watched[name]);\n val = editor? editor.getValue() : null;\n if(self.watched_values[name] !== val) changed = true;\n watched[name] = val;\n }\n }\n \n watched.self = this.getValue();\n if(this.watched_values.self !== watched.self) changed = true;\n \n this.watched_values = watched;\n \n return changed;\n },\n getWatchedFieldValues: function() {\n return this.watched_values;\n },\n updateHeaderText: function() {\n if(this.header) {\n // If the header has children, only update the text node's value\n if(this.header.children.length) {\n for(var i=0; i 1) disp[i] = name + \" \" + inc[name];\n });\n \n return disp;\n },\n getOption: function(key) {\n try {\n throw \"getOption is deprecated\";\n }\n catch(e) {\n window.console.error(e);\n }\n \n return this.options[key];\n },\n showValidationErrors: function(errors) {\n\n }\n});\n", "JSONEditor.defaults.editors[\"null\"] = JSONEditor.AbstractEditor.extend({\n getValue: function() {\n return null;\n },\n setValue: function() {\n this.onChange();\n },\n getNumColumns: function() {\n return 2;\n }\n});\n", @@ -76,7 +76,7 @@ "JSONEditor.AbstractTheme = Class.extend({\n getContainer: function() {\n return document.createElement('div');\n },\n getFloatRightLinkHolder: function() {\n var el = document.createElement('div');\n el.style = el.style || {};\n el.style.cssFloat = 'right';\n el.style.marginLeft = '10px';\n return el;\n },\n getModal: function() {\n var el = document.createElement('div');\n el.style.backgroundColor = 'white';\n el.style.border = '1px solid black';\n el.style.boxShadow = '3px 3px black';\n el.style.position = 'absolute';\n el.style.zIndex = '10';\n el.style.display = 'none';\n return el;\n },\n getGridContainer: function() {\n var el = document.createElement('div');\n return el;\n },\n getGridRow: function() {\n var el = document.createElement('div');\n el.className = 'row';\n return el;\n },\n getGridColumn: function() {\n var el = document.createElement('div');\n return el;\n },\n setGridColumnSize: function(el,size) {\n \n },\n getLink: function(text) {\n var el = document.createElement('a');\n el.setAttribute('href','#');\n el.appendChild(document.createTextNode(text));\n return el;\n },\n disableHeader: function(header) {\n header.style.color = '#ccc';\n },\n disableLabel: function(label) {\n label.style.color = '#ccc';\n },\n enableHeader: function(header) {\n header.style.color = '';\n },\n enableLabel: function(label) {\n label.style.color = '';\n },\n getFormInputLabel: function(text) {\n var el = document.createElement('label');\n el.appendChild(document.createTextNode(text));\n return el;\n },\n getCheckboxLabel: function(text) {\n var el = this.getFormInputLabel(text);\n el.style.fontWeight = 'normal';\n return el;\n },\n getHeader: function(text) {\n var el = document.createElement('h3');\n if(typeof text === \"string\") {\n el.textContent = text;\n }\n else {\n el.appendChild(text);\n }\n \n return el;\n },\n getCheckbox: function() {\n var el = this.getFormInputField('checkbox');\n el.style.display = 'inline-block';\n el.style.width = 'auto';\n return el;\n },\n getMultiCheckboxHolder: function(controls,label,description) {\n var el = document.createElement('div');\n\n if(label) {\n label.style.display = 'block';\n el.appendChild(label);\n }\n\n for(var i in controls) {\n if(!controls.hasOwnProperty(i)) continue;\n controls[i].style.display = 'inline-block';\n controls[i].style.marginRight = '20px';\n el.appendChild(controls[i]);\n }\n\n if(description) el.appendChild(description);\n\n return el;\n },\n getSelectInput: function(options) {\n var select = document.createElement('select');\n if(options) this.setSelectOptions(select, options);\n return select;\n },\n getSwitcher: function(options) {\n var switcher = this.getSelectInput(options);\n switcher.style.backgroundColor = 'transparent';\n switcher.style.height = 'auto';\n switcher.style.fontStyle = 'italic';\n switcher.style.fontWeight = 'normal';\n switcher.style.padding = '0 0 0 3px';\n return switcher;\n },\n getSwitcherOptions: function(switcher) {\n return switcher.getElementsByTagName('option');\n },\n setSwitcherOptions: function(switcher, options, titles) {\n this.setSelectOptions(switcher, options, titles);\n },\n setSelectOptions: function(select, options, titles) {\n titles = titles || [];\n select.innerHTML = '';\n for(var i=0; i
\";\n return el;\n },\n applyStyles: function(el,styles) {\n el.style = el.style || {};\n for(var i in styles) {\n if(!styles.hasOwnProperty(i)) continue;\n el.style[i] = styles[i];\n }\n },\n closest: function(elem, selector) {\n var matchesSelector = elem.matches || elem.webkitMatchesSelector || elem.mozMatchesSelector || elem.msMatchesSelector;\n\n while (elem && elem !== document) {\n try {\n var f = matchesSelector.bind(elem);\n if (f(selector)) {\n return elem;\n } else {\n elem = elem.parentNode;\n }\n }\n catch(e) {\n return false;\n }\n }\n return false;\n },\n getTab: function(span) {\n var el = document.createElement('div');\n el.appendChild(span);\n el.style = el.style || {};\n this.applyStyles(el,{\n border: '1px solid #ccc',\n borderWidth: '1px 0 1px 1px',\n textAlign: 'center',\n lineHeight: '30px',\n borderRadius: '5px',\n borderBottomRightRadius: 0,\n borderTopRightRadius: 0,\n fontWeight: 'bold',\n cursor: 'pointer'\n });\n return el;\n },\n getTabContentHolder: function(tab_holder) {\n return tab_holder.children[1];\n },\n getTabContent: function() {\n return this.getIndentedPanel();\n },\n markTabActive: function(tab) {\n this.applyStyles(tab,{\n opacity: 1,\n background: 'white'\n });\n },\n markTabInactive: function(tab) {\n this.applyStyles(tab,{\n opacity:0.5,\n background: ''\n });\n },\n addTab: function(holder, tab) {\n holder.children[0].appendChild(tab);\n },\n getBlockLink: function() {\n var link = document.createElement('a');\n link.style.display = 'block';\n return link;\n },\n getBlockLinkHolder: function() {\n var el = document.createElement('div');\n return el;\n },\n getLinksHolder: function() {\n var el = document.createElement('div');\n return el;\n },\n createMediaLink: function(holder,link,media) {\n holder.appendChild(link);\n media.style.width='100%';\n holder.appendChild(media);\n },\n createImageLink: function(holder,link,image) {\n holder.appendChild(link);\n link.appendChild(image);\n }\n});\n", "JSONEditor.defaults.themes.bootstrap2 = JSONEditor.AbstractTheme.extend({\n getRangeInput: function(min, max, step) {\n // TODO: use bootstrap slider\n return this._super(min, max, step);\n },\n getGridContainer: function() {\n var el = document.createElement('div');\n el.className = 'container-fluid';\n return el;\n },\n getGridRow: function() {\n var el = document.createElement('div');\n el.className = 'row-fluid';\n return el;\n },\n getFormInputLabel: function(text) {\n var el = this._super(text);\n el.style.display = 'inline-block';\n el.style.fontWeight = 'bold';\n return el;\n },\n setGridColumnSize: function(el,size) {\n el.className = 'span'+size;\n },\n getSelectInput: function(options) {\n var input = this._super(options);\n input.style.width = 'auto';\n input.style.maxWidth = '98%';\n return input;\n },\n getFormInputField: function(type) {\n var el = this._super(type);\n el.style.width = '98%';\n return el;\n },\n afterInputReady: function(input) {\n if(input.controlgroup) return;\n input.controlgroup = this.closest(input,'.control-group');\n input.controls = this.closest(input,'.controls');\n if(this.closest(input,'.compact')) {\n input.controlgroup.className = input.controlgroup.className.replace(/control-group/g,'').replace(/[ ]{2,}/g,' ');\n input.controls.className = input.controlgroup.className.replace(/controls/g,'').replace(/[ ]{2,}/g,' ');\n input.style.marginBottom = 0;\n }\n\n // TODO: use bootstrap slider\n },\n getIndentedPanel: function() {\n var el = document.createElement('div');\n el.className = 'well well-small';\n return el;\n },\n getFormInputDescription: function(text) {\n var el = document.createElement('p');\n el.className = 'help-inline';\n el.textContent = text;\n return el;\n },\n getFormControl: function(label, input, description) {\n var ret = document.createElement('div');\n ret.className = 'control-group';\n\n var controls = document.createElement('div');\n controls.className = 'controls';\n\n if(label && input.getAttribute('type') === 'checkbox') {\n ret.appendChild(controls);\n label.className += ' checkbox';\n label.appendChild(input);\n controls.appendChild(label);\n controls.style.height = '30px';\n }\n else {\n if(label) {\n label.className += ' control-label';\n ret.appendChild(label);\n }\n controls.appendChild(input);\n ret.appendChild(controls);\n }\n\n if(description) controls.appendChild(description);\n\n return ret;\n },\n getHeaderButtonHolder: function() {\n var el = this.getButtonHolder();\n el.style.marginLeft = '10px';\n return el;\n },\n getButtonHolder: function() {\n var el = document.createElement('div');\n el.className = 'btn-group';\n return el;\n },\n getButton: function(text, icon, title) {\n var el = this._super(text, icon, title);\n el.className += ' btn btn-default';\n return el;\n },\n getTable: function() {\n var el = document.createElement('table');\n el.className = 'table table-bordered';\n el.style.width = 'auto';\n el.style.maxWidth = 'none';\n return el;\n },\n addInputError: function(input,text) {\n if(!input.controlgroup || !input.controls) return;\n input.controlgroup.className += ' error';\n if(!input.errmsg) {\n input.errmsg = document.createElement('p');\n input.errmsg.className = 'help-block errormsg';\n input.controls.appendChild(input.errmsg);\n }\n else {\n input.errmsg.style.display = '';\n }\n\n input.errmsg.textContent = text;\n },\n removeInputError: function(input) {\n if(!input.errmsg) return;\n input.errmsg.style.display = 'none';\n input.controlgroup.className = input.controlgroup.className.replace(/\\s?error/g,'');\n },\n getTabHolder: function() {\n var el = document.createElement('div');\n el.className = 'tabbable tabs-left';\n el.innerHTML = \"
\";\n return el;\n },\n getTab: function(text) {\n var el = document.createElement('li');\n var a = document.createElement('a');\n a.setAttribute('href','#');\n a.appendChild(text);\n el.appendChild(a);\n return el;\n },\n getTabContentHolder: function(tab_holder) {\n return tab_holder.children[1];\n },\n getTabContent: function() {\n var el = document.createElement('div');\n el.className = 'tab-pane active';\n return el;\n },\n markTabActive: function(tab) {\n tab.className += ' active';\n },\n markTabInactive: function(tab) {\n tab.className = tab.className.replace(/\\s?active/g,'');\n },\n addTab: function(holder, tab) {\n holder.children[0].appendChild(tab);\n },\n getProgressBar: function() {\n var container = document.createElement('div');\n container.className = 'progress';\n\n var bar = document.createElement('div');\n bar.className = 'bar';\n bar.style.width = '0%';\n container.appendChild(bar);\n\n return container;\n },\n updateProgressBar: function(progressBar, progress) {\n if (!progressBar) return;\n\n progressBar.firstChild.style.width = progress + \"%\";\n },\n updateProgressBarUnknown: function(progressBar) {\n if (!progressBar) return;\n\n progressBar.className = 'progress progress-striped active';\n progressBar.firstChild.style.width = '100%';\n }\n});\n", "JSONEditor.defaults.themes.bootstrap3 = JSONEditor.AbstractTheme.extend({\n getSelectInput: function(options) {\n var el = this._super(options);\n el.className += 'form-control';\n //el.style.width = 'auto';\n return el;\n },\n setGridColumnSize: function(el,size) {\n el.className = 'col-md-'+size;\n },\n afterInputReady: function(input) {\n if(input.controlgroup) return;\n input.controlgroup = this.closest(input,'.form-group');\n if(this.closest(input,'.compact')) {\n input.controlgroup.style.marginBottom = 0;\n }\n\n // TODO: use bootstrap slider\n },\n getTextareaInput: function() {\n var el = document.createElement('textarea');\n el.className = 'form-control';\n return el;\n },\n getRangeInput: function(min, max, step) {\n // TODO: use better slider\n return this._super(min, max, step);\n },\n getFormInputField: function(type) {\n var el = this._super(type);\n if(type !== 'checkbox') {\n el.className += 'form-control';\n }\n return el;\n },\n getFormControl: function(label, input, description) {\n var group = document.createElement('div');\n\n if(label && input.type === 'checkbox') {\n group.className += ' checkbox';\n label.appendChild(input);\n label.style.fontSize = '14px';\n group.style.marginTop = '0';\n group.appendChild(label);\n input.style.position = 'relative';\n input.style.cssFloat = 'left';\n } \n else {\n group.className += ' form-group';\n if(label) {\n label.className += ' control-label';\n group.appendChild(label);\n }\n group.appendChild(input);\n }\n\n if(description) group.appendChild(description);\n\n return group;\n },\n getIndentedPanel: function() {\n var el = document.createElement('div');\n el.className = 'well well-sm';\n return el;\n },\n getFormInputDescription: function(text) {\n var el = document.createElement('p');\n el.className = 'help-block';\n el.innerHTML = text;\n return el;\n },\n getHeaderButtonHolder: function() {\n var el = this.getButtonHolder();\n el.style.marginLeft = '10px';\n return el;\n },\n getButtonHolder: function() {\n var el = document.createElement('div');\n el.className = 'btn-group';\n return el;\n },\n getButton: function(text, icon, title) {\n var el = this._super(text, icon, title);\n el.className += 'btn btn-default';\n return el;\n },\n getTable: function() {\n var el = document.createElement('table');\n el.className = 'table table-bordered';\n el.style.width = 'auto';\n el.style.maxWidth = 'none';\n return el;\n },\n\n addInputError: function(input,text) {\n if(!input.controlgroup) return;\n input.controlgroup.className += ' has-error';\n if(!input.errmsg) {\n input.errmsg = document.createElement('p');\n input.errmsg.className = 'help-block errormsg';\n input.controlgroup.appendChild(input.errmsg);\n }\n else {\n input.errmsg.style.display = '';\n }\n\n input.errmsg.textContent = text;\n },\n removeInputError: function(input) {\n if(!input.errmsg) return;\n input.errmsg.style.display = 'none';\n input.controlgroup.className = input.controlgroup.className.replace(/\\s?has-error/g,'');\n },\n getTabHolder: function() {\n var el = document.createElement('div');\n el.innerHTML = \"
\";\n el.className = 'rows';\n return el;\n },\n getTab: function(text) {\n var el = document.createElement('a');\n el.className = 'list-group-item';\n el.setAttribute('href','#');\n el.appendChild(text);\n return el;\n },\n markTabActive: function(tab) {\n tab.className += ' active';\n },\n markTabInactive: function(tab) {\n tab.className = tab.className.replace(/\\s?active/g,'');\n },\n getProgressBar: function() {\n var min = 0, max = 100, start = 0;\n\n var container = document.createElement('div');\n container.className = 'progress';\n\n var bar = document.createElement('div');\n bar.className = 'progress-bar';\n bar.setAttribute('role', 'progressbar');\n bar.setAttribute('aria-valuenow', start);\n bar.setAttribute('aria-valuemin', min);\n bar.setAttribute('aria-valuenax', max);\n bar.innerHTML = start + \"%\";\n container.appendChild(bar);\n\n return container;\n },\n updateProgressBar: function(progressBar, progress) {\n if (!progressBar) return;\n\n var bar = progressBar.firstChild;\n var percentage = progress + \"%\";\n bar.setAttribute('aria-valuenow', progress);\n bar.style.width = percentage;\n bar.innerHTML = percentage;\n },\n updateProgressBarUnknown: function(progressBar) {\n if (!progressBar) return;\n\n var bar = progressBar.firstChild;\n progressBar.className = 'progress progress-striped active';\n bar.removeAttribute('aria-valuenow');\n bar.style.width = '100%';\n bar.innerHTML = '';\n }\n});\n", - "// Base Foundation theme\nJSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({\n getChildEditorHolder: function() {\n var el = document.createElement('div');\n el.style.marginBottom = '15px';\n return el;\n },\n getSelectInput: function(options) {\n var el = this._super(options);\n el.style.minWidth = 'none';\n el.style.padding = '5px';\n el.style.marginTop = '3px';\n return el;\n },\n getSwitcher: function(options) {\n var el = this._super(options);\n el.style.paddingRight = '8px';\n return el;\n },\n afterInputReady: function(input) {\n if(this.closest(input,'.compact')) {\n input.style.marginBottom = 0;\n }\n input.group = this.closest(input,'.form-control');\n },\n getFormInputLabel: function(text) {\n var el = this._super(text);\n el.style.display = 'inline-block';\n return el;\n },\n getFormInputField: function(type) {\n var el = this._super(type);\n el.style.width = '100%';\n el.style.marginBottom = type==='checkbox'? '0' : '12px';\n return el;\n },\n getFormInputDescription: function(text) {\n var el = document.createElement('p');\n el.textContent = text;\n el.style.marginTop = '-10px';\n el.style.fontStyle = 'italic';\n return el;\n },\n getIndentedPanel: function() {\n var el = document.createElement('div');\n el.className = 'panel';\n return el;\n },\n getHeaderButtonHolder: function() {\n var el = this.getButtonHolder();\n el.style.display = 'inline-block';\n el.style.marginLeft = '10px';\n el.style.verticalAlign = 'middle';\n return el;\n },\n getButtonHolder: function() {\n var el = document.createElement('div');\n el.className = 'button-group';\n return el;\n },\n getButton: function(text, icon, title) {\n var el = this._super(text, icon, title);\n el.className += ' small button';\n return el;\n },\n addInputError: function(input,text) {\n if(!input.group) return;\n input.group.className += ' error';\n \n if(!input.errmsg) {\n input.insertAdjacentHTML('afterend','');\n input.errmsg = input.parentNode.getElementsByClassName('error')[0];\n }\n else {\n input.errmsg.style.display = '';\n }\n \n input.errmsg.textContent = text;\n },\n removeInputError: function(input) {\n if(!input.errmsg) return;\n input.group.className = input.group.className.replace(/ error/g,'');\n input.errmsg.style.display = 'none';\n },\n getProgressBar: function() {\n var progressBar = document.createElement('div');\n progressBar.className = 'progress';\n\n var meter = document.createElement('span');\n meter.className = 'meter';\n meter.style.width = '0%';\n progressBar.appendChild(meter);\n return progressBar;\n },\n updateProgressBar: function(progressBar, progress) {\n if (!progressBar) return;\n progressBar.firstChild.style.width = progress + '%';\n },\n updateProgressBarUnknown: function(progressBar) {\n if (!progressBar) return;\n progressBar.firstChild.style.width = '100%';\n }\n});\n\n// Foundation 3 Specific Theme\nJSONEditor.defaults.themes.foundation3 = JSONEditor.defaults.themes.foundation.extend({\n getHeaderButtonHolder: function() {\n var el = this._super();\n el.style.fontSize = '.6em';\n return el;\n },\n getFormInputLabel: function(text) {\n var el = this._super(text);\n el.style.fontWeight = 'bold';\n return el;\n },\n getTabHolder: function() {\n var el = document.createElement('div');\n el.className = 'row';\n el.innerHTML = \"
\";\n return el;\n },\n setGridColumnSize: function(el,size) {\n var sizes = ['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve'];\n el.className = 'columns '+sizes[size];\n },\n getTab: function(text) {\n var el = document.createElement('dd');\n var a = document.createElement('a');\n a.setAttribute('href','#');\n a.appendChild(text);\n el.appendChild(a);\n return el;\n },\n getTabContentHolder: function(tab_holder) {\n return tab_holder.children[1];\n },\n getTabContent: function() {\n var el = document.createElement('div');\n el.className = 'content active';\n el.style.paddingLeft = '5px';\n return el;\n },\n markTabActive: function(tab) {\n tab.className += ' active';\n },\n markTabInactive: function(tab) {\n tab.className = tab.className.replace(/\\s*active/g,'');\n },\n addTab: function(holder, tab) {\n holder.children[0].appendChild(tab);\n }\n});\n\n// Foundation 4 Specific Theme\nJSONEditor.defaults.themes.foundation4 = JSONEditor.defaults.themes.foundation.extend({\n getHeaderButtonHolder: function() {\n var el = this._super();\n el.style.fontSize = '.6em';\n return el;\n },\n setGridColumnSize: function(el,size) {\n el.className = 'columns large-'+size;\n },\n getFormInputDescription: function(text) {\n var el = this._super(text);\n el.style.fontSize = '.8rem';\n return el;\n },\n getFormInputLabel: function(text) {\n var el = this._super(text);\n el.style.fontWeight = 'bold';\n return el;\n }\n});\n\n// Foundation 5 Specific Theme\nJSONEditor.defaults.themes.foundation5 = JSONEditor.defaults.themes.foundation.extend({\n getFormInputDescription: function(text) {\n var el = this._super(text);\n el.style.fontSize = '.8rem';\n return el;\n },\n setGridColumnSize: function(el,size) {\n el.className = 'columns medium-'+size;\n },\n getButton: function(text, icon, title) {\n var el = this._super(text,icon,title);\n el.className = el.className.replace(/\\s*small/g,'') + ' tiny';\n return el;\n },\n getTabHolder: function() {\n var el = document.createElement('div');\n el.innerHTML = \"
\";\n return el;\n },\n getTab: function(text) {\n var el = document.createElement('dd');\n var a = document.createElement('a');\n a.setAttribute('href','#');\n a.appendChild(text);\n el.appendChild(a);\n return el;\n },\n getTabContentHolder: function(tab_holder) {\n return tab_holder.children[1];\n },\n getTabContent: function() {\n var el = document.createElement('div');\n el.className = 'content active';\n el.style.paddingLeft = '5px';\n return el;\n },\n markTabActive: function(tab) {\n tab.className += ' active';\n },\n markTabInactive: function(tab) {\n tab.className = tab.className.replace(/\\s*active/g,'');\n },\n addTab: function(holder, tab) {\n holder.children[0].appendChild(tab);\n }\n});\n", + "// Base Foundation theme\nJSONEditor.defaults.themes.foundation = JSONEditor.AbstractTheme.extend({\n getChildEditorHolder: function() {\n var el = document.createElement('div');\n el.style.marginBottom = '15px';\n return el;\n },\n getSelectInput: function(options) {\n var el = this._super(options);\n el.style.minWidth = 'none';\n el.style.padding = '5px';\n el.style.marginTop = '3px';\n return el;\n },\n getSwitcher: function(options) {\n var el = this._super(options);\n el.style.paddingRight = '8px';\n return el;\n },\n afterInputReady: function(input) {\n if(this.closest(input,'.compact')) {\n input.style.marginBottom = 0;\n }\n input.group = this.closest(input,'.form-control');\n },\n getFormInputLabel: function(text) {\n var el = this._super(text);\n el.style.display = 'inline-block';\n return el;\n },\n getFormInputField: function(type) {\n var el = this._super(type);\n el.style.width = '100%';\n el.style.marginBottom = type==='checkbox'? '0' : '12px';\n return el;\n },\n getFormInputDescription: function(text) {\n var el = document.createElement('p');\n el.textContent = text;\n el.style.marginTop = '-10px';\n el.style.fontStyle = 'italic';\n return el;\n },\n getIndentedPanel: function() {\n var el = document.createElement('div');\n el.className = 'panel';\n return el;\n },\n getHeaderButtonHolder: function() {\n var el = this.getButtonHolder();\n el.style.display = 'inline-block';\n el.style.marginLeft = '10px';\n el.style.verticalAlign = 'middle';\n return el;\n },\n getButtonHolder: function() {\n var el = document.createElement('div');\n el.className = 'button-group';\n return el;\n },\n getButton: function(text, icon, title) {\n var el = this._super(text, icon, title);\n el.className += ' small button';\n return el;\n },\n addInputError: function(input,text) {\n if(!input.group) return;\n input.group.className += ' error';\n \n if(!input.errmsg) {\n input.insertAdjacentHTML('afterend','');\n input.errmsg = input.parentNode.getElementsByClassName('error')[0];\n }\n else {\n input.errmsg.style.display = '';\n }\n \n input.errmsg.textContent = text;\n },\n removeInputError: function(input) {\n if(!input.errmsg) return;\n input.group.className = input.group.className.replace(/ error/g,'');\n input.errmsg.style.display = 'none';\n },\n getProgressBar: function() {\n var progressBar = document.createElement('div');\n progressBar.className = 'progress';\n\n var meter = document.createElement('span');\n meter.className = 'meter';\n meter.style.width = '0%';\n progressBar.appendChild(meter);\n return progressBar;\n },\n updateProgressBar: function(progressBar, progress) {\n if (!progressBar) return;\n progressBar.firstChild.style.width = progress + '%';\n },\n updateProgressBarUnknown: function(progressBar) {\n if (!progressBar) return;\n progressBar.firstChild.style.width = '100%';\n }\n});\n\n// Foundation 3 Specific Theme\nJSONEditor.defaults.themes.foundation3 = JSONEditor.defaults.themes.foundation.extend({\n getHeaderButtonHolder: function() {\n var el = this._super();\n el.style.fontSize = '.6em';\n return el;\n },\n getFormInputLabel: function(text) {\n var el = this._super(text);\n el.style.fontWeight = 'bold';\n return el;\n },\n getTabHolder: function() {\n var el = document.createElement('div');\n el.className = 'row';\n el.innerHTML = \"
\";\n return el;\n },\n setGridColumnSize: function(el,size) {\n var sizes = ['zero','one','two','three','four','five','six','seven','eight','nine','ten','eleven','twelve'];\n el.className = 'columns '+sizes[size];\n },\n getTab: function(text) {\n var el = document.createElement('dd');\n var a = document.createElement('a');\n a.setAttribute('href','#');\n a.appendChild(text);\n el.appendChild(a);\n return el;\n },\n getTabContentHolder: function(tab_holder) {\n return tab_holder.children[1];\n },\n getTabContent: function() {\n var el = document.createElement('div');\n el.className = 'content active';\n el.style.paddingLeft = '5px';\n return el;\n },\n markTabActive: function(tab) {\n tab.className += ' active';\n },\n markTabInactive: function(tab) {\n tab.className = tab.className.replace(/\\s*active/g,'');\n },\n addTab: function(holder, tab) {\n holder.children[0].appendChild(tab);\n }\n});\n\n// Foundation 4 Specific Theme\nJSONEditor.defaults.themes.foundation4 = JSONEditor.defaults.themes.foundation.extend({\n getHeaderButtonHolder: function() {\n var el = this._super();\n el.style.fontSize = '.6em';\n return el;\n },\n setGridColumnSize: function(el,size) {\n el.className = 'columns large-'+size;\n },\n getFormInputDescription: function(text) {\n var el = this._super(text);\n el.style.fontSize = '.8rem';\n return el;\n },\n getFormInputLabel: function(text) {\n var el = this._super(text);\n el.style.fontWeight = 'bold';\n return el;\n }\n});\n\n// Foundation 5 Specific Theme\nJSONEditor.defaults.themes.foundation5 = JSONEditor.defaults.themes.foundation.extend({\n getFormInputDescription: function(text) {\n var el = this._super(text);\n el.style.fontSize = '.8rem';\n return el;\n },\n setGridColumnSize: function(el,size) {\n el.className = 'columns medium-'+size;\n },\n getButton: function(text, icon, title) {\n var el = this._super(text,icon,title);\n el.className = el.className.replace(/\\s*small/g,'') + ' tiny';\n return el;\n },\n getTabHolder: function() {\n var el = document.createElement('div');\n el.innerHTML = \"
\";\n return el;\n },\n getTab: function(text) {\n var el = document.createElement('dd');\n var a = document.createElement('a');\n a.setAttribute('href','#');\n a.appendChild(text);\n el.appendChild(a);\n return el;\n },\n getTabContentHolder: function(tab_holder) {\n return tab_holder.children[1];\n },\n getTabContent: function() {\n var el = document.createElement('div');\n el.className = 'content active';\n el.style.paddingLeft = '5px';\n return el;\n },\n markTabActive: function(tab) {\n tab.className += ' active';\n },\n markTabInactive: function(tab) {\n tab.className = tab.className.replace(/\\s*active/g,'');\n },\n addTab: function(holder, tab) {\n holder.children[0].appendChild(tab);\n }\n});\n", "JSONEditor.defaults.themes.html = JSONEditor.AbstractTheme.extend({\n getFormInputLabel: function(text) {\n var el = this._super(text);\n el.style.display = 'block';\n el.style.marginBottom = '3px';\n el.style.fontWeight = 'bold';\n return el;\n },\n getFormInputDescription: function(text) {\n var el = this._super(text);\n el.style.fontSize = '.8em';\n el.style.margin = 0;\n el.style.display = 'inline-block';\n el.style.fontStyle = 'italic';\n return el;\n },\n getIndentedPanel: function() {\n var el = this._super();\n el.style.border = '1px solid #ddd';\n el.style.padding = '5px';\n el.style.margin = '5px';\n el.style.borderRadius = '3px';\n return el;\n },\n getChildEditorHolder: function() {\n var el = this._super();\n el.style.marginBottom = '8px';\n return el;\n },\n getHeaderButtonHolder: function() {\n var el = this.getButtonHolder();\n el.style.display = 'inline-block';\n el.style.marginLeft = '10px';\n el.style.fontSize = '.8em';\n el.style.verticalAlign = 'middle';\n return el;\n },\n getTable: function() {\n var el = this._super();\n el.style.borderBottom = '1px solid #ccc';\n el.style.marginBottom = '5px';\n return el;\n },\n addInputError: function(input, text) {\n input.style.borderColor = 'red';\n \n if(!input.errmsg) {\n var group = this.closest(input,'.form-control');\n input.errmsg = document.createElement('div');\n input.errmsg.setAttribute('class','errmsg');\n input.errmsg.style = input.errmsg.style || {};\n input.errmsg.style.color = 'red';\n group.appendChild(input.errmsg);\n }\n else {\n input.errmsg.style.display = 'block';\n }\n \n input.errmsg.innerHTML = '';\n input.errmsg.appendChild(document.createTextNode(text));\n },\n removeInputError: function(input) {\n input.style.borderColor = '';\n if(input.errmsg) input.errmsg.style.display = 'none';\n },\n getProgressBar: function() {\n var max = 100, start = 0;\n\n var progressBar = document.createElement('progress');\n progressBar.setAttribute('max', max);\n progressBar.setAttribute('value', start);\n return progressBar;\n },\n updateProgressBar: function(progressBar, progress) {\n if (!progressBar) return;\n progressBar.setAttribute('value', progress);\n },\n updateProgressBarUnknown: function(progressBar) {\n if (!progressBar) return;\n progressBar.removeAttribute('value');\n }\n});\n", "JSONEditor.defaults.themes.jqueryui = JSONEditor.AbstractTheme.extend({\n getTable: function() {\n var el = this._super();\n el.setAttribute('cellpadding',5);\n el.setAttribute('cellspacing',0);\n return el;\n },\n getTableHeaderCell: function(text) {\n var el = this._super(text);\n el.className = 'ui-state-active';\n el.style.fontWeight = 'bold';\n return el;\n },\n getTableCell: function() {\n var el = this._super();\n el.className = 'ui-widget-content';\n return el;\n },\n getHeaderButtonHolder: function() {\n var el = this.getButtonHolder();\n el.style.marginLeft = '10px';\n el.style.fontSize = '.6em';\n el.style.display = 'inline-block';\n return el;\n },\n getFormInputDescription: function(text) {\n var el = this.getDescription(text);\n el.style.marginLeft = '10px';\n el.style.display = 'inline-block';\n return el;\n },\n getFormControl: function(label, input, description) {\n var el = this._super(label,input,description);\n if(input.type === 'checkbox') {\n el.style.lineHeight = '25px';\n \n el.style.padding = '3px 0';\n }\n else {\n el.style.padding = '4px 0 8px 0';\n }\n return el;\n },\n getDescription: function(text) {\n var el = document.createElement('span');\n el.style.fontSize = '.8em';\n el.style.fontStyle = 'italic';\n el.textContent = text;\n return el;\n },\n getButtonHolder: function() {\n var el = document.createElement('div');\n el.className = 'ui-buttonset';\n el.style.fontSize = '.7em';\n return el;\n },\n getFormInputLabel: function(text) {\n var el = document.createElement('label');\n el.style.fontWeight = 'bold';\n el.style.display = 'block';\n el.textContent = text;\n return el;\n },\n getButton: function(text, icon, title) {\n var button = document.createElement(\"button\");\n button.className = 'ui-button ui-widget ui-state-default ui-corner-all';\n\n // Icon only\n if(icon && !text) {\n button.className += ' ui-button-icon-only';\n icon.className += ' ui-button-icon-primary ui-icon-primary';\n button.appendChild(icon);\n }\n // Icon and Text\n else if(icon) {\n button.className += ' ui-button-text-icon-primary';\n icon.className += ' ui-button-icon-primary ui-icon-primary';\n button.appendChild(icon);\n }\n // Text only\n else {\n button.className += ' ui-button-text-only';\n }\n\n var el = document.createElement('span');\n el.className = 'ui-button-text';\n el.textContent = text||title||\".\";\n button.appendChild(el);\n\n button.setAttribute('title',title);\n \n return button;\n },\n setButtonText: function(button,text, icon, title) {\n button.innerHTML = '';\n button.className = 'ui-button ui-widget ui-state-default ui-corner-all';\n\n // Icon only\n if(icon && !text) {\n button.className += ' ui-button-icon-only';\n icon.className += ' ui-button-icon-primary ui-icon-primary';\n button.appendChild(icon);\n }\n // Icon and Text\n else if(icon) {\n button.className += ' ui-button-text-icon-primary';\n icon.className += ' ui-button-icon-primary ui-icon-primary';\n button.appendChild(icon);\n }\n // Text only\n else {\n button.className += ' ui-button-text-only';\n }\n\n var el = document.createElement('span');\n el.className = 'ui-button-text';\n el.textContent = text||title||\".\";\n button.appendChild(el);\n\n button.setAttribute('title',title);\n },\n getIndentedPanel: function() {\n var el = document.createElement('div');\n el.className = 'ui-widget-content ui-corner-all';\n el.style.padding = '1em 1.4em';\n el.style.marginBottom = '20px';\n return el;\n },\n afterInputReady: function(input) {\n if(input.controls) return;\n input.controls = this.closest(input,'.form-control');\n },\n addInputError: function(input,text) {\n if(!input.controls) return;\n if(!input.errmsg) {\n input.errmsg = document.createElement('div');\n input.errmsg.className = 'ui-state-error';\n input.controls.appendChild(input.errmsg);\n }\n else {\n input.errmsg.style.display = '';\n }\n\n input.errmsg.textContent = text;\n },\n removeInputError: function(input) {\n if(!input.errmsg) return;\n input.errmsg.style.display = 'none';\n },\n markTabActive: function(tab) {\n tab.className = tab.className.replace(/\\s*ui-widget-header/g,'')+' ui-state-active';\n },\n markTabInactive: function(tab) {\n tab.className = tab.className.replace(/\\s*ui-state-active/g,'')+' ui-widget-header';\n }\n});\n", "JSONEditor.AbstractIconLib = Class.extend({\n mapping: {\n collapse: '',\n expand: '',\n \"delete\": '',\n edit: '',\n add: '',\n cancel: '',\n save: '',\n moveup: '',\n movedown: ''\n },\n icon_prefix: '',\n getIconClass: function(key) {\n if(this.mapping[key]) return this.icon_prefix+this.mapping[key];\n else return null;\n },\n getIcon: function(key) {\n var iconclass = this.getIconClass(key);\n \n if(!iconclass) return null;\n \n var i = document.createElement('i');\n i.className = iconclass;\n return i;\n }\n});\n", diff --git a/dist/jsoneditor.min.js b/dist/jsoneditor.min.js index c8e35797c..4e73d8fbe 100644 --- a/dist/jsoneditor.min.js +++ b/dist/jsoneditor.min.js @@ -1,10 +1,10 @@ -/*! JSON Editor v0.7.19 - JSON Schema -> HTML Editor +/*! JSON Editor v0.7.20 - JSON Schema -> HTML Editor * By Jeremy Dorn - https://github.com/jdorn/json-editor/ * Released under the MIT license * * Date: 2015-06-08 */ -!function(){var a;!function(){var b=!1,c=/xyz/.test(function(){window.postMessage("xyz")})?/\b_super\b/:/.*/;return a=function(){},a.extend=function(a){function d(){!b&&this.init&&this.init.apply(this,arguments)}var e=this.prototype;b=!0;var f=new this;b=!1;for(var g in a)f[g]="function"==typeof a[g]&&"function"==typeof e[g]&&c.test(a[g])?function(a,b){return function(){var c=this._super;this._super=e[a];var d=b.apply(this,arguments);return this._super=c,d}}(g,a[g]):a[g];return d.prototype=f,d.prototype.constructor=d,d.extend=arguments.callee,d},a}(),function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.Event.prototype,window.CustomEvent=a}(),function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c=g&&!h&&(h=!0,b())})}},d.send()}}),g||b()},expandRefs:function(a){for(a=c({},a);a.$ref;){var b=a.$ref;delete a.$ref,a=this.extendSchemas(a,this.refs[b])}return a},expandSchema:function(a){var b,e=this,f=c({},a);if("object"==typeof a.type&&(Array.isArray(a.type)?d(a.type,function(b,c){"object"==typeof c&&(a.type[b]=e.expandSchema(c))}):a.type=e.expandSchema(a.type)),"object"==typeof a.disallow&&(Array.isArray(a.disallow)?d(a.disallow,function(b,c){"object"==typeof c&&(a.disallow[b]=e.expandSchema(c))}):a.disallow=e.expandSchema(a.disallow)),a.anyOf&&d(a.anyOf,function(b,c){a.anyOf[b]=e.expandSchema(c)}),a.dependencies&&d(a.dependencies,function(b,c){"object"!=typeof c||Array.isArray(c)||(a.dependencies[b]=e.expandSchema(c))}),a.not&&(a.not=this.expandSchema(a.not)),a.allOf){for(b=0;b=a.maximum?k.push({path:e,property:"maximum",message:this.translate("error_maximum_excl",[a.maximum])}):!a.exclusiveMaximum&&b>a.maximum&&k.push({path:e,property:"maximum",message:this.translate("error_maximum_incl",[a.maximum])})),a.hasOwnProperty("minimum")&&(a.exclusiveMinimum&&b<=a.minimum?k.push({path:e,property:"minimum",message:this.translate("error_minimum_excl",[a.minimum])}):!a.exclusiveMinimum&&ba.maxLength&&k.push({path:e,property:"maxLength",message:this.translate("error_maxLength",[a.maxLength])}),a.minLength&&(b+"").lengtha.maxItems&&k.push({path:e,property:"maxItems",message:this.translate("error_maxItems",[a.maxItems])}),a.minItems&&b.lengtha.maxProperties&&k.push({path:e,property:"maxProperties",message:this.translate("error_maxProperties",[a.maxProperties])})}if(a.minProperties){g=0;for(h in b)b.hasOwnProperty(h)&&g++;g=0){b=this.theme.getBlockLinkHolder(),c=this.theme.getBlockLink(),c.setAttribute("target","_blank");var h=document.createElement(e);h.setAttribute("controls","controls"),this.theme.createMediaLink(b,c,h),this.link_watchers.push(function(b){var d=f(b);c.setAttribute("href",d),c.textContent=a.rel||d,h.setAttribute("src",d)})}else b=this.theme.getBlockLink(),b.setAttribute("target","_blank"),b.textContent=a.rel,this.link_watchers.push(function(c){var d=f(c);b.setAttribute("href",d),b.textContent=a.rel||d});return b},refreshWatchedFieldValues:function(){if(this.watched_values){var a={},b=!1,c=this;if(this.watched){var d,e;for(var f in this.watched)this.watched.hasOwnProperty(f)&&(e=c.jsoneditor.getEditor(this.watched[f]),d=e?e.getValue():null,c.watched_values[f]!==d&&(b=!0),a[f]=d)}return a.self=this.getValue(),this.watched_values.self!==a.self&&(b=!0),this.watched_values=a,b}},getWatchedFieldValues:function(){return this.watched_values},updateHeaderText:function(){if(this.header)if(this.header.children.length){for(var a=0;a1&&(b[a]=d+" "+e[d])}),b},getOption:function(a){try{throw"getOption is deprecated"}catch(b){window.console.error(b)}return this.options[a]},showValidationErrors:function(){}}),f.defaults.editors["null"]=f.AbstractEditor.extend({getValue:function(){return null},setValue:function(){this.onChange()},getNumColumns:function(){return 2}}),f.defaults.editors.string=f.AbstractEditor.extend({register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},setValue:function(a,b,c){if((!this.template||c)&&(null===a?a="":"object"==typeof a?a=JSON.stringify(a):"string"!=typeof a&&(a=""+a),a!==this.serialized)){var d=this.sanitize(a);if(this.input.value!==d){this.input.value=d,this.sceditor_instance?this.sceditor_instance.val(d):this.epiceditor?this.epiceditor.importFile(null,d):this.ace_editor&&this.ace_editor.setValue(d);var e=c||this.getValue()!==a;this.refreshValue(),b?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.adjust_height&&this.adjust_height(this.input),this.onChange(e)}}},getNumColumns:function(){var a,b=Math.ceil(Math.max(this.getTitle().length,this.schema.maxLength||0,this.schema.minLength||0)/5);return a="textarea"===this.input_type?6:["text","email"].indexOf(this.input_type)>=0?4:2,Math.min(12,Math.max(b,a))},build:function(){var a=this;if(this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.format=this.schema.format,!this.format&&this.schema.media&&this.schema.media.type&&(this.format=this.schema.media.type.replace(/(^(application|text)\/(x-)?(script\.)?)|(-source$)/g,"")),!this.format&&this.options.default_format&&(this.format=this.options.default_format),this.options.format&&(this.format=this.options.format),this.format)if("textarea"===this.format)this.input_type="textarea",this.input=this.theme.getTextareaInput();else if("range"===this.format){this.input_type="range";var b=this.schema.minimum||0,c=this.schema.maximum||Math.max(100,b+1),d=1;this.schema.multipleOf&&(b%this.schema.multipleOf&&(b=Math.ceil(b/this.schema.multipleOf)*this.schema.multipleOf),c%this.schema.multipleOf&&(c=Math.floor(c/this.schema.multipleOf)*this.schema.multipleOf),d=this.schema.multipleOf),this.input=this.theme.getRangeInput(b,c,d)}else["actionscript","batchfile","bbcode","c","c++","cpp","coffee","csharp","css","dart","django","ejs","erlang","golang","handlebars","haskell","haxe","html","ini","jade","java","javascript","json","less","lisp","lua","makefile","markdown","matlab","mysql","objectivec","pascal","perl","pgsql","php","python","r","ruby","sass","scala","scss","smarty","sql","stylus","svg","twig","vbscript","xml","yaml"].indexOf(this.format)>=0?(this.input_type=this.format,this.source_code=!0,this.input=this.theme.getTextareaInput()):(this.input_type=this.format,this.input=this.theme.getFormInputField(this.input_type));else this.input_type="text",this.input=this.theme.getFormInputField(this.input_type);"undefined"!=typeof this.schema.maxLength&&this.input.setAttribute("maxlength",this.schema.maxLength),"undefined"!=typeof this.schema.pattern?this.input.setAttribute("pattern",this.schema.pattern):"undefined"!=typeof this.schema.minLength&&this.input.setAttribute("pattern",".{"+this.schema.minLength+",}"),this.options.compact?this.container.className+=" compact":this.options.input_width&&(this.input.style.width=this.options.input_width),(this.schema.readOnly||this.schema.readonly||this.schema.template)&&(this.always_disabled=!0,this.input.disabled=!0),this.input.addEventListener("change",function(b){if(b.preventDefault(),b.stopPropagation(),a.schema.template)return void(this.value=a.value);var c=this.value,d=a.sanitize(c);c!==d&&(this.value=d),a.is_dirty=!0,a.refreshValue(),a.onChange(!0)}),this.options.input_height&&(this.input.style.height=this.options.input_height),this.options.expand_height&&(this.adjust_height=function(a){if(a){var b,c=a.offsetHeight;if(a.offsetHeight100);)b++,c++,a.style.height=c+"px";else{for(b=0;a.offsetHeight>=a.scrollHeight+3&&!(b>100);)b++,c--,a.style.height=c+"px";a.style.height=c+1+"px"}}},this.input.addEventListener("keyup",function(){a.adjust_height(this)}),this.input.addEventListener("change",function(){a.adjust_height(this)}),this.adjust_height()),this.format&&this.input.setAttribute("data-schemaformat",this.format),this.control=this.theme.getFormControl(this.label,this.input,this.description),this.container.appendChild(this.control),window.requestAnimationFrame(function(){a.input.parentNode&&a.afterInputReady(),a.adjust_height&&a.adjust_height(a.input)}),this.schema.template?(this.template=this.jsoneditor.compileTemplate(this.schema.template,this.template_engine),this.refreshValue()):this.refreshValue()},enable:function(){this.always_disabled||(this.input.disabled=!1),this._super()},disable:function(){this.input.disabled=!0,this._super()},afterInputReady:function(){var a,b=this;if(this.source_code)if(this.options.wysiwyg&&["html","bbcode"].indexOf(this.input_type)>=0&&window.jQuery&&window.jQuery.fn&&window.jQuery.fn.sceditor)a=c({},{plugins:"html"===b.input_type?"xhtml":"bbcode",emoticonsEnabled:!1,width:"100%",height:300},f.plugins.sceditor,b.options.sceditor_options||{}),window.jQuery(b.input).sceditor(a),b.sceditor_instance=window.jQuery(b.input).sceditor("instance"),b.sceditor_instance.blur(function(){var a=window.jQuery("
"+b.sceditor_instance.val()+"
");window.jQuery("#sceditor-start-marker,#sceditor-end-marker,.sceditor-nlf",a).remove(),b.input.value=a.html(),b.value=b.input.value,b.is_dirty=!0,b.onChange(!0)});else if("markdown"===this.input_type&&window.EpicEditor)this.epiceditor_container=document.createElement("div"),this.input.parentNode.insertBefore(this.epiceditor_container,this.input),this.input.style.display="none",a=c({},f.plugins.epiceditor,{container:this.epiceditor_container,clientSideStorage:!1}),this.epiceditor=new window.EpicEditor(a).load(),this.epiceditor.importFile(null,this.getValue()),this.epiceditor.on("update",function(){var a=b.epiceditor.exportFile();b.input.value=a,b.value=a,b.is_dirty=!0,b.onChange(!0)});else if(window.ace){var d=this.input_type;("cpp"===d||"c++"===d||"c"===d)&&(d="c_cpp"),this.ace_container=document.createElement("div"),this.ace_container.style.width="100%",this.ace_container.style.position="relative",this.ace_container.style.height="400px",this.input.parentNode.insertBefore(this.ace_container,this.input),this.input.style.display="none",this.ace_editor=window.ace.edit(this.ace_container),this.ace_editor.setValue(this.getValue()),f.plugins.ace.theme&&this.ace_editor.setTheme("ace/theme/"+f.plugins.ace.theme),d=window.ace.require("ace/mode/"+d),d&&this.ace_editor.getSession().setMode(new d.Mode),this.ace_editor.on("change",function(){var a=b.ace_editor.getValue(); +!function(){var a;!function(){var b=!1,c=/xyz/.test(function(){window.postMessage("xyz")})?/\b_super\b/:/.*/;return a=function(){},a.extend=function(a){function d(){!b&&this.init&&this.init.apply(this,arguments)}var e=this.prototype;b=!0;var f=new this;b=!1;for(var g in a)f[g]="function"==typeof a[g]&&"function"==typeof e[g]&&c.test(a[g])?function(a,b){return function(){var c=this._super;this._super=e[a];var d=b.apply(this,arguments);return this._super=c,d}}(g,a[g]):a[g];return d.prototype=f,d.prototype.constructor=d,d.extend=arguments.callee,d},a}(),function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}a.prototype=window.Event.prototype,window.CustomEvent=a}(),function(){for(var a=0,b=["ms","moz","webkit","o"],c=0;c0&&a.length-1 in a){for(c=0;c=g&&!h&&(h=!0,b())})}},d.send()}}),g||b()},expandRefs:function(a){for(a=c({},a);a.$ref;){var b=a.$ref;delete a.$ref,this.refs[b]||(b=decodeURIComponent(b)),a=this.extendSchemas(a,this.refs[b])}return a},expandSchema:function(a){var b,e=this,f=c({},a);if("object"==typeof a.type&&(Array.isArray(a.type)?d(a.type,function(b,c){"object"==typeof c&&(a.type[b]=e.expandSchema(c))}):a.type=e.expandSchema(a.type)),"object"==typeof a.disallow&&(Array.isArray(a.disallow)?d(a.disallow,function(b,c){"object"==typeof c&&(a.disallow[b]=e.expandSchema(c))}):a.disallow=e.expandSchema(a.disallow)),a.anyOf&&d(a.anyOf,function(b,c){a.anyOf[b]=e.expandSchema(c)}),a.dependencies&&d(a.dependencies,function(b,c){"object"!=typeof c||Array.isArray(c)||(a.dependencies[b]=e.expandSchema(c))}),a.not&&(a.not=this.expandSchema(a.not)),a.allOf){for(b=0;b=a.maximum?k.push({path:e,property:"maximum",message:this.translate("error_maximum_excl",[a.maximum])}):!a.exclusiveMaximum&&b>a.maximum&&k.push({path:e,property:"maximum",message:this.translate("error_maximum_incl",[a.maximum])})),a.hasOwnProperty("minimum")&&(a.exclusiveMinimum&&b<=a.minimum?k.push({path:e,property:"minimum",message:this.translate("error_minimum_excl",[a.minimum])}):!a.exclusiveMinimum&&ba.maxLength&&k.push({path:e,property:"maxLength",message:this.translate("error_maxLength",[a.maxLength])}),a.minLength&&(b+"").lengtha.maxItems&&k.push({path:e,property:"maxItems",message:this.translate("error_maxItems",[a.maxItems])}),a.minItems&&b.lengtha.maxProperties&&k.push({path:e,property:"maxProperties",message:this.translate("error_maxProperties",[a.maxProperties])})}if(a.minProperties){g=0;for(h in b)b.hasOwnProperty(h)&&g++;g=0){b=this.theme.getBlockLinkHolder(),c=this.theme.getBlockLink(),c.setAttribute("target","_blank");var h=document.createElement(e);h.setAttribute("controls","controls"),this.theme.createMediaLink(b,c,h),this.link_watchers.push(function(b){var d=f(b);c.setAttribute("href",d),c.textContent=a.rel||d,h.setAttribute("src",d)})}else b=this.theme.getBlockLink(),b.setAttribute("target","_blank"),b.textContent=a.rel,this.link_watchers.push(function(c){var d=f(c);b.setAttribute("href",d),b.textContent=a.rel||d});return b},refreshWatchedFieldValues:function(){if(this.watched_values){var a={},b=!1,c=this;if(this.watched){var d,e;for(var f in this.watched)this.watched.hasOwnProperty(f)&&(e=c.jsoneditor.getEditor(this.watched[f]),d=e?e.getValue():null,c.watched_values[f]!==d&&(b=!0),a[f]=d)}return a.self=this.getValue(),this.watched_values.self!==a.self&&(b=!0),this.watched_values=a,b}},getWatchedFieldValues:function(){return this.watched_values},updateHeaderText:function(){if(this.header)if(this.header.children.length){for(var a=0;a1&&(b[a]=d+" "+e[d])}),b},getOption:function(a){try{throw"getOption is deprecated"}catch(b){window.console.error(b)}return this.options[a]},showValidationErrors:function(){}}),f.defaults.editors["null"]=f.AbstractEditor.extend({getValue:function(){return null},setValue:function(){this.onChange()},getNumColumns:function(){return 2}}),f.defaults.editors.string=f.AbstractEditor.extend({register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},setValue:function(a,b,c){if((!this.template||c)&&(null===a?a="":"object"==typeof a?a=JSON.stringify(a):"string"!=typeof a&&(a=""+a),a!==this.serialized)){var d=this.sanitize(a);if(this.input.value!==d){this.input.value=d,this.sceditor_instance?this.sceditor_instance.val(d):this.epiceditor?this.epiceditor.importFile(null,d):this.ace_editor&&this.ace_editor.setValue(d);var e=c||this.getValue()!==a;this.refreshValue(),b?this.is_dirty=!1:"change"===this.jsoneditor.options.show_errors&&(this.is_dirty=!0),this.adjust_height&&this.adjust_height(this.input),this.onChange(e)}}},getNumColumns:function(){var a,b=Math.ceil(Math.max(this.getTitle().length,this.schema.maxLength||0,this.schema.minLength||0)/5);return a="textarea"===this.input_type?6:["text","email"].indexOf(this.input_type)>=0?4:2,Math.min(12,Math.max(b,a))},build:function(){var a=this;if(this.options.compact||(this.header=this.label=this.theme.getFormInputLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.format=this.schema.format,!this.format&&this.schema.media&&this.schema.media.type&&(this.format=this.schema.media.type.replace(/(^(application|text)\/(x-)?(script\.)?)|(-source$)/g,"")),!this.format&&this.options.default_format&&(this.format=this.options.default_format),this.options.format&&(this.format=this.options.format),this.format)if("textarea"===this.format)this.input_type="textarea",this.input=this.theme.getTextareaInput();else if("range"===this.format){this.input_type="range";var b=this.schema.minimum||0,c=this.schema.maximum||Math.max(100,b+1),d=1;this.schema.multipleOf&&(b%this.schema.multipleOf&&(b=Math.ceil(b/this.schema.multipleOf)*this.schema.multipleOf),c%this.schema.multipleOf&&(c=Math.floor(c/this.schema.multipleOf)*this.schema.multipleOf),d=this.schema.multipleOf),this.input=this.theme.getRangeInput(b,c,d)}else["actionscript","batchfile","bbcode","c","c++","cpp","coffee","csharp","css","dart","django","ejs","erlang","golang","handlebars","haskell","haxe","html","ini","jade","java","javascript","json","less","lisp","lua","makefile","markdown","matlab","mysql","objectivec","pascal","perl","pgsql","php","python","r","ruby","sass","scala","scss","smarty","sql","stylus","svg","twig","vbscript","xml","yaml"].indexOf(this.format)>=0?(this.input_type=this.format,this.source_code=!0,this.input=this.theme.getTextareaInput()):(this.input_type=this.format,this.input=this.theme.getFormInputField(this.input_type));else this.input_type="text",this.input=this.theme.getFormInputField(this.input_type);"undefined"!=typeof this.schema.maxLength&&this.input.setAttribute("maxlength",this.schema.maxLength),"undefined"!=typeof this.schema.pattern?this.input.setAttribute("pattern",this.schema.pattern):"undefined"!=typeof this.schema.minLength&&this.input.setAttribute("pattern",".{"+this.schema.minLength+",}"),this.options.compact?this.container.className+=" compact":this.options.input_width&&(this.input.style.width=this.options.input_width),(this.schema.readOnly||this.schema.readonly||this.schema.template)&&(this.always_disabled=!0,this.input.disabled=!0),this.input.addEventListener("change",function(b){if(b.preventDefault(),b.stopPropagation(),a.schema.template)return void(this.value=a.value);var c=this.value,d=a.sanitize(c);c!==d&&(this.value=d),a.is_dirty=!0,a.refreshValue(),a.onChange(!0)}),this.options.input_height&&(this.input.style.height=this.options.input_height),this.options.expand_height&&(this.adjust_height=function(a){if(a){var b,c=a.offsetHeight;if(a.offsetHeight100);)b++,c++,a.style.height=c+"px";else{for(b=0;a.offsetHeight>=a.scrollHeight+3&&!(b>100);)b++,c--,a.style.height=c+"px";a.style.height=c+1+"px"}}},this.input.addEventListener("keyup",function(){a.adjust_height(this)}),this.input.addEventListener("change",function(){a.adjust_height(this)}),this.adjust_height()),this.format&&this.input.setAttribute("data-schemaformat",this.format),this.control=this.theme.getFormControl(this.label,this.input,this.description),this.container.appendChild(this.control),window.requestAnimationFrame(function(){a.input.parentNode&&a.afterInputReady(),a.adjust_height&&a.adjust_height(a.input)}),this.schema.template?(this.template=this.jsoneditor.compileTemplate(this.schema.template,this.template_engine),this.refreshValue()):this.refreshValue()},enable:function(){this.always_disabled||(this.input.disabled=!1),this._super()},disable:function(){this.input.disabled=!0,this._super()},afterInputReady:function(){var a,b=this;if(this.source_code)if(this.options.wysiwyg&&["html","bbcode"].indexOf(this.input_type)>=0&&window.jQuery&&window.jQuery.fn&&window.jQuery.fn.sceditor)a=c({},{plugins:"html"===b.input_type?"xhtml":"bbcode",emoticonsEnabled:!1,width:"100%",height:300},f.plugins.sceditor,b.options.sceditor_options||{}),window.jQuery(b.input).sceditor(a),b.sceditor_instance=window.jQuery(b.input).sceditor("instance"),b.sceditor_instance.blur(function(){var a=window.jQuery("
"+b.sceditor_instance.val()+"
");window.jQuery("#sceditor-start-marker,#sceditor-end-marker,.sceditor-nlf",a).remove(),b.input.value=a.html(),b.value=b.input.value,b.is_dirty=!0,b.onChange(!0)});else if("markdown"===this.input_type&&window.EpicEditor)this.epiceditor_container=document.createElement("div"),this.input.parentNode.insertBefore(this.epiceditor_container,this.input),this.input.style.display="none",a=c({},f.plugins.epiceditor,{container:this.epiceditor_container,clientSideStorage:!1}),this.epiceditor=new window.EpicEditor(a).load(),this.epiceditor.importFile(null,this.getValue()),this.epiceditor.on("update",function(){var a=b.epiceditor.exportFile();b.input.value=a,b.value=a,b.is_dirty=!0,b.onChange(!0)});else if(window.ace){var d=this.input_type;("cpp"===d||"c++"===d||"c"===d)&&(d="c_cpp"),this.ace_container=document.createElement("div"),this.ace_container.style.width="100%",this.ace_container.style.position="relative",this.ace_container.style.height="400px",this.input.parentNode.insertBefore(this.ace_container,this.input),this.input.style.display="none",this.ace_editor=window.ace.edit(this.ace_container),this.ace_editor.setValue(this.getValue()),f.plugins.ace.theme&&this.ace_editor.setTheme("ace/theme/"+f.plugins.ace.theme),d=window.ace.require("ace/mode/"+d),d&&this.ace_editor.getSession().setMode(new d.Mode),this.ace_editor.on("change",function(){var a=b.ace_editor.getValue(); b.input.value=a,b.refreshValue(),b.is_dirty=!0,b.onChange(!0)})}b.theme.afterInputReady(b.input)},refreshValue:function(){this.value=this.input.value,"string"!=typeof this.value&&(this.value=""),this.serialized=this.value},destroy:function(){this.sceditor_instance?this.sceditor_instance.destroy():this.epiceditor?this.epiceditor.unload():this.ace_editor&&this.ace_editor.destroy(),this.template=null,this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this.label&&this.label.parentNode&&this.label.parentNode.removeChild(this.label),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this._super()},sanitize:function(a){return a},onWatchedFieldChange:function(){var a;this.template&&(a=this.getWatchedFieldValues(),this.setValue(this.template(a),!1,!0)),this._super()},showValidationErrors:function(a){var b=this;if("always"===this.jsoneditor.options.show_errors);else if(!this.is_dirty&&this.previous_error_setting===this.jsoneditor.options.show_errors)return;this.previous_error_setting=this.jsoneditor.options.show_errors;var c=[];d(a,function(a,d){d.path===b.path&&c.push(d.message)}),c.length?this.theme.addInputError(this.input,c.join(". ")+"."):this.theme.removeInputError(this.input)}}),f.defaults.editors.number=f.defaults.editors.string.extend({sanitize:function(a){return(a+"").replace(/[^0-9\.\-eE]/g,"")},getNumColumns:function(){return 2},getValue:function(){return 1*this.value}}),f.defaults.editors.integer=f.defaults.editors.number.extend({sanitize:function(a){return a+="",a.replace(/[^0-9\-]/g,"")},getNumColumns:function(){return 2}}),f.defaults.editors.object=f.AbstractEditor.extend({getDefault:function(){return c({},this.schema["default"]||{})},getChildEditors:function(){return this.editors},register:function(){if(this._super(),this.editors)for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].register()},unregister:function(){if(this._super(),this.editors)for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].unregister()},getNumColumns:function(){return Math.max(Math.min(12,this.maxwidth),3)},enable:function(){if(this.editjson_button&&(this.editjson_button.disabled=!1),this.addproperty_button&&(this.addproperty_button.disabled=!1),this._super(),this.editors)for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].enable()},disable:function(){if(this.editjson_button&&(this.editjson_button.disabled=!0),this.addproperty_button&&(this.addproperty_button.disabled=!0),this.hideEditJSON(),this._super(),this.editors)for(var a in this.editors)this.editors.hasOwnProperty(a)&&this.editors[a].disable()},layoutEditors:function(){var a,b,c=this;if(this.row_container){this.property_order=Object.keys(this.editors),this.property_order=this.property_order.sort(function(a,b){var d=c.editors[a].schema.propertyOrder,e=c.editors[b].schema.propertyOrder;return"number"!=typeof d&&(d=1e3),"number"!=typeof e&&(e=1e3),d-e});var e;if("grid"===this.format){var f=[];for(d(this.property_order,function(a,b){var d=c.editors[b];if(!d.property_removed){for(var e=!1,g=d.options.hidden?0:d.options.grid_columns||d.getNumColumns(),h=d.options.hidden?0:d.container.offsetHeight,i=0;ih)&&(e=i);e===!1&&(f.push({width:0,minh:999999,maxh:0,editors:[]}),e=f.length-1),f[e].editors.push({key:b,width:g,height:h}),f[e].width+=g,f[e].minh=Math.min(f[e].minh,h),f[e].maxh=Math.max(f[e].maxh,h)}}),a=0;af[a].editors[g].width&&(g=b),f[a].editors[b].width*=12/f[a].width,f[a].editors[b].width=Math.floor(f[a].editors[b].width),h+=f[a].editors[b].width;12>h&&(f[a].editors[g].width+=12-h),f[a].width=12}if(this.layout===JSON.stringify(f))return!1;for(this.layout=JSON.stringify(f),e=document.createElement("div"),a=0;a=this.schema.maxProperties),this.addproperty_checkboxes&&(this.addproperty_list.innerHTML=""),this.addproperty_checkboxes={};for(a in this.cached_editors)this.cached_editors.hasOwnProperty(a)&&(this.addPropertyCheckbox(a),this.isRequired(this.cached_editors[a])&&a in this.editors&&(this.addproperty_checkboxes[a].disabled=!0),"undefined"!=typeof this.schema.minProperties&&d<=this.schema.minProperties?(this.addproperty_checkboxes[a].disabled=this.addproperty_checkboxes[a].checked,this.addproperty_checkboxes[a].checked||(e=!0)):a in this.editors?(e=!0,c=!0):b||this.schema.properties.hasOwnProperty(a)?(this.addproperty_checkboxes[a].disabled=!1,e=!0):this.addproperty_checkboxes[a].disabled=!0);this.canHaveAdditionalProperties()&&(e=!0);for(a in this.schema.properties)this.schema.properties.hasOwnProperty(a)&&(this.cached_editors[a]||(e=!0,this.addPropertyCheckbox(a)));e?this.canHaveAdditionalProperties()?this.addproperty_add.disabled=b?!1:!0:(this.addproperty_add.style.display="none",this.addproperty_input.style.display="none"):(this.hideAddProperty(),this.addproperty_controls.style.display="none")},isRequired:function(a){return"boolean"==typeof a.schema.required?a.schema.required:Array.isArray(this.schema.required)?this.schema.required.indexOf(a.key)>-1:this.jsoneditor.options.required_by_default?!0:!1},setValue:function(a,b){var c=this;a=a||{},("object"!=typeof a||Array.isArray(a))&&(a={}),d(this.cached_editors,function(d,e){"undefined"!=typeof a[d]?(c.addObjectProperty(d),e.setValue(a[d],b)):b||c.isRequired(e)?e.setValue(e.getDefault(),b):c.removeObjectProperty(d)}),d(a,function(a,d){c.cached_editors[a]||(c.addObjectProperty(a),c.editors[a]&&c.editors[a].setValue(d,b))}),this.refreshValue(),this.layoutEditors(),this.onChange()},showValidationErrors:function(a){var b=this,c=[],e=[];if(d(a,function(a,d){d.path===b.path?c.push(d):e.push(d)}),this.error_holder)if(c.length){this.error_holder.innerHTML="",this.error_holder.style.display="",d(c,function(a,c){b.error_holder.appendChild(b.theme.getErrorMessage(c.message))})}else this.error_holder.style.display="none";this.options.table_row&&(c.length?this.theme.addTableRowError(this.container):this.theme.removeTableRowError(this.container)),d(this.editors,function(a,b){b.showValidationErrors(e)})}}),f.defaults.editors.array=f.AbstractEditor.extend({getDefault:function(){return this.schema["default"]||[]},register:function(){if(this._super(),this.rows)for(var a=0;a=this.schema.items.length?this.schema.additionalItems===!0?{}:this.schema.additionalItems?c({},this.schema.additionalItems):void 0:c({},this.schema.items[a]):this.schema.items?c({},this.schema.items):{}},getItemInfo:function(a){var b=this.getItemSchema(a);this.item_info=this.item_info||{};var c=JSON.stringify(b);return"undefined"!=typeof this.item_info[c]?this.item_info[c]:(b=this.jsoneditor.expandRefs(b),this.item_info[c]={title:b.title||"item","default":b["default"],width:12,child_editors:b.properties||b.items},this.item_info[c])},getElementEditor:function(a){var b=this.getItemInfo(a),c=this.getItemSchema(a);c=this.jsoneditor.expandRefs(c),c.title=b.title+" "+(a+1);var d,e=this.jsoneditor.getEditorClass(c);d=this.tabs_holder?this.theme.getTabContent():b.child_editors?this.theme.getChildEditorHolder():this.theme.getIndentedPanel(),this.row_holder.appendChild(d);var f=this.jsoneditor.createEditor(e,{jsoneditor:this.jsoneditor,schema:c,container:d,path:this.path+"."+a,parent:this,required:!0});return f.preBuild(),f.build(),f.postBuild(),f.title_controls||(f.array_controls=this.theme.getButtonHolder(),d.appendChild(f.array_controls)),f},destroy:function(){this.empty(!0),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.row_holder&&this.row_holder.parentNode&&this.row_holder.parentNode.removeChild(this.row_holder),this.controls&&this.controls.parentNode&&this.controls.parentNode.removeChild(this.controls),this.panel&&this.panel.parentNode&&this.panel.parentNode.removeChild(this.panel),this.rows=this.row_cache=this.title=this.description=this.row_holder=this.panel=this.controls=null,this._super()},empty:function(a){if(this.rows){var b=this;d(this.rows,function(c,d){a&&(d.tab&&d.tab.parentNode&&d.tab.parentNode.removeChild(d.tab),b.destroyRow(d,!0),b.row_cache[c]=null),b.rows[c]=null}),b.rows=[],a&&(b.row_cache=[])}},destroyRow:function(a,b){var c=a.container;b?(a.destroy(),c.parentNode&&c.parentNode.removeChild(c),a.tab&&a.tab.parentNode&&a.tab.parentNode.removeChild(a.tab)):(a.tab&&(a.tab.style.display="none"),c.style.display="none",a.unregister())},getMax:function(){return Array.isArray(this.schema.items)&&this.schema.additionalItems===!1?Math.min(this.schema.items.length,this.schema.maxItems||1/0):this.schema.maxItems||1/0},refreshTabs:function(a){var b=this;d(this.rows,function(c,d){d.tab&&(a?d.tab_text.textContent=d.getHeaderText():d.tab===b.active_tab?(b.theme.markTabActive(d.tab),d.container.style.display=""):(b.theme.markTabInactive(d.tab),d.container.style.display="none"))})},setValue:function(a,b){a=a||[],Array.isArray(a)||(a=[a]);var c=JSON.stringify(a);if(c!==this.serialized){if(this.schema.minItems)for(;a.lengththis.getMax()&&(a=a.slice(0,this.getMax()));var e=this;d(a,function(a,c){e.rows[a]?e.rows[a].setValue(c,b):e.row_cache[a]?(e.rows[a]=e.row_cache[a],e.rows[a].setValue(c,b),e.rows[a].container.style.display="",e.rows[a].tab&&(e.rows[a].tab.style.display=""),e.rows[a].register()):e.addRow(c,b)});for(var f=a.length;f=this.rows.length;d(this.rows,function(a,c){c.movedown_button&&(c.movedown_button.style.display=a===b.rows.length-1?"none":""),c.delete_button&&(c.delete_button.style.display=e?"none":""),b.value[a]=c.getValue()});var f=!1;this.value.length?1===this.value.length?(this.remove_all_rows_button.style.display="none",e||this.hide_delete_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",f=!0)):e||this.hide_delete_buttons?(this.delete_last_row_button.style.display="none",this.remove_all_rows_button.style.display="none"):(this.delete_last_row_button.style.display="",this.remove_all_rows_button.style.display="",f=!0):(this.delete_last_row_button.style.display="none",this.remove_all_rows_button.style.display="none"),this.getMax()&&this.getMax()<=this.rows.length||this.hide_add_button?this.add_row_button.style.display="none":(this.add_row_button.style.display="",f=!0),this.controls.style.display=!this.collapsed&&f?"inline-block":"none"}},addRow:function(a,b){var c=this,e=this.rows.length;c.rows[e]=this.getElementEditor(e),c.row_cache[e]=c.rows[e],c.tabs_holder&&(c.rows[e].tab_text=document.createElement("span"),c.rows[e].tab_text.textContent=c.rows[e].getHeaderText(),c.rows[e].tab=c.theme.getTab(c.rows[e].tab_text),c.rows[e].tab.addEventListener("click",function(a){c.active_tab=c.rows[e].tab,c.refreshTabs(),a.preventDefault(),a.stopPropagation()}),c.theme.addTab(c.tabs_holder,c.rows[e].tab));var f=c.rows[e].title_controls||c.rows[e].array_controls;c.hide_delete_buttons||(c.rows[e].delete_button=this.getButton(c.getItemTitle(),"delete","Delete "+c.getItemTitle()),c.rows[e].delete_button.className+=" delete",c.rows[e].delete_button.setAttribute("data-i",e),c.rows[e].delete_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var b=1*this.getAttribute("data-i"),e=c.getValue(),f=[],g=null;d(e,function(a,d){return a===b?void(c.rows[a].tab===c.active_tab&&(c.rows[a+1]?g=c.rows[a].tab:a&&(g=c.rows[a-1].tab))):void f.push(d)}),c.setValue(f),g&&(c.active_tab=g,c.refreshTabs()),c.onChange(!0)}),f&&f.appendChild(c.rows[e].delete_button)),e&&!c.hide_move_buttons&&(c.rows[e].moveup_button=this.getButton("","moveup","Move up"),c.rows[e].moveup_button.className+=" moveup",c.rows[e].moveup_button.setAttribute("data-i",e),c.rows[e].moveup_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var b=1*this.getAttribute("data-i");if(!(0>=b)){var d=c.getValue(),e=d[b-1];d[b-1]=d[b],d[b]=e,c.setValue(d),c.active_tab=c.rows[b-1].tab,c.refreshTabs(),c.onChange(!0)}}),f&&f.appendChild(c.rows[e].moveup_button)),c.hide_move_buttons||(c.rows[e].movedown_button=this.getButton("","movedown","Move down"),c.rows[e].movedown_button.className+=" movedown",c.rows[e].movedown_button.setAttribute("data-i",e),c.rows[e].movedown_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var b=1*this.getAttribute("data-i"),d=c.getValue();if(!(b>=d.length-1)){var e=d[b+1];d[b+1]=d[b],d[b]=e,c.setValue(d),c.active_tab=c.rows[b+1].tab,c.refreshTabs(),c.onChange(!0)}}),f&&f.appendChild(c.rows[e].movedown_button)),a&&c.rows[e].setValue(a,b),c.refreshTabs()},addControls:function(){var a=this;this.collapsed=!1,this.toggle_button=this.getButton("","collapse","Collapse"),this.title_controls.appendChild(this.toggle_button);var b=a.row_holder.style.display,c=a.controls.style.display;this.toggle_button.addEventListener("click",function(d){d.preventDefault(),d.stopPropagation(),a.collapsed?(a.collapsed=!1,a.panel&&(a.panel.style.display=""),a.row_holder.style.display=b,a.tabs_holder&&(a.tabs_holder.style.display=""),a.controls.style.display=c,a.setButtonText(this,"","collapse","Collapse")):(a.collapsed=!0,a.row_holder.style.display="none",a.tabs_holder&&(a.tabs_holder.style.display="none"),a.controls.style.display="none",a.panel&&(a.panel.style.display="none"),a.setButtonText(this,"","expand","Expand"))}),this.options.collapsed&&e(this.toggle_button,"click"),this.schema.options&&"undefined"!=typeof this.schema.options.disable_collapse?this.schema.options.disable_collapse&&(this.toggle_button.style.display="none"):this.jsoneditor.options.disable_collapse&&(this.toggle_button.style.display="none"),this.add_row_button=this.getButton(this.getItemTitle(),"add","Add "+this.getItemTitle()),this.add_row_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation();var c=a.rows.length;a.row_cache[c]?(a.rows[c]=a.row_cache[c],a.rows[c].container.style.display="",a.rows[c].tab&&(a.rows[c].tab.style.display=""),a.rows[c].register()):a.addRow(),a.active_tab=a.rows[c].tab,a.refreshTabs(),a.refreshValue(),a.onChange(!0)}),a.controls.appendChild(this.add_row_button),this.delete_last_row_button=this.getButton("Last "+this.getItemTitle(),"delete","Delete Last "+this.getItemTitle()),this.delete_last_row_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation();var c=a.getValue(),d=null;a.rows.length>1&&a.rows[a.rows.length-1].tab===a.active_tab&&(d=a.rows[a.rows.length-2].tab),c.pop(),a.setValue(c),d&&(a.active_tab=d,a.refreshTabs()),a.onChange(!0)}),a.controls.appendChild(this.delete_last_row_button),this.remove_all_rows_button=this.getButton("All","delete","Delete All"),this.remove_all_rows_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.setValue([]),a.onChange(!0)}),a.controls.appendChild(this.remove_all_rows_button),a.tabs&&(this.add_row_button.style.width="100%",this.add_row_button.style.textAlign="left",this.add_row_button.style.marginBottom="3px",this.delete_last_row_button.style.width="100%",this.delete_last_row_button.style.textAlign="left",this.delete_last_row_button.style.marginBottom="3px",this.remove_all_rows_button.style.width="100%",this.remove_all_rows_button.style.textAlign="left",this.remove_all_rows_button.style.marginBottom="3px") },showValidationErrors:function(a){var b=this,c=[],e=[];if(d(a,function(a,d){d.path===b.path?c.push(d):e.push(d)}),this.error_holder)if(c.length){this.error_holder.innerHTML="",this.error_holder.style.display="",d(c,function(a,c){b.error_holder.appendChild(b.theme.getErrorMessage(c.message))})}else this.error_holder.style.display="none";d(this.rows,function(a,b){b.showValidationErrors(e)})}}),f.defaults.editors.table=f.defaults.editors.array.extend({register:function(){if(this._super(),this.rows)for(var a=0;athis.schema.maxItems&&(a=a.slice(0,this.schema.maxItems));var c=JSON.stringify(a);if(c!==this.serialized){var e=!1,f=this;d(a,function(a,b){f.rows[a]?f.rows[a].setValue(b):(f.addRow(b),e=!0)});for(var g=a.length;g=this.rows.length,c=!1;d(this.rows,function(d,e){e.movedown_button&&(d===a.rows.length-1?e.movedown_button.style.display="none":(c=!0,e.movedown_button.style.display="")),e.delete_button&&(b?e.delete_button.style.display="none":(c=!0,e.delete_button.style.display="")),e.moveup_button&&(c=!0)}),d(this.rows,function(a,b){b.controls_cell.style.display=c?"":"none"}),this.controls_header_cell.style.display=c?"":"none";var e=!1;this.value.length?1===this.value.length||this.hide_delete_buttons?(this.table.style.display="",this.remove_all_rows_button.style.display="none",b||this.hide_delete_buttons?this.delete_last_row_button.style.display="none":(this.delete_last_row_button.style.display="",e=!0)):(this.table.style.display="",b||this.hide_delete_buttons?(this.delete_last_row_button.style.display="none",this.remove_all_rows_button.style.display="none"):(this.delete_last_row_button.style.display="",this.remove_all_rows_button.style.display="",e=!0)):(this.delete_last_row_button.style.display="none",this.remove_all_rows_button.style.display="none",this.table.style.display="none"),this.schema.maxItems&&this.schema.maxItems<=this.rows.length||this.hide_add_button?this.add_row_button.style.display="none":(this.add_row_button.style.display="",e=!0),this.controls.style.display=e?"":"none"},refreshValue:function(){var a=this;this.value=[],d(this.rows,function(b,c){a.value[b]=c.getValue()}),this.serialized=JSON.stringify(this.value)},addRow:function(a){var b=this,c=this.rows.length;b.rows[c]=this.getElementEditor(c);var e=b.rows[c].table_controls;this.hide_delete_buttons||(b.rows[c].delete_button=this.getButton("","delete","Delete"),b.rows[c].delete_button.className+=" delete",b.rows[c].delete_button.setAttribute("data-i",c),b.rows[c].delete_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var c=1*this.getAttribute("data-i"),e=b.getValue(),f=[];d(e,function(a,b){a!==c&&f.push(b)}),b.setValue(f),b.onChange(!0)}),e.appendChild(b.rows[c].delete_button)),c&&!this.hide_move_buttons&&(b.rows[c].moveup_button=this.getButton("","moveup","Move up"),b.rows[c].moveup_button.className+=" moveup",b.rows[c].moveup_button.setAttribute("data-i",c),b.rows[c].moveup_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var c=1*this.getAttribute("data-i");if(!(0>=c)){var d=b.getValue(),e=d[c-1];d[c-1]=d[c],d[c]=e,b.setValue(d),b.onChange(!0)}}),e.appendChild(b.rows[c].moveup_button)),this.hide_move_buttons||(b.rows[c].movedown_button=this.getButton("","movedown","Move down"),b.rows[c].movedown_button.className+=" movedown",b.rows[c].movedown_button.setAttribute("data-i",c),b.rows[c].movedown_button.addEventListener("click",function(a){a.preventDefault(),a.stopPropagation();var c=1*this.getAttribute("data-i"),d=b.getValue();if(!(c>=d.length-1)){var e=d[c+1];d[c+1]=d[c],d[c]=e,b.setValue(d),b.onChange(!0)}}),e.appendChild(b.rows[c].movedown_button)),a&&b.rows[c].setValue(a)},addControls:function(){var a=this;this.collapsed=!1,this.toggle_button=this.getButton("","collapse","Collapse"),this.title_controls&&(this.title_controls.appendChild(this.toggle_button),this.toggle_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.collapsed?(a.collapsed=!1,a.panel.style.display="",a.setButtonText(this,"","collapse","Collapse")):(a.collapsed=!0,a.panel.style.display="none",a.setButtonText(this,"","expand","Expand"))}),this.options.collapsed&&e(this.toggle_button,"click"),this.schema.options&&"undefined"!=typeof this.schema.options.disable_collapse?this.schema.options.disable_collapse&&(this.toggle_button.style.display="none"):this.jsoneditor.options.disable_collapse&&(this.toggle_button.style.display="none")),this.add_row_button=this.getButton(this.getItemTitle(),"add","Add "+this.getItemTitle()),this.add_row_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.addRow(),a.refreshValue(),a.refreshRowButtons(),a.onChange(!0)}),a.controls.appendChild(this.add_row_button),this.delete_last_row_button=this.getButton("Last "+this.getItemTitle(),"delete","Delete Last "+this.getItemTitle()),this.delete_last_row_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation();var c=a.getValue();c.pop(),a.setValue(c),a.onChange(!0)}),a.controls.appendChild(this.delete_last_row_button),this.remove_all_rows_button=this.getButton("All","delete","Delete All"),this.remove_all_rows_button.addEventListener("click",function(b){b.preventDefault(),b.stopPropagation(),a.setValue([]),a.onChange(!0)}),a.controls.appendChild(this.remove_all_rows_button)}}),f.defaults.editors.multiple=f.AbstractEditor.extend({register:function(){if(this.editors){for(var a=0;anull";if("object"==typeof a){var c="";return d(a,function(d,e){var f=b.getHTML(e);Array.isArray(a)||(f="
"+d+": "+f+"
"),c+="
  • "+f+"
  • "}),c=Array.isArray(a)?"
      "+c+"
    ":"
      "+c+"
    "}return"boolean"==typeof a?a?"true":"false":"string"==typeof a?a.replace(/&/g,"&").replace(//g,">"):a},setValue:function(a){this.value!==a&&(this.value=a,this.refreshValue(),this.onChange())},destroy:function(){this.display_area&&this.display_area.parentNode&&this.display_area.parentNode.removeChild(this.display_area),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.switcher&&this.switcher.parentNode&&this.switcher.parentNode.removeChild(this.switcher),this._super()}}),f.defaults.editors.select=f.AbstractEditor.extend({setValue:function(a){a=this.typecast(a||"");var b=a;this.enum_values.indexOf(b)<0&&(b=this.enum_values[0]),this.value!==b&&(this.input.value=this.enum_options[this.enum_values.indexOf(b)],this.select2&&this.select2.select2("val",this.input.value),this.value=b,this.onChange())},register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},getNumColumns:function(){if(!this.enum_options)return 3;for(var a=this.getTitle().length,b=0;b2||this.enum_options.length&&this.enumSource)){var a=c({},f.plugins.select2);this.schema.options&&this.schema.options.select2_options&&(a=c(a,this.schema.options.select2_options)),this.select2=window.jQuery(this.input).select2(a);var b=this;this.select2.on("select2-blur",function(){b.input.value=b.select2.select2("val"),b.onInputChange()})}else this.select2=null},postBuild:function(){this._super(),this.theme.afterInputReady(this.input),this.setupSelect2()},onWatchedFieldChange:function(){var a,b;if(this.enumSource){a=this.getWatchedFieldValues();for(var c=[],d=[],e=0;eType: "+a+", Size: "+Math.floor((this.value.length-this.value.split(",")[0].length-1)/1.33333)+" bytes","image"===a.substr(0,5)){this.preview.innerHTML+="
    ";var b=document.createElement("img");b.style.maxWidth="100%",b.style.maxHeight="100px",b.src=this.value,this.preview.appendChild(b)}}else this.preview.innerHTML="Invalid data URI"}},enable:function(){this.uploader&&(this.uploader.disabled=!1),this._super()},disable:function(){this.uploader&&(this.uploader.disabled=!0),this._super()},setValue:function(a){this.value!==a&&(this.value=a,this.input.value=this.value,this.refreshPreview(),this.onChange())},destroy:function(){this.preview&&this.preview.parentNode&&this.preview.parentNode.removeChild(this.preview),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this.uploader&&this.uploader.parentNode&&this.uploader.parentNode.removeChild(this.uploader),this._super()}}),f.defaults.editors.upload=f.AbstractEditor.extend({getNumColumns:function(){return 4},build:function(){var a=this;if(this.title=this.header=this.label=this.theme.getFormInputLabel(this.getTitle()),this.input=this.theme.getFormInputField("hidden"),this.container.appendChild(this.input),!this.schema.readOnly&&!this.schema.readonly){if(!this.jsoneditor.options.upload)throw"Upload handler required for upload editor";this.uploader=this.theme.getFormInputField("file"),this.uploader.addEventListener("change",function(b){if(b.preventDefault(),b.stopPropagation(),this.files&&this.files.length){var c=new FileReader;c.onload=function(b){a.preview_value=b.target.result,a.refreshPreview(),a.onChange(!0),c=null},c.readAsDataURL(this.files[0])}})}var b=this.schema.description;b||(b=""),this.preview=this.theme.getFormInputDescription(b),this.container.appendChild(this.preview),this.control=this.theme.getFormControl(this.label,this.uploader||this.input,this.preview),this.container.appendChild(this.control)},refreshPreview:function(){if(this.last_preview!==this.preview_value&&(this.last_preview=this.preview_value,this.preview.innerHTML="",this.preview_value)){var a=this,b=this.preview_value.match(/^data:([^;,]+)[;,]/);b&&(b=b[1]),b||(b="unknown");var c=this.uploader.files[0];if(this.preview.innerHTML="Type: "+b+", Size: "+c.size+" bytes","image"===b.substr(0,5)){this.preview.innerHTML+="
    ";var d=document.createElement("img");d.style.maxWidth="100%",d.style.maxHeight="100px",d.src=this.preview_value,this.preview.appendChild(d)}this.preview.innerHTML+="
    ";var e=this.getButton("Upload","upload","Upload");this.preview.appendChild(e),e.addEventListener("click",function(b){b.preventDefault(),e.setAttribute("disabled","disabled"),a.theme.removeInputError(a.uploader),a.theme.getProgressBar&&(a.progressBar=a.theme.getProgressBar(),a.preview.appendChild(a.progressBar)),a.jsoneditor.options.upload(a.path,c,{success:function(b){a.setValue(b),a.parent?a.parent.onChildEditorChange(a):a.jsoneditor.onChange(),a.progressBar&&a.preview.removeChild(a.progressBar),e.removeAttribute("disabled")},failure:function(b){a.theme.addInputError(a.uploader,b),a.progressBar&&a.preview.removeChild(a.progressBar),e.removeAttribute("disabled")},updateProgress:function(b){a.progressBar&&(b?a.theme.updateProgressBar(a.progressBar,b):a.theme.updateProgressBarUnknown(a.progressBar))}})})}},enable:function(){this.uploader&&(this.uploader.disabled=!1),this._super()},disable:function(){this.uploader&&(this.uploader.disabled=!0),this._super()},setValue:function(a){this.value!==a&&(this.value=a,this.input.value=this.value,this.onChange())},destroy:function(){this.preview&&this.preview.parentNode&&this.preview.parentNode.removeChild(this.preview),this.title&&this.title.parentNode&&this.title.parentNode.removeChild(this.title),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this.uploader&&this.uploader.parentNode&&this.uploader.parentNode.removeChild(this.uploader),this._super() -}}),f.defaults.editors.checkbox=f.AbstractEditor.extend({setValue:function(a){this.value=!!a,this.input.checked=this.value,this.onChange()},register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},getNumColumns:function(){return Math.min(12,Math.max(this.getTitle().length/7,2))},build:function(){var a=this;this.options.compact||(this.label=this.header=this.theme.getCheckboxLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.options.compact&&(this.container.className+=" compact"),this.input=this.theme.getCheckbox(),this.control=this.theme.getFormControl(this.label,this.input,this.description),(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,this.input.disabled=!0),this.input.addEventListener("change",function(b){b.preventDefault(),b.stopPropagation(),a.value=this.checked,a.onChange(!0)}),this.container.appendChild(this.control)},enable:function(){this.always_disabled||(this.input.disabled=!1),this._super()},disable:function(){this.input.disabled=!0,this._super()},destroy:function(){this.label&&this.label.parentNode&&this.label.parentNode.removeChild(this.label),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this._super()}}),f.AbstractTheme=a.extend({getContainer:function(){return document.createElement("div")},getFloatRightLinkHolder:function(){var a=document.createElement("div");return a.style=a.style||{},a.style.cssFloat="right",a.style.marginLeft="10px",a},getModal:function(){var a=document.createElement("div");return a.style.backgroundColor="white",a.style.border="1px solid black",a.style.boxShadow="3px 3px black",a.style.position="absolute",a.style.zIndex="10",a.style.display="none",a},getGridContainer:function(){var a=document.createElement("div");return a},getGridRow:function(){var a=document.createElement("div");return a.className="row",a},getGridColumn:function(){var a=document.createElement("div");return a},setGridColumnSize:function(){},getLink:function(a){var b=document.createElement("a");return b.setAttribute("href","#"),b.appendChild(document.createTextNode(a)),b},disableHeader:function(a){a.style.color="#ccc"},disableLabel:function(a){a.style.color="#ccc"},enableHeader:function(a){a.style.color=""},enableLabel:function(a){a.style.color=""},getFormInputLabel:function(a){var b=document.createElement("label");return b.appendChild(document.createTextNode(a)),b},getCheckboxLabel:function(a){var b=this.getFormInputLabel(a);return b.style.fontWeight="normal",b},getHeader:function(a){var b=document.createElement("h3");return"string"==typeof a?b.textContent=a:b.appendChild(a),b},getCheckbox:function(){var a=this.getFormInputField("checkbox");return a.style.display="inline-block",a.style.width="auto",a},getMultiCheckboxHolder:function(a,b,c){var d=document.createElement("div");b&&(b.style.display="block",d.appendChild(b));for(var e in a)a.hasOwnProperty(e)&&(a[e].style.display="inline-block",a[e].style.marginRight="20px",d.appendChild(a[e]));return c&&d.appendChild(c),d},getSelectInput:function(a){var b=document.createElement("select");return a&&this.setSelectOptions(b,a),b},getSwitcher:function(a){var b=this.getSelectInput(a);return b.style.backgroundColor="transparent",b.style.height="auto",b.style.fontStyle="italic",b.style.fontWeight="normal",b.style.padding="0 0 0 3px",b},getSwitcherOptions:function(a){return a.getElementsByTagName("option")},setSwitcherOptions:function(a,b,c){this.setSelectOptions(a,b,c)},setSelectOptions:function(a,b,c){c=c||[],a.innerHTML="";for(var d=0;d'),a.errmsg=a.parentNode.getElementsByClassName("error")[0]),a.errmsg.textContent=b)},removeInputError:function(a){a.errmsg&&(a.group.className=a.group.className.replace(/ error/g,""),a.errmsg.style.display="none")},getProgressBar:function(){var a=document.createElement("div");a.className="progress";var b=document.createElement("span");return b.className="meter",b.style.width="0%",a.appendChild(b),a},updateProgressBar:function(a,b){a&&(a.firstChild.style.width=b+"%")},updateProgressBarUnknown:function(a){a&&(a.firstChild.style.width="100%")}}),f.defaults.themes.foundation3=f.defaults.themes.foundation.extend({getHeaderButtonHolder:function(){var a=this._super();return a.style.fontSize=".6em",a},getFormInputLabel:function(a){var b=this._super(a);return b.style.fontWeight="bold",b},getTabHolder:function(){var a=document.createElement("div");return a.className="row",a.innerHTML="
    ",a},setGridColumnSize:function(a,b){var c=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"];a.className="columns "+c[b]},getTab:function(a){var b=document.createElement("dd"),c=document.createElement("a");return c.setAttribute("href","#"),c.appendChild(a),b.appendChild(c),b},getTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.className="content active",a.style.paddingLeft="5px",a},markTabActive:function(a){a.className+=" active"},markTabInactive:function(a){a.className=a.className.replace(/\s*active/g,"")},addTab:function(a,b){a.children[0].appendChild(b)}}),f.defaults.themes.foundation4=f.defaults.themes.foundation.extend({getHeaderButtonHolder:function(){var a=this._super();return a.style.fontSize=".6em",a},setGridColumnSize:function(a,b){a.className="columns large-"+b},getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8rem",b},getFormInputLabel:function(a){var b=this._super(a);return b.style.fontWeight="bold",b}}),f.defaults.themes.foundation5=f.defaults.themes.foundation.extend({getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8rem",b},setGridColumnSize:function(a,b){a.className="columns medium-"+b},getButton:function(a,b,c){var d=this._super(a,b,c);return d.className=d.className.replace(/\s*small/g,"")+" tiny",d},getTabHolder:function(){var a=document.createElement("div");return a.innerHTML="
    ",a},getTab:function(a){var b=document.createElement("dd"),c=document.createElement("a");return c.setAttribute("href","#"),c.appendChild(a),b.appendChild(c),b},getTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.className="content active",a.style.paddingLeft="5px",a},markTabActive:function(a){a.className+=" active"},markTabInactive:function(a){a.className=a.className.replace(/\s*active/g,"")},addTab:function(a,b){a.children[0].appendChild(b)}}),f.defaults.themes.html=f.AbstractTheme.extend({getFormInputLabel:function(a){var b=this._super(a);return b.style.display="block",b.style.marginBottom="3px",b.style.fontWeight="bold",b},getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8em",b.style.margin=0,b.style.display="inline-block",b.style.fontStyle="italic",b},getIndentedPanel:function(){var a=this._super();return a.style.border="1px solid #ddd",a.style.padding="5px",a.style.margin="5px",a.style.borderRadius="3px",a},getChildEditorHolder:function(){var a=this._super();return a.style.marginBottom="8px",a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.display="inline-block",a.style.marginLeft="10px",a.style.fontSize=".8em",a.style.verticalAlign="middle",a},getTable:function(){var a=this._super();return a.style.borderBottom="1px solid #ccc",a.style.marginBottom="5px",a},addInputError:function(a,b){if(a.style.borderColor="red",a.errmsg)a.errmsg.style.display="block";else{var c=this.closest(a,".form-control");a.errmsg=document.createElement("div"),a.errmsg.setAttribute("class","errmsg"),a.errmsg.style=a.errmsg.style||{},a.errmsg.style.color="red",c.appendChild(a.errmsg)}a.errmsg.innerHTML="",a.errmsg.appendChild(document.createTextNode(b))},removeInputError:function(a){a.style.borderColor="",a.errmsg&&(a.errmsg.style.display="none")},getProgressBar:function(){var a=100,b=0,c=document.createElement("progress");return c.setAttribute("max",a),c.setAttribute("value",b),c},updateProgressBar:function(a,b){a&&a.setAttribute("value",b)},updateProgressBarUnknown:function(a){a&&a.removeAttribute("value")}}),f.defaults.themes.jqueryui=f.AbstractTheme.extend({getTable:function(){var a=this._super();return a.setAttribute("cellpadding",5),a.setAttribute("cellspacing",0),a},getTableHeaderCell:function(a){var b=this._super(a);return b.className="ui-state-active",b.style.fontWeight="bold",b},getTableCell:function(){var a=this._super();return a.className="ui-widget-content",a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.marginLeft="10px",a.style.fontSize=".6em",a.style.display="inline-block",a},getFormInputDescription:function(a){var b=this.getDescription(a);return b.style.marginLeft="10px",b.style.display="inline-block",b},getFormControl:function(a,b,c){var d=this._super(a,b,c);return"checkbox"===b.type?(d.style.lineHeight="25px",d.style.padding="3px 0"):d.style.padding="4px 0 8px 0",d},getDescription:function(a){var b=document.createElement("span");return b.style.fontSize=".8em",b.style.fontStyle="italic",b.textContent=a,b},getButtonHolder:function(){var a=document.createElement("div");return a.className="ui-buttonset",a.style.fontSize=".7em",a},getFormInputLabel:function(a){var b=document.createElement("label");return b.style.fontWeight="bold",b.style.display="block",b.textContent=a,b},getButton:function(a,b,c){var d=document.createElement("button");d.className="ui-button ui-widget ui-state-default ui-corner-all",b&&!a?(d.className+=" ui-button-icon-only",b.className+=" ui-button-icon-primary ui-icon-primary",d.appendChild(b)):b?(d.className+=" ui-button-text-icon-primary",b.className+=" ui-button-icon-primary ui-icon-primary",d.appendChild(b)):d.className+=" ui-button-text-only";var e=document.createElement("span");return e.className="ui-button-text",e.textContent=a||c||".",d.appendChild(e),d.setAttribute("title",c),d},setButtonText:function(a,b,c,d){a.innerHTML="",a.className="ui-button ui-widget ui-state-default ui-corner-all",c&&!b?(a.className+=" ui-button-icon-only",c.className+=" ui-button-icon-primary ui-icon-primary",a.appendChild(c)):c?(a.className+=" ui-button-text-icon-primary",c.className+=" ui-button-icon-primary ui-icon-primary",a.appendChild(c)):a.className+=" ui-button-text-only";var e=document.createElement("span");e.className="ui-button-text",e.textContent=b||d||".",a.appendChild(e),a.setAttribute("title",d)},getIndentedPanel:function(){var a=document.createElement("div");return a.className="ui-widget-content ui-corner-all",a.style.padding="1em 1.4em",a.style.marginBottom="20px",a},afterInputReady:function(a){a.controls||(a.controls=this.closest(a,".form-control"))},addInputError:function(a,b){a.controls&&(a.errmsg?a.errmsg.style.display="":(a.errmsg=document.createElement("div"),a.errmsg.className="ui-state-error",a.controls.appendChild(a.errmsg)),a.errmsg.textContent=b)},removeInputError:function(a){a.errmsg&&(a.errmsg.style.display="none")},markTabActive:function(a){a.className=a.className.replace(/\s*ui-widget-header/g,"")+" ui-state-active"},markTabInactive:function(a){a.className=a.className.replace(/\s*ui-state-active/g,"")+" ui-widget-header"}}),f.AbstractIconLib=a.extend({mapping:{collapse:"",expand:"","delete":"",edit:"",add:"",cancel:"",save:"",moveup:"",movedown:""},icon_prefix:"",getIconClass:function(a){return this.mapping[a]?this.icon_prefix+this.mapping[a]:null},getIcon:function(a){var b=this.getIconClass(a);if(!b)return null;var c=document.createElement("i");return c.className=b,c}}),f.defaults.iconlibs.bootstrap2=f.AbstractIconLib.extend({mapping:{collapse:"chevron-down",expand:"chevron-up","delete":"trash",edit:"pencil",add:"plus",cancel:"ban-circle",save:"ok",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"icon-"}),f.defaults.iconlibs.bootstrap3=f.AbstractIconLib.extend({mapping:{collapse:"chevron-down",expand:"chevron-right","delete":"remove",edit:"pencil",add:"plus",cancel:"floppy-remove",save:"floppy-saved",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"glyphicon glyphicon-"}),f.defaults.iconlibs.fontawesome3=f.AbstractIconLib.extend({mapping:{collapse:"chevron-down",expand:"chevron-right","delete":"remove",edit:"pencil",add:"plus",cancel:"ban-circle",save:"save",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"icon-"}),f.defaults.iconlibs.fontawesome4=f.AbstractIconLib.extend({mapping:{collapse:"caret-square-o-down",expand:"caret-square-o-right","delete":"times",edit:"pencil",add:"plus",cancel:"ban",save:"save",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"fa fa-"}),f.defaults.iconlibs.foundation2=f.AbstractIconLib.extend({mapping:{collapse:"minus",expand:"plus","delete":"remove",edit:"edit",add:"add-doc",cancel:"error",save:"checkmark",moveup:"up-arrow",movedown:"down-arrow"},icon_prefix:"foundicon-"}),f.defaults.iconlibs.foundation3=f.AbstractIconLib.extend({mapping:{collapse:"minus",expand:"plus","delete":"x",edit:"pencil",add:"page-add",cancel:"x-circle",save:"save",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"fi-"}),f.defaults.iconlibs.jqueryui=f.AbstractIconLib.extend({mapping:{collapse:"triangle-1-s",expand:"triangle-1-e","delete":"trash",edit:"pencil",add:"plusthick",cancel:"closethick",save:"disk",moveup:"arrowthick-1-n",movedown:"arrowthick-1-s"},icon_prefix:"ui-icon ui-icon-"}),f.defaults.templates["default"]=function(){return{compile:function(a){var b=a.match(/{{\s*([a-zA-Z0-9\-_\.]+)\s*}}/g),c=b.length;if(!c)return function(){return a};for(var d=[],e=function(a){var c,e=b[a].replace(/[{}\s]+/g,"").split("."),f=e.length;if(f>1){var g;c=function(b){for(g=b,a=0;f>a&&(g=g[e[a]],g);a++);return g}}else e=e[0],c=function(a){return a[e]};d.push({s:b[a],r:c})},f=0;c>f;f++)e(f);return function(b){var e,g=a+"";for(f=0;c>f;f++)e=d[f],g=g.replace(e.s,e.r(b));return g}}}},f.defaults.templates.ejs=function(){return window.EJS?{compile:function(a){var b=new window.EJS({text:a});return function(a){return b.render(a)}}}:!1},f.defaults.templates.handlebars=function(){return window.Handlebars},f.defaults.templates.hogan=function(){return window.Hogan?{compile:function(a){var b=window.Hogan.compile(a);return function(a){return b.render(a)}}}:!1},f.defaults.templates.markup=function(){return window.Mark&&window.Mark.up?{compile:function(a){return function(b){return window.Mark.up(a,b)}}}:!1},f.defaults.templates.mustache=function(){return window.Mustache?{compile:function(a){return function(b){return window.Mustache.render(a,b)}}}:!1},f.defaults.templates.swig=function(){return window.swig},f.defaults.templates.underscore=function(){return window._?{compile:function(a){return function(b){return window._.template(a,b)}}}:!1},f.defaults.theme="html",f.defaults.template="default",f.defaults.options={},f.defaults.translate=function(a,b){var c=f.defaults.languages[f.defaults.language];if(!c)throw"Unknown language "+f.defaults.language;var d=c[a]||f.defaults.languages[f.defaults.default_language][a];if("undefined"==typeof d)throw"Unknown translate string "+a;if(b)for(var e=0;e=0?"multiselect":void 0}),f.defaults.resolvers.unshift(function(a){return a.oneOf?"multiple":void 0}),function(){if(window.jQuery||window.Zepto){var a=window.jQuery||window.Zepto;a.jsoneditor=f.defaults,a.fn.jsoneditor=function(a){var b=this,c=this.data("jsoneditor");if("value"===a){if(!c)throw"Must initialize jsoneditor before getting/setting the value";if(!(arguments.length>1))return c.getValue();c.setValue(arguments[1])}else{if("validate"===a){if(!c)throw"Must initialize jsoneditor before validating";return arguments.length>1?c.validate(arguments[1]):c.validate()}"destroy"===a?c&&(c.destroy(),this.data("jsoneditor",null)):(c&&c.destroy(),c=new f(this.get(0),a),this.data("jsoneditor",c),c.on("change",function(){b.trigger("change")}),c.on("ready",function(){b.trigger("ready")}))}return this}}}(),window.JSONEditor=f}(); \ No newline at end of file +}}),f.defaults.editors.checkbox=f.AbstractEditor.extend({setValue:function(a){this.value=!!a,this.input.checked=this.value,this.onChange()},register:function(){this._super(),this.input&&this.input.setAttribute("name",this.formname)},unregister:function(){this._super(),this.input&&this.input.removeAttribute("name")},getNumColumns:function(){return Math.min(12,Math.max(this.getTitle().length/7,2))},build:function(){var a=this;this.options.compact||(this.label=this.header=this.theme.getCheckboxLabel(this.getTitle())),this.schema.description&&(this.description=this.theme.getFormInputDescription(this.schema.description)),this.options.compact&&(this.container.className+=" compact"),this.input=this.theme.getCheckbox(),this.control=this.theme.getFormControl(this.label,this.input,this.description),(this.schema.readOnly||this.schema.readonly)&&(this.always_disabled=!0,this.input.disabled=!0),this.input.addEventListener("change",function(b){b.preventDefault(),b.stopPropagation(),a.value=this.checked,a.onChange(!0)}),this.container.appendChild(this.control)},enable:function(){this.always_disabled||(this.input.disabled=!1),this._super()},disable:function(){this.input.disabled=!0,this._super()},destroy:function(){this.label&&this.label.parentNode&&this.label.parentNode.removeChild(this.label),this.description&&this.description.parentNode&&this.description.parentNode.removeChild(this.description),this.input&&this.input.parentNode&&this.input.parentNode.removeChild(this.input),this._super()}}),f.AbstractTheme=a.extend({getContainer:function(){return document.createElement("div")},getFloatRightLinkHolder:function(){var a=document.createElement("div");return a.style=a.style||{},a.style.cssFloat="right",a.style.marginLeft="10px",a},getModal:function(){var a=document.createElement("div");return a.style.backgroundColor="white",a.style.border="1px solid black",a.style.boxShadow="3px 3px black",a.style.position="absolute",a.style.zIndex="10",a.style.display="none",a},getGridContainer:function(){var a=document.createElement("div");return a},getGridRow:function(){var a=document.createElement("div");return a.className="row",a},getGridColumn:function(){var a=document.createElement("div");return a},setGridColumnSize:function(){},getLink:function(a){var b=document.createElement("a");return b.setAttribute("href","#"),b.appendChild(document.createTextNode(a)),b},disableHeader:function(a){a.style.color="#ccc"},disableLabel:function(a){a.style.color="#ccc"},enableHeader:function(a){a.style.color=""},enableLabel:function(a){a.style.color=""},getFormInputLabel:function(a){var b=document.createElement("label");return b.appendChild(document.createTextNode(a)),b},getCheckboxLabel:function(a){var b=this.getFormInputLabel(a);return b.style.fontWeight="normal",b},getHeader:function(a){var b=document.createElement("h3");return"string"==typeof a?b.textContent=a:b.appendChild(a),b},getCheckbox:function(){var a=this.getFormInputField("checkbox");return a.style.display="inline-block",a.style.width="auto",a},getMultiCheckboxHolder:function(a,b,c){var d=document.createElement("div");b&&(b.style.display="block",d.appendChild(b));for(var e in a)a.hasOwnProperty(e)&&(a[e].style.display="inline-block",a[e].style.marginRight="20px",d.appendChild(a[e]));return c&&d.appendChild(c),d},getSelectInput:function(a){var b=document.createElement("select");return a&&this.setSelectOptions(b,a),b},getSwitcher:function(a){var b=this.getSelectInput(a);return b.style.backgroundColor="transparent",b.style.height="auto",b.style.fontStyle="italic",b.style.fontWeight="normal",b.style.padding="0 0 0 3px",b},getSwitcherOptions:function(a){return a.getElementsByTagName("option")},setSwitcherOptions:function(a,b,c){this.setSelectOptions(a,b,c)},setSelectOptions:function(a,b,c){c=c||[],a.innerHTML="";for(var d=0;d'),a.errmsg=a.parentNode.getElementsByClassName("error")[0]),a.errmsg.textContent=b)},removeInputError:function(a){a.errmsg&&(a.group.className=a.group.className.replace(/ error/g,""),a.errmsg.style.display="none")},getProgressBar:function(){var a=document.createElement("div");a.className="progress";var b=document.createElement("span");return b.className="meter",b.style.width="0%",a.appendChild(b),a},updateProgressBar:function(a,b){a&&(a.firstChild.style.width=b+"%")},updateProgressBarUnknown:function(a){a&&(a.firstChild.style.width="100%")}}),f.defaults.themes.foundation3=f.defaults.themes.foundation.extend({getHeaderButtonHolder:function(){var a=this._super();return a.style.fontSize=".6em",a},getFormInputLabel:function(a){var b=this._super(a);return b.style.fontWeight="bold",b},getTabHolder:function(){var a=document.createElement("div");return a.className="row",a.innerHTML="
    ",a},setGridColumnSize:function(a,b){var c=["zero","one","two","three","four","five","six","seven","eight","nine","ten","eleven","twelve"];a.className="columns "+c[b]},getTab:function(a){var b=document.createElement("dd"),c=document.createElement("a");return c.setAttribute("href","#"),c.appendChild(a),b.appendChild(c),b},getTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.className="content active",a.style.paddingLeft="5px",a},markTabActive:function(a){a.className+=" active"},markTabInactive:function(a){a.className=a.className.replace(/\s*active/g,"")},addTab:function(a,b){a.children[0].appendChild(b)}}),f.defaults.themes.foundation4=f.defaults.themes.foundation.extend({getHeaderButtonHolder:function(){var a=this._super();return a.style.fontSize=".6em",a},setGridColumnSize:function(a,b){a.className="columns large-"+b},getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8rem",b},getFormInputLabel:function(a){var b=this._super(a);return b.style.fontWeight="bold",b}}),f.defaults.themes.foundation5=f.defaults.themes.foundation.extend({getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8rem",b},setGridColumnSize:function(a,b){a.className="columns medium-"+b},getButton:function(a,b,c){var d=this._super(a,b,c);return d.className=d.className.replace(/\s*small/g,"")+" tiny",d},getTabHolder:function(){var a=document.createElement("div");return a.innerHTML="
    ",a},getTab:function(a){var b=document.createElement("dd"),c=document.createElement("a");return c.setAttribute("href","#"),c.appendChild(a),b.appendChild(c),b},getTabContentHolder:function(a){return a.children[1]},getTabContent:function(){var a=document.createElement("div");return a.className="content active",a.style.paddingLeft="5px",a},markTabActive:function(a){a.className+=" active"},markTabInactive:function(a){a.className=a.className.replace(/\s*active/g,"")},addTab:function(a,b){a.children[0].appendChild(b)}}),f.defaults.themes.html=f.AbstractTheme.extend({getFormInputLabel:function(a){var b=this._super(a);return b.style.display="block",b.style.marginBottom="3px",b.style.fontWeight="bold",b},getFormInputDescription:function(a){var b=this._super(a);return b.style.fontSize=".8em",b.style.margin=0,b.style.display="inline-block",b.style.fontStyle="italic",b},getIndentedPanel:function(){var a=this._super();return a.style.border="1px solid #ddd",a.style.padding="5px",a.style.margin="5px",a.style.borderRadius="3px",a},getChildEditorHolder:function(){var a=this._super();return a.style.marginBottom="8px",a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.display="inline-block",a.style.marginLeft="10px",a.style.fontSize=".8em",a.style.verticalAlign="middle",a},getTable:function(){var a=this._super();return a.style.borderBottom="1px solid #ccc",a.style.marginBottom="5px",a},addInputError:function(a,b){if(a.style.borderColor="red",a.errmsg)a.errmsg.style.display="block";else{var c=this.closest(a,".form-control");a.errmsg=document.createElement("div"),a.errmsg.setAttribute("class","errmsg"),a.errmsg.style=a.errmsg.style||{},a.errmsg.style.color="red",c.appendChild(a.errmsg)}a.errmsg.innerHTML="",a.errmsg.appendChild(document.createTextNode(b))},removeInputError:function(a){a.style.borderColor="",a.errmsg&&(a.errmsg.style.display="none")},getProgressBar:function(){var a=100,b=0,c=document.createElement("progress");return c.setAttribute("max",a),c.setAttribute("value",b),c},updateProgressBar:function(a,b){a&&a.setAttribute("value",b)},updateProgressBarUnknown:function(a){a&&a.removeAttribute("value")}}),f.defaults.themes.jqueryui=f.AbstractTheme.extend({getTable:function(){var a=this._super();return a.setAttribute("cellpadding",5),a.setAttribute("cellspacing",0),a},getTableHeaderCell:function(a){var b=this._super(a);return b.className="ui-state-active",b.style.fontWeight="bold",b},getTableCell:function(){var a=this._super();return a.className="ui-widget-content",a},getHeaderButtonHolder:function(){var a=this.getButtonHolder();return a.style.marginLeft="10px",a.style.fontSize=".6em",a.style.display="inline-block",a},getFormInputDescription:function(a){var b=this.getDescription(a);return b.style.marginLeft="10px",b.style.display="inline-block",b},getFormControl:function(a,b,c){var d=this._super(a,b,c);return"checkbox"===b.type?(d.style.lineHeight="25px",d.style.padding="3px 0"):d.style.padding="4px 0 8px 0",d},getDescription:function(a){var b=document.createElement("span");return b.style.fontSize=".8em",b.style.fontStyle="italic",b.textContent=a,b},getButtonHolder:function(){var a=document.createElement("div");return a.className="ui-buttonset",a.style.fontSize=".7em",a},getFormInputLabel:function(a){var b=document.createElement("label");return b.style.fontWeight="bold",b.style.display="block",b.textContent=a,b},getButton:function(a,b,c){var d=document.createElement("button");d.className="ui-button ui-widget ui-state-default ui-corner-all",b&&!a?(d.className+=" ui-button-icon-only",b.className+=" ui-button-icon-primary ui-icon-primary",d.appendChild(b)):b?(d.className+=" ui-button-text-icon-primary",b.className+=" ui-button-icon-primary ui-icon-primary",d.appendChild(b)):d.className+=" ui-button-text-only";var e=document.createElement("span");return e.className="ui-button-text",e.textContent=a||c||".",d.appendChild(e),d.setAttribute("title",c),d},setButtonText:function(a,b,c,d){a.innerHTML="",a.className="ui-button ui-widget ui-state-default ui-corner-all",c&&!b?(a.className+=" ui-button-icon-only",c.className+=" ui-button-icon-primary ui-icon-primary",a.appendChild(c)):c?(a.className+=" ui-button-text-icon-primary",c.className+=" ui-button-icon-primary ui-icon-primary",a.appendChild(c)):a.className+=" ui-button-text-only";var e=document.createElement("span");e.className="ui-button-text",e.textContent=b||d||".",a.appendChild(e),a.setAttribute("title",d)},getIndentedPanel:function(){var a=document.createElement("div");return a.className="ui-widget-content ui-corner-all",a.style.padding="1em 1.4em",a.style.marginBottom="20px",a},afterInputReady:function(a){a.controls||(a.controls=this.closest(a,".form-control"))},addInputError:function(a,b){a.controls&&(a.errmsg?a.errmsg.style.display="":(a.errmsg=document.createElement("div"),a.errmsg.className="ui-state-error",a.controls.appendChild(a.errmsg)),a.errmsg.textContent=b)},removeInputError:function(a){a.errmsg&&(a.errmsg.style.display="none")},markTabActive:function(a){a.className=a.className.replace(/\s*ui-widget-header/g,"")+" ui-state-active"},markTabInactive:function(a){a.className=a.className.replace(/\s*ui-state-active/g,"")+" ui-widget-header"}}),f.AbstractIconLib=a.extend({mapping:{collapse:"",expand:"","delete":"",edit:"",add:"",cancel:"",save:"",moveup:"",movedown:""},icon_prefix:"",getIconClass:function(a){return this.mapping[a]?this.icon_prefix+this.mapping[a]:null},getIcon:function(a){var b=this.getIconClass(a);if(!b)return null;var c=document.createElement("i");return c.className=b,c}}),f.defaults.iconlibs.bootstrap2=f.AbstractIconLib.extend({mapping:{collapse:"chevron-down",expand:"chevron-up","delete":"trash",edit:"pencil",add:"plus",cancel:"ban-circle",save:"ok",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"icon-"}),f.defaults.iconlibs.bootstrap3=f.AbstractIconLib.extend({mapping:{collapse:"chevron-down",expand:"chevron-right","delete":"remove",edit:"pencil",add:"plus",cancel:"floppy-remove",save:"floppy-saved",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"glyphicon glyphicon-"}),f.defaults.iconlibs.fontawesome3=f.AbstractIconLib.extend({mapping:{collapse:"chevron-down",expand:"chevron-right","delete":"remove",edit:"pencil",add:"plus",cancel:"ban-circle",save:"save",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"icon-"}),f.defaults.iconlibs.fontawesome4=f.AbstractIconLib.extend({mapping:{collapse:"caret-square-o-down",expand:"caret-square-o-right","delete":"times",edit:"pencil",add:"plus",cancel:"ban",save:"save",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"fa fa-"}),f.defaults.iconlibs.foundation2=f.AbstractIconLib.extend({mapping:{collapse:"minus",expand:"plus","delete":"remove",edit:"edit",add:"add-doc",cancel:"error",save:"checkmark",moveup:"up-arrow",movedown:"down-arrow"},icon_prefix:"foundicon-"}),f.defaults.iconlibs.foundation3=f.AbstractIconLib.extend({mapping:{collapse:"minus",expand:"plus","delete":"x",edit:"pencil",add:"page-add",cancel:"x-circle",save:"save",moveup:"arrow-up",movedown:"arrow-down"},icon_prefix:"fi-"}),f.defaults.iconlibs.jqueryui=f.AbstractIconLib.extend({mapping:{collapse:"triangle-1-s",expand:"triangle-1-e","delete":"trash",edit:"pencil",add:"plusthick",cancel:"closethick",save:"disk",moveup:"arrowthick-1-n",movedown:"arrowthick-1-s"},icon_prefix:"ui-icon ui-icon-"}),f.defaults.templates["default"]=function(){return{compile:function(a){var b=a.match(/{{\s*([a-zA-Z0-9\-_\.]+)\s*}}/g),c=b.length;if(!c)return function(){return a};for(var d=[],e=function(a){var c,e=b[a].replace(/[{}\s]+/g,"").split("."),f=e.length;if(f>1){var g;c=function(b){for(g=b,a=0;f>a&&(g=g[e[a]],g);a++);return g}}else e=e[0],c=function(a){return a[e]};d.push({s:b[a],r:c})},f=0;c>f;f++)e(f);return function(b){var e,g=a+"";for(f=0;c>f;f++)e=d[f],g=g.replace(e.s,e.r(b));return g}}}},f.defaults.templates.ejs=function(){return window.EJS?{compile:function(a){var b=new window.EJS({text:a});return function(a){return b.render(a)}}}:!1},f.defaults.templates.handlebars=function(){return window.Handlebars},f.defaults.templates.hogan=function(){return window.Hogan?{compile:function(a){var b=window.Hogan.compile(a);return function(a){return b.render(a)}}}:!1},f.defaults.templates.markup=function(){return window.Mark&&window.Mark.up?{compile:function(a){return function(b){return window.Mark.up(a,b)}}}:!1},f.defaults.templates.mustache=function(){return window.Mustache?{compile:function(a){return function(b){return window.Mustache.render(a,b)}}}:!1},f.defaults.templates.swig=function(){return window.swig},f.defaults.templates.underscore=function(){return window._?{compile:function(a){return function(b){return window._.template(a,b)}}}:!1},f.defaults.theme="html",f.defaults.template="default",f.defaults.options={},f.defaults.translate=function(a,b){var c=f.defaults.languages[f.defaults.language];if(!c)throw"Unknown language "+f.defaults.language;var d=c[a]||f.defaults.languages[f.defaults.default_language][a];if("undefined"==typeof d)throw"Unknown translate string "+a;if(b)for(var e=0;e=0?"multiselect":void 0}),f.defaults.resolvers.unshift(function(a){return a.oneOf?"multiple":void 0}),function(){if(window.jQuery||window.Zepto){var a=window.jQuery||window.Zepto;a.jsoneditor=f.defaults,a.fn.jsoneditor=function(a){var b=this,c=this.data("jsoneditor");if("value"===a){if(!c)throw"Must initialize jsoneditor before getting/setting the value";if(!(arguments.length>1))return c.getValue();c.setValue(arguments[1])}else{if("validate"===a){if(!c)throw"Must initialize jsoneditor before validating";return arguments.length>1?c.validate(arguments[1]):c.validate()}"destroy"===a?c&&(c.destroy(),this.data("jsoneditor",null)):(c&&c.destroy(),c=new f(this.get(0),a),this.data("jsoneditor",c),c.on("change",function(){b.trigger("change")}),c.on("ready",function(){b.trigger("ready")}))}return this}}}(),window.JSONEditor=f}(); \ No newline at end of file diff --git a/package.json b/package.json index e65f6f9a8..108173de9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "json-editor", "title": "JSONEditor", "description": "JSON Schema based editor", - "version": "0.7.19", + "version": "0.7.20", "main": "dist/jsoneditor.js", "author": { "name": "Jeremy Dorn", diff --git a/src/intro.js b/src/intro.js index 183eb6eae..dcf724405 100644 --- a/src/intro.js +++ b/src/intro.js @@ -1,4 +1,4 @@ -/*! JSON Editor v0.7.19 - JSON Schema -> HTML Editor +/*! JSON Editor v0.7.20 - JSON Schema -> HTML Editor * By Jeremy Dorn - https://github.com/jdorn/json-editor/ * Released under the MIT license *