jsoneditor/dist/jsoneditor-minimalist.min.js

36 lines
301 KiB
JavaScript
Raw Normal View History

2017-07-04 01:23:32 +08:00
/*!
* jsoneditor.js
*
* @brief
* JSONEditor is a web-based tool to view, edit, format, and validate JSON.
* It has various modes such as a tree editor, a code editor, and a plain text
* editor.
*
* Supported browsers: Chrome, Firefox, Safari, Opera, Internet Explorer 8+
*
* @license
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*
2019-01-05 22:21:54 +08:00
* Copyright (c) 2011-2019 Jos de Jong, http://jsoneditoronline.org
2017-07-04 01:23:32 +08:00
*
* @author Jos de Jong, <wjosdejong@gmail.com>
2019-08-02 01:47:55 +08:00
* @version 6.2.1
* @date 2019-08-01
2017-07-04 01:23:32 +08:00
*/
2019-08-02 01:47:55 +08:00
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.JSONEditor=t():e.JSONEditor=t()}(window,function(){return n={},o.m=i=[function(e,c,t){"use strict";t(10);var r=t(11),i=t(23),n=t(24),o=t(1).translate;c.parse=function(t){try{return JSON.parse(t)}catch(e){throw c.validate(t),e}},c.repair=function(n){var i=[],o=0,e=n.match(/^\s*(\/\*(.|[\r\n])*?\*\/)?\s*[\da-zA-Z_$]+\s*\(([\s\S]*)\)\s*;?\s*$/);e&&(n=e[3]);var t,r={"\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t"};function s(){return n.charAt(o)}function a(){return n.charAt(o+1)}function l(e){return" "===e||"\n"===e||"\r"===e||"\t"===e}function c(){for(var e=i.length-1;0<=e;){var t=i[e];if(!l(t))return t;e--}return""}function h(){for(var e=o+1;e<n.length&&l(n[e]);)e++;return n[e]}function d(){for(o+=2;o<n.length&&("*"!==s()||"/"!==a());)o++;o+=2}function u(){for(o+=2;o<n.length&&"\n"!==s();)o++}function p(e){var t="";t+='"',o++;for(var i=s();o<n.length&&i!==e;)'"'===i&&"\\"!==n.charAt(o-1)?t+='\\"':r.hasOwnProperty(i)?t+=r[i]:("\\"===i&&(o++,"'"!==(i=s())&&(t+="\\")),t+=i),o++,i=s();return i===e&&(t+='"',o++),t}function f(){for(var e="",t=s(),i=/[a-zA-Z_$\d]/;i.test(t);)e+=t,o++,t=s();return-1===["null","true","false"].indexOf(e)?'"'+e+'"':e}function m(){for(var e,t=s(),i="";/[a-zA-Z_$]/.test(t);)i+=t,o++,t=s();if(0<i.length&&"("===t){if(o++,'"'===(t=s()))e=p(t),t=s();else for(e="";")"!==t&&""!==t;)e+=t,o++,t=s();return")"===t?(o++,e):i+"("+e+t}return i}for(;o<n.length;){var g=s();"/"===g&&"*"===a()?d():"/"===g&&"/"===a()?u():" "===(t=g)||" "<=t&&t<=""||""===t||""===t||" "===t?(i.push(" "),o++):"'"===g?i.push(p(g)):'"'===g?i.push(p('"')):"`"===g?i.push(p("´")):""===g?i.push(p("")):"“"===g?i.push(p("”")):","===g&&-1!==["]","}"].indexOf(h())?o++:/[a-zA-Z_$]/.test(g)&&-1!==["{",","].indexOf(c())?i.push(f()):/[a-zA-Z_$]/.test(g)?i.push(m()):(i.push(g),o++)}return i.join("")},c.escapeUnicodeChars=function(e){return e.replace(/[\u007F-\uFFFF]/g,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})},c.validate=function(e){void 0!==i?i.parse(e):JSON.parse(e)},c.extend=function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},c.clear=function(e){for(var t in e)e.hasOwnProperty(t)&&delete e[t];return e},c.type=function(e){return null===e?"null":void 0===e?"undefined":e instanceof Number||"number"==typeof e?"number":e instanceof String||"string"==typeof e?"string":e instanceof Boolean||"boolean"==typeof e?"boolean":e instanceof RegExp||"regexp"==typeof e?"regexp":c.isArray(e)?"array":"object"};var s=/^https?:\/\/\S+$/;c.isUrl=function(e){return("string"==typeof e||e instanceof String)&&s.test(e)},c.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)},c.getAbsoluteLeft=function(e){return e.getBoundingClientRect().left+window.pageXOffset||document.scrollLeft||0},c.getAbsoluteTop=function(e){return e.getBoundingClientRect().top+window.pageYOffset||document.scrollTop||0},c.addClassName=function(e,t){var i=e.className.split(" ");-1==i.indexOf(t)&&(i.push(t),e.className=i.join(" "))},c.removeAllClassNames=function(e){e.className=""},c.removeClassName=function(e,t){var i=e.className.split(" "),n=i.indexOf(t);-1!=n&&(i.splice(n,1),e.className=i.join(" "))},c.stripFormatting=function(e){for(var t=e.childNodes,i=0,n=t.length;i<n;i++){var o=t[i];o.style&&o.removeAttribute("style");var r=o.attributes;if(r)for(var s=r.length-1;0<=s;s--){var a=r[s];!0===a.specified&&o.removeAttribute(a.name)}c.stripFormatting(o)}},c.setEndOfContentEditable=function(e){var t,i;document.createRange&&((t=document.createRange()).selectNodeContents(e),t.collapse(!1),(i=window.getSelection()).removeAllRanges(),i.addRange(t))},c.selectContentEditable=function(e){var t,i;e&&"DIV"==e.nodeName&&window.getSelection&&document.createRange&&((i=document.createRange()).selectNodeContents(e),(t=window.getSelection()).removeAllRanges(),t.addRange(i))},c.getSelection=function(){if(window.getSelection){var e=window.getSelection
return window.getComputedStyle(e).display==="none"}function b(e){this.elem=e}function t(e,t){return b.make(e("parent")).clazz("pico-overlay").clazz(e("overlayClass","")).stylize({display:"none",position:"fixed",top:"0px",left:"0px",height:"100%",width:"100%",zIndex:1e4}).stylize(e("overlayStyles",{opacity:.5,background:"#000"})).onClick(function(){e("overlayClose",!0)&&t()})}b.make=function(e,t){if(typeof e==="string"){e=document.querySelector(e)}var i=document.createElement(t||"div");(e||document.body).appendChild(i);return new b(i)},b.prototype={child:function(e){return b.make(this.elem,e)},stylize:function(e){e=e||{};if(typeof e.opacity!=="undefined"){e.filter="alpha(opacity="+e.opacity*100+")"}for(var t in e){if(e.hasOwnProperty(t)){this.elem.style[t]=e[t]}}return this},clazz:function(e){this.elem.className+=" "+e;return this},html:function(e){if(g(e)){this.elem.appendChild(e)}else{this.elem.innerHTML=e}return this},onClick:function(e){this.elem.addEventListener("click",e);return this},destroy:function(){this.elem.parentNode.removeChild(this.elem)},hide:function(){this.elem.style.display="none"},show:function(){this.elem.style.display="block"},attr:function(e,t){if(t!==undefined){this.elem.setAttribute(e,t)}return this},anyAncestor:function(e){var t=this.elem;while(t){if(e(new b(t))){return true}else{t=t.parentNode}}return false},isVisible:function(){return!y(this.elem)}};var x=1;function i(e,t){var i=e("width","auto");if("number"==typeof i)i+="px";var n=e("modalId","pico-"+x++);return b.make(e("parent")).clazz("pico-content").clazz(e("modalClass","")).stylize({display:"none",position:"fixed",zIndex:10001,left:"50%",top:"38.1966%",maxHeight:"90%",boxSizing:"border-box",width:i,"-ms-transform":"translate(-50%,-38.1966%)","-moz-transform":"translate(-50%,-38.1966%)","-webkit-transform":"translate(-50%,-38.1966%)","-o-transform":"translate(-50%,-38.1966%)",transform:"translate(-50%,-38.1966%)"}).stylize(e("modalStyles",{overflow:"auto",backgroundColor:"white",padding:"20px",borderRadius:"5px"})).html(e("content")).attr("id",n).attr("role","dialog").attr("aria-labelledby",e("ariaLabelledBy")).attr("aria-describedby",e("ariaDescribedBy",n)).onClick(function(e){new b(e.target).anyAncestor(function(e){return/\bpico-close\b/.test(e.elem.className)})&&t()})}function n(e,t){if(t("closeButton",!0))return e.child("button").html(t("closeHtml","&#xD7;")).clazz("pico-close").clazz(t("closeClass","")).stylize(t("closeStyles",{borderRadius:"2px",border:0,padding:0,cursor:"pointer",height:"15px",width:"15px",position:"absolute",top:"5px",right:"5px",fontSize:"16px",textAlign:"center",lineHeight:"15px",background:"#CCC"})).attr("aria-label",t("close-label","Close"))}function w(e){return function(){return e().elem}}var _=v(),C=v();function o(n,o){function t(e,t){return(e.msMatchesSelector||e.webkitMatchesSelector||e.matches).call(e,t)}function r(e){return!(y(e)||t(e,":disabled")||e.hasAttribute("contenteditable"))&&(e.hasAttribute("tabindex")||t(e,"input,select,textarea,button,a[href],area[href],iframe"))}function s(e){for(var t=e.getElementsByTagName("*"),i=0;i<t.length;i++)if(r(t[i]))return t[i]}function r(e){for(var t=e.getElementsByTagName("*"),i=t.length;i--;)if(r(t[i]))return t[i]}var e;n.beforeShow(function(){e=document.activeElement}),n.afterShow(function(){if(o()){var e=s(n.modalElem());e&&e.focus()}}),n.afterClose(function(){o()&&e&&e.focus(),e=null}),C.watch(function(e){if(o()&&n.isVisible()){var t=s(n.modalElem()),i=function(e){for(var t=e.getElementsByTagName("*"),i=t.length;i--;)if(r(t[i]))return t[i]}(n.modalElem());(e.shiftKey?t:i)===document.activeElement&&((e.shiftKey?i:t).focus(),e.preventDefault())}})}function r(e,t){var i,n=new b(document.body);e.beforeShow(function(){i=n.elem.style.overflow,t()&&n.stylize({overflow:"hidden"})}),e.afterClose(function(){n.stylize({overflow:i})})}return document.documentElement.addEventListener("keydown",function(e){var t=e.which||e.keyCode;27===t?_.trigger():9===t&&C.trigger(e)}),function(n){(function(e){return"string"==typeof e}(n)||g(n))&&(n={content:n});var o=v(),t=v(),i=v(),r=v(
2019-07-28 22:12:46 +08:00
e.exports.src='"no use strict";!function(window){function resolveModuleId(id,paths){for(var testPath=id,tail="";testPath;){var alias=paths[testPath];if("string"==typeof alias)return alias+tail;if(alias)return alias.location.replace(/\\/*$/,"/")+(tail||alias.main||alias.name);if(alias===!1)return"";var i=testPath.lastIndexOf("/");if(-1===i)break;tail=testPath.substr(i)+tail,testPath=testPath.slice(0,i)}return id}if(!(void 0!==window.window&&window.document||window.acequire&&window.define)){window.console||(window.console=function(){var msgs=Array.prototype.slice.call(arguments,0);postMessage({type:"log",data:msgs})},window.console.error=window.console.warn=window.console.log=window.console.trace=window.console),window.window=window,window.ace=window,window.onerror=function(message,file,line,col,err){postMessage({type:"error",data:{message:message,data:err.data,file:file,line:line,col:col,stack:err.stack}})},window.normalizeModule=function(parentId,moduleName){if(-1!==moduleName.indexOf("!")){var chunks=moduleName.split("!");return window.normalizeModule(parentId,chunks[0])+"!"+window.normalizeModule(parentId,chunks[1])}if("."==moduleName.charAt(0)){var base=parentId.split("/").slice(0,-1).join("/");for(moduleName=(base?base+"/":"")+moduleName;-1!==moduleName.indexOf(".")&&previous!=moduleName;){var previous=moduleName;moduleName=moduleName.replace(/^\\.\\//,"").replace(/\\/\\.\\//,"/").replace(/[^\\/]+\\/\\.\\.\\//,"")}}return moduleName},window.acequire=function acequire(parentId,id){if(id||(id=parentId,parentId=null),!id.charAt)throw Error("worker.js acequire() accepts only (parentId, id) as arguments");id=window.normalizeModule(parentId,id);var module=window.acequire.modules[id];if(module)return module.initialized||(module.initialized=!0,module.exports=module.factory().exports),module.exports;if(!window.acequire.tlns)return console.log("unable to load "+id);var path=resolveModuleId(id,window.acequire.tlns);return".js"!=path.slice(-3)&&(path+=".js"),window.acequire.id=id,window.acequire.modules[id]={},importScripts(path),window.acequire(parentId,id)},window.acequire.modules={},window.acequire.tlns={},window.define=function(id,deps,factory){if(2==arguments.length?(factory=deps,"string"!=typeof id&&(deps=id,id=window.acequire.id)):1==arguments.length&&(factory=id,deps=[],id=window.acequire.id),"function"!=typeof factory)return window.acequire.modules[id]={exports:factory,initialized:!0},void 0;deps.length||(deps=["require","exports","module"]);var req=function(childId){return window.acequire(id,childId)};window.acequire.modules[id]={exports:{},factory:function(){var module=this,returnExports=factory.apply(this,deps.map(function(dep){switch(dep){case"require":return req;case"exports":return module.exports;case"module":return module;default:return req(dep)}}));return returnExports&&(module.exports=returnExports),module}}},window.define.amd={},acequire.tlns={},window.initBaseUrls=function(topLevelNamespaces){for(var i in topLevelNamespaces)acequire.tlns[i]=topLevelNamespaces[i]},window.initSender=function(){var EventEmitter=window.acequire("ace/lib/event_emitter").EventEmitter,oop=window.acequire("ace/lib/oop"),Sender=function(){};return function(){oop.implement(this,EventEmitter),this.callback=function(data,callbackId){postMessage({type:"call",id:callbackId,data:data})},this.emit=function(name,data){postMessage({type:"event",name:name,data:data})}}.call(Sender.prototype),new Sender};var main=window.main=null,sender=window.sender=null;window.onmessage=function(e){var msg=e.data;if(msg.event&&sender)sender._signal(msg.event,msg.data);else if(msg.command)if(main[msg.command])main[msg.command].apply(main,msg.args);else{if(!window[msg.command])throw Error("Unknown command:"+msg.command);window[msg.command].apply(window,msg.args)}else if(msg.init){window.initBaseUrls(msg.tlns),acequire("ace/lib/es5-shim"),sender=window.sender=window.initSender();var clazz=acequire(msg.module)[msg.classname];main=window.main=new clazz(sender)}}}}(this),ace.define("ace/lib/oop",["require","exports","module"],function(acequire,exports){"use strict"
this.frame.onclick=function(e){var t=e.target;i(e),"BUTTON"==t.nodeName&&e.preventDefault()},this.frame.oninput=i,this.frame.onchange=i,this.frame.onkeydown=i,this.frame.onkeyup=i,this.frame.oncut=i,this.frame.onpaste=i,this.frame.onmousedown=i,this.frame.onmouseup=i,this.frame.onmouseover=i,this.frame.onmouseout=i,u.addEventListener(this.frame,"focus",i,!0),u.addEventListener(this.frame,"blur",i,!0),this.frame.onfocusin=i,this.frame.onfocusout=i,this.options.mainMenuBar){u.addClassName(this.contentOuter,"has-main-menu-bar"),this.menu=document.createElement("div"),this.menu.className="jsoneditor-menu",this.frame.appendChild(this.menu);var e=document.createElement("button");e.type="button",e.className="jsoneditor-expand-all",e.title=p("expandAll"),e.onclick=function(){t.expandAll()},this.menu.appendChild(e);var n=document.createElement("button");if(n.type="button",n.title=p("collapseAll"),n.className="jsoneditor-collapse-all",n.onclick=function(){t.collapseAll()},this.menu.appendChild(n),this.options.enableSort){var o=document.createElement("button");o.type="button",o.className="jsoneditor-sort",o.title=p("sortTitleShort"),o.onclick=function(){t.node.showSortModal()},this.menu.appendChild(o)}if(this.options.enableTransform){var r=document.createElement("button");r.type="button",r.title=p("transformTitleShort"),r.className="jsoneditor-transform",r.onclick=function(){t.node.showTransformModal()},this.menu.appendChild(r)}if(this.history){var s=document.createElement("button");s.type="button",s.className="jsoneditor-undo jsoneditor-separator",s.title=p("undo"),s.onclick=function(){t._onUndo()},this.menu.appendChild(s),this.dom.undo=s;var a=document.createElement("button");a.type="button",a.className="jsoneditor-redo",a.title=p("redo"),a.onclick=function(){t._onRedo()},this.menu.appendChild(a),this.dom.redo=a,this.history.onChange=function(){s.disabled=!t.history.canUndo(),a.disabled=!t.history.canRedo()},this.history.onChange()}if(this.options&&this.options.modes&&this.options.modes.length){var l=this;this.modeSwitcher=new d(this.menu,this.options.modes,this.options.mode,function(e){l.setMode(e),l.modeSwitcher.focus()})}this.options.search&&(this.searchBox=new c(this,this.menu))}this.options.navigationBar&&(this.navBar=document.createElement("div"),this.navBar.className="jsoneditor-navigation-bar nav-bar-empty",this.frame.appendChild(this.navBar),this.treePath=new h(this.navBar,this.frame),this.treePath.onSectionSelected(this._onTreePathSectionSelected.bind(this)),this.treePath.onContextMenuItemSelected(this._onTreePathMenuItemSelected.bind(this)))},_onUndo:function(){this.history&&(this.history.undo(),this._onChange())},_onRedo:function(){this.history&&(this.history.redo(),this._onChange())},_onEvent:function(e){if(!l.targetIsColorPicker(e.target)){var t=l.getNodeFromTarget(e.target);if("keydown"===e.type&&this._onKeyDown(e),"focus"===e.type&&(this.focusTarget=e.target,this.options.autocomplete&&"focus"===this.options.autocomplete.trigger&&this._showAutoComplete(e.target)),"mousedown"===e.type&&this._startDragDistance(e),"mousemove"!==e.type&&"mouseup"!==e.type&&"click"!==e.type||this._updateDragDistance(e),t&&this.options&&this.options.navigationBar&&t&&("keydown"===e.type||"mousedown"===e.type)){var i=this;setTimeout(function(){i._updateTreePath(t.getNodePath())})}if(t&&t.selected){if("click"===e.type){if(e.target===t.dom.menu)return void this.showContextMenu(e.target);e.hasMoved||this.deselect()}"mousedown"===e.type&&l.onDragStart(this.multiselection.nodes,e)}else"mousedown"===e.type&&u.hasParentNode(e.target,this.content)&&(this.deselect(),t&&e.target===t.dom.drag?l.onDragStart(t,e):t&&(e.target===t.dom.field||e.target===t.dom.value||e.target===t.dom.select)||this._onMultiSelectStart(e));t&&t.onEvent(e)}},_updateTreePath:function(e){if(e&&e.length){u.removeClassName(this.navBar,"nav-bar-empty");var i=[];e.forEach(function(e){var t={name:n(e),node:e,children:[]};e.childs&&e.childs.length&&e.childs.forEach(function(e){t.children.push({name:n(e),node:e})}),i.push(t)}),this.treePath.setPath(i)}else u.addClassName(this.navBa
"jsoneditor-expandable"))),this._updateDomField(),this._updateDomValue(),this._updateCssClassName(),t&&!0===t.updateIndexes&&this._updateDomIndexes(),t&&!0===t.recurse&&this.childs&&this.childs.forEach(function(e){e.updateDom(t)}),this.error&&this.updateError(),this.append&&this.append.updateDom(),this.showMore&&this.showMore.updateDom()},D.prototype._updateSchema=function(){this.editor&&this.editor.options&&(this.schema=this.editor.options.schema?D._findSchema(this.editor.options.schema,this.editor.options.schemaRefs||{},this.getPath()):null,this.schema?this.enum=D._findEnum(this.schema):delete this.enum)},D._findEnum=function(e){if(e.enum)return e.enum;var t=e.oneOf||e.anyOf||e.allOf;if(t){var i=t.filter(function(e){return e.enum});if(0<i.length)return i[0].enum}return null},D._findSchema=function(e,t,i){var n=e,o=n,r=e.oneOf||e.anyOf||e.allOf;r=r||[e];for(var s=0;s<r.length;s++){"$ref"in(n=r[s])&&"string"==typeof n.$ref&&(n=t[n.$ref])&&(o=D._findSchema(n,t,i));for(var a=0;a<i.length&&n;a++){var l=i.slice(a+1,i.length),c=i[a];if("string"!=typeof c||!n.patternProperties||n.properties&&c in n.properties)"string"==typeof c&&n.properties?c in n.properties?(n=n.properties[c])&&(o=D._findSchema(n,t,l)):o=null:"number"==typeof c&&n.items&&(n=n.items)&&(o=D._findSchema(n,t,l));else for(var h in n.patternProperties)c.match(h)&&(o=D._findSchema(n.patternProperties[h],t,l))}}return o===e&&0<i.length?null:o},D.prototype._updateDomIndexes=function(){var e=this.dom.value,t=this.childs;e&&t&&("array"==this.type?t.forEach(function(e,t){e.index=t;var i=e.dom.field;i&&(i.innerHTML=t)}):"object"==this.type&&t.forEach(function(e){null!=e.index&&(delete e.index,null==e.field&&(e.field=""))}))},D.prototype._createDomValue=function(){var e;return"array"==this.type?(e=document.createElement("div")).innerHTML="[...]":"object"==this.type?(e=document.createElement("div")).innerHTML="{...}":(!this.editable.value&&P.isUrl(this.value)?(e=document.createElement("a")).href=this.value:((e=document.createElement("div")).contentEditable=this.editable.value,e.spellcheck=!1),e.innerHTML=this._escapeHTML(this.value)),e},D.prototype._createDomExpandButton=function(){var e=document.createElement("button");return e.type="button",this._hasChilds()?(e.className=this.expanded?"jsoneditor-button jsoneditor-expanded":"jsoneditor-button jsoneditor-collapsed",e.title=d("expandTitle")):(e.className="jsoneditor-button jsoneditor-invisible",e.title=""),e},D.prototype._createDomTree=function(){var e=this.dom,t=document.createElement("table"),i=document.createElement("tbody");t.style.borderCollapse="collapse",t.className="jsoneditor-values",t.appendChild(i);var n=document.createElement("tr");i.appendChild(n);var o=document.createElement("td");o.className="jsoneditor-tree",n.appendChild(o),e.expand=this._createDomExpandButton(),o.appendChild(e.expand),e.tdExpand=o;var r=document.createElement("td");r.className="jsoneditor-tree",n.appendChild(r),e.field=this._createDomField(),r.appendChild(e.field),e.tdField=r;var s=document.createElement("td");s.className="jsoneditor-tree",n.appendChild(s),"object"!=this.type&&"array"!=this.type&&(s.appendChild(document.createTextNode(":")),s.className="jsoneditor-separator"),e.tdSeparator=s;var a=document.createElement("td");return a.className="jsoneditor-tree",n.appendChild(a),e.value=this._createDomValue(),a.appendChild(e.value),e.tdValue=a,t},D.prototype.onEvent=function(e){var t=e.type,i=e.target||e.srcElement,n=this.dom,o=this,r=this._hasChilds();if("function"==typeof this.editor.options.onEvent&&this._onEvent(e),i!=n.drag&&i!=n.menu||("mouseover"==t?this.editor.highlighter.highlight(this):"mouseout"==t&&this.editor.highlighter.unhighlight()),"click"==t&&i==n.menu){var s=o.editor.highlighter;s.highlight(o),s.lock(),P.addClassName(n.menu,"jsoneditor-selected"),this.showContextMenu(n.menu,function(){P.removeClassName(n.menu,"jsoneditor-selected"),s.unlock(),s.unhighlight()})}if("click"==t&&(i==n.expand||("view"===o.editor.options.mode||"form"===o.editor.options.mode)&&"DIV"===i.nodeName)&&r){var a=e.ctrlKey;this._onExpand(a)}"click"!
;t.validateCustom=function(e,t){if(!t)return Promise.resolve([]);try{var i=t(e);return(n(i)?i:Promise.resolve(i)).then(function(e){return Array.isArray(e)?e.filter(function(e){var t=o(e);return t||console.warn('Ignoring a custom validation error with invalid structure. Expected structure: {path: [...], message: "..."}. Actual error:',e),t}).map(function(e){return{dataPath:r(e.path),message:e.message}}):[]})}catch(e){return Promise.reject(e)}}},function(e,t){ace.define("ace/theme/jsoneditor",["require","exports","module","ace/lib/dom"],function(e,t,i){t.isDark=!1,t.cssClass="ace-jsoneditor",t.cssText='.ace-jsoneditor .ace_gutter {background: #ebebeb;color: #333}.ace-jsoneditor.ace_editor {font-family: "dejavu sans mono", "droid sans mono", consolas, monaco, "lucida console", "courier new", courier, monospace, sans-serif;line-height: 1.3;background-color: #fff;}.ace-jsoneditor .ace_print-margin {width: 1px;background: #e8e8e8}.ace-jsoneditor .ace_scroller {background-color: #FFFFFF}.ace-jsoneditor .ace_text-layer {color: gray}.ace-jsoneditor .ace_variable {color: #1a1a1a}.ace-jsoneditor .ace_cursor {border-left: 2px solid #000000}.ace-jsoneditor .ace_overwrite-cursors .ace_cursor {border-left: 0px;border-bottom: 1px solid #000000}.ace-jsoneditor .ace_marker-layer .ace_selection {background: lightgray}.ace-jsoneditor.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #FFFFFF;border-radius: 2px}.ace-jsoneditor .ace_marker-layer .ace_step {background: rgb(255, 255, 0)}.ace-jsoneditor .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #BFBFBF}.ace-jsoneditor .ace_marker-layer .ace_active-line {background: #FFFBD1}.ace-jsoneditor .ace_gutter-active-line {background-color : #dcdcdc}.ace-jsoneditor .ace_marker-layer .ace_selected-word {border: 1px solid lightgray}.ace-jsoneditor .ace_invisible {color: #BFBFBF}.ace-jsoneditor .ace_keyword,.ace-jsoneditor .ace_meta,.ace-jsoneditor .ace_support.ace_constant.ace_property-value {color: #AF956F}.ace-jsoneditor .ace_keyword.ace_operator {color: #484848}.ace-jsoneditor .ace_keyword.ace_other.ace_unit {color: #96DC5F}.ace-jsoneditor .ace_constant.ace_language {color: darkorange}.ace-jsoneditor .ace_constant.ace_numeric {color: red}.ace-jsoneditor .ace_constant.ace_character.ace_entity {color: #BF78CC}.ace-jsoneditor .ace_invalid {color: #FFFFFF;background-color: #FF002A;}.ace-jsoneditor .ace_fold {background-color: #AF956F;border-color: #000000}.ace-jsoneditor .ace_storage,.ace-jsoneditor .ace_support.ace_class,.ace-jsoneditor .ace_support.ace_function,.ace-jsoneditor .ace_support.ace_other,.ace-jsoneditor .ace_support.ace_type {color: #C52727}.ace-jsoneditor .ace_string {color: green}.ace-jsoneditor .ace_comment {color: #BCC8BA}.ace-jsoneditor .ace_entity.ace_name.ace_tag,.ace-jsoneditor .ace_entity.ace_other.ace_attribute-name {color: #606060}.ace-jsoneditor .ace_markup.ace_underline {text-decoration: underline}.ace-jsoneditor .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y}',e("../lib/dom").importCssString(t.cssText,t.cssClass)})},function(e,t,i){"use strict";var o=i(4),d=i(1).translate,u=i(7),p=i(15),n=i(14)[0].mixin,r=i(5),s=i(6),a=i(2).MAX_PREVIEW_CHARACTERS,l=i(2).DEFAULT_MODAL_ANCHOR,c=i(2).SIZE_LARGE,f=i(2).PREVIEW_HISTORY_LIMIT,m=i(0),g=i(36),h={create:function(e,t){void 0===(t=t||{}).statusBar&&(t.statusBar=!0),t.mainMenuBar=!1!==t.mainMenuBar,t.enableSort=!1!==t.enableSort,t.enableTransform=!1!==t.enableTransform,(this.options=t).indentation?this.indentation=Number(t.indentation):this.indentation=2,this.mode="preview";var i=this;if(this.container=e,this.dom={},this.json=void 0,this.text="",this._debouncedValidate=m.debounce(this.validate.bind(this),this.DEBOUNCE_INTERVAL),this.width=e.clientWidth,this.height=e.clientHeight,this.frame=document.createElement("div"),this.frame.className="jsoneditor jsoneditor-mode-preview",this.frame.onclick=function(e){e.preventDefault()},this.content=document.createElement("div"
2017-07-04 01:23:32 +08:00
//# sourceMappingURL=jsoneditor-minimalist.map