From 1c005103e43f0637c18cc567b360955ecbf76b1c Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Fri, 3 Oct 2014 20:04:37 +0200 Subject: [PATCH 1/9] Forward at least some information to onChange callback josdejong/jsoneditor#102 --- jsoneditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsoneditor.js b/jsoneditor.js index 827db78c0..1170497c4 100644 --- a/jsoneditor.js +++ b/jsoneditor.js @@ -619,7 +619,7 @@ return /******/ (function(modules) { // webpackBootstrap // trigger the onChange callback if (this.options.change) { try { - this.options.change(); + this.options.change(params); } catch (err) { util.log('Error in change callback: ', err); From de028b06945f2212c7e174a10316e58e3c0e64fd Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Fri, 3 Oct 2014 21:24:09 +0200 Subject: [PATCH 2/9] Provide action to onChange callback --- jsoneditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jsoneditor.js b/jsoneditor.js index 1170497c4..1daaaa65f 100644 --- a/jsoneditor.js +++ b/jsoneditor.js @@ -619,7 +619,7 @@ return /******/ (function(modules) { // webpackBootstrap // trigger the onChange callback if (this.options.change) { try { - this.options.change(params); + this.options.change(action, params); } catch (err) { util.log('Error in change callback: ', err); From e6321ca4adb8994a3619c2daebaca5ec39132829 Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Tue, 14 Oct 2014 01:09:43 +0200 Subject: [PATCH 3/9] Provide arguments to change callback for undo & redo. Do not trigger change callback, if no change was made with undo/redo. --- jsoneditor.js | 202 +++++++++++++++++++++++---------------------- jsoneditor.map | 2 +- jsoneditor.min.js | 6 +- src/js/History.js | 4 + src/js/treemode.js | 20 ++--- 5 files changed, 119 insertions(+), 115 deletions(-) diff --git a/jsoneditor.js b/jsoneditor.js index 1daaaa65f..1a4c54047 100644 --- a/jsoneditor.js +++ b/jsoneditor.js @@ -24,7 +24,7 @@ * * @author Jos de Jong, * @version 3.1.2 - * @date 2014-09-03 + * @date 2014-10-14 */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') @@ -348,7 +348,7 @@ return /******/ (function(modules) { // webpackBootstrap /* 1 */ /***/ function(module, exports, __webpack_require__) { - var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(4), __webpack_require__(5), __webpack_require__(6), __webpack_require__(7), __webpack_require__(8), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Highlighter, History, SearchBox, Node, modeswitcher, util) { + var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(5), __webpack_require__(4), __webpack_require__(6), __webpack_require__(7), __webpack_require__(8), __webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function (Highlighter, History, SearchBox, Node, modeswitcher, util) { // create a mixin with the functions for tree mode var treemode = {}; @@ -898,11 +898,10 @@ return /******/ (function(modules) { // webpackBootstrap treemode._onUndo = function () { if (this.history) { // undo last action - this.history.undo(); - + var historyEntry = this.history.undo(); // trigger change callback if (this.options.change) { - this.options.change(); + this.options.change(historyEntry.action, historyEntry.params); } } }; @@ -914,11 +913,10 @@ return /******/ (function(modules) { // webpackBootstrap treemode._onRedo = function () { if (this.history) { // redo last action - this.history.redo(); - + var historyEntry = this.history.redo(); // trigger change callback if (this.options.change) { - this.options.change(); + this.options.change(historyEntry.action, historyEntry.params); } } }; @@ -1916,98 +1914,6 @@ return /******/ (function(modules) { // webpackBootstrap /***/ }, /* 4 */ -/***/ function(module, exports, __webpack_require__) { - - var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function () { - - /** - * The highlighter can highlight/unhighlight a node, and - * animate the visibility of a context menu. - * @constructor Highlighter - */ - function Highlighter () { - this.locked = false; - } - - /** - * Hightlight given node and its childs - * @param {Node} node - */ - Highlighter.prototype.highlight = function (node) { - if (this.locked) { - return; - } - - if (this.node != node) { - // unhighlight current node - if (this.node) { - this.node.setHighlight(false); - } - - // highlight new node - this.node = node; - this.node.setHighlight(true); - } - - // cancel any current timeout - this._cancelUnhighlight(); - }; - - /** - * Unhighlight currently highlighted node. - * Will be done after a delay - */ - Highlighter.prototype.unhighlight = function () { - if (this.locked) { - return; - } - - var me = this; - if (this.node) { - this._cancelUnhighlight(); - - // do the unhighlighting after a small delay, to prevent re-highlighting - // the same node when moving from the drag-icon to the contextmenu-icon - // or vice versa. - this.unhighlightTimer = setTimeout(function () { - me.node.setHighlight(false); - me.node = undefined; - me.unhighlightTimer = undefined; - }, 0); - } - }; - - /** - * Cancel an unhighlight action (if before the timeout of the unhighlight action) - * @private - */ - Highlighter.prototype._cancelUnhighlight = function () { - if (this.unhighlightTimer) { - clearTimeout(this.unhighlightTimer); - this.unhighlightTimer = undefined; - } - }; - - /** - * Lock highlighting or unhighlighting nodes. - * methods highlight and unhighlight do not work while locked. - */ - Highlighter.prototype.lock = function () { - this.locked = true; - }; - - /** - * Unlock highlighting or unhighlighting nodes - */ - Highlighter.prototype.unlock = function () { - this.locked = false; - }; - - return Highlighter; - }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); - -/***/ }, -/* 5 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(3)], __WEBPACK_AMD_DEFINE_RESULT__ = function (util) { @@ -2182,6 +2088,7 @@ return /******/ (function(modules) { // webpackBootstrap /** * Undo the last action + * @returns applied history entry see {@link #add} */ History.prototype.undo = function () { if (this.canUndo()) { @@ -2203,10 +2110,12 @@ return /******/ (function(modules) { // webpackBootstrap // fire onchange event this.onChange(); } + return obj || null; }; /** * Redo the last action + * @returns applied history entry see {@link #add} */ History.prototype.redo = function () { if (this.canRedo()) { @@ -2229,12 +2138,105 @@ return /******/ (function(modules) { // webpackBootstrap // fire onchange event this.onChange(); } + return obj || null; }; return History; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_RESULT__;!(__WEBPACK_AMD_DEFINE_RESULT__ = function () { + + /** + * The highlighter can highlight/unhighlight a node, and + * animate the visibility of a context menu. + * @constructor Highlighter + */ + function Highlighter () { + this.locked = false; + } + + /** + * Hightlight given node and its childs + * @param {Node} node + */ + Highlighter.prototype.highlight = function (node) { + if (this.locked) { + return; + } + + if (this.node != node) { + // unhighlight current node + if (this.node) { + this.node.setHighlight(false); + } + + // highlight new node + this.node = node; + this.node.setHighlight(true); + } + + // cancel any current timeout + this._cancelUnhighlight(); + }; + + /** + * Unhighlight currently highlighted node. + * Will be done after a delay + */ + Highlighter.prototype.unhighlight = function () { + if (this.locked) { + return; + } + + var me = this; + if (this.node) { + this._cancelUnhighlight(); + + // do the unhighlighting after a small delay, to prevent re-highlighting + // the same node when moving from the drag-icon to the contextmenu-icon + // or vice versa. + this.unhighlightTimer = setTimeout(function () { + me.node.setHighlight(false); + me.node = undefined; + me.unhighlightTimer = undefined; + }, 0); + } + }; + + /** + * Cancel an unhighlight action (if before the timeout of the unhighlight action) + * @private + */ + Highlighter.prototype._cancelUnhighlight = function () { + if (this.unhighlightTimer) { + clearTimeout(this.unhighlightTimer); + this.unhighlightTimer = undefined; + } + }; + + /** + * Lock highlighting or unhighlighting nodes. + * methods highlight and unhighlight do not work while locked. + */ + Highlighter.prototype.lock = function () { + this.locked = true; + }; + + /** + * Unlock highlighting or unhighlighting nodes + */ + Highlighter.prototype.unlock = function () { + this.locked = false; + }; + + return Highlighter; + }.call(exports, __webpack_require__, exports, module), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); + /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { diff --git a/jsoneditor.map b/jsoneditor.map index c0e95fc2c..f91e38f73 100644 --- a/jsoneditor.map +++ b/jsoneditor.map @@ -1 +1 @@ -{"version":3,"file":"jsoneditor.map","sources":["./jsoneditor.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","treemode","textmode","util","JSONEditor","container","options","json","Error","ieVersion","getInternetExplorerVersion","arguments","length","_create","modes","prototype","mode","setMode","_delete","set","get","setText","jsonText","parse","getText","JSON","stringify","setName","name","getName","data","extend","config","asText","clear","mixin","create","load","err","_onError","onError","log","error","registerMode","i","prop","isArray","reserved","apply","undefined","Highlighter","History","SearchBox","Node","modeswitcher","dom","highlighter","selection","_setOptions","history","_createFrame","_createTable","frame","parentNode","removeChild","search","hasOwnProperty","focusNode","domFocus","Function","content","table","params","field","value","node","_setRoot","recurse","expand","appendChild","blur","getValue","updateField","collapse","tbody","getDom","text","results","expandAll","collapseAll","_onAction","action","add","change","startAutoScroll","mouseY","me","top","getAbsoluteTop","height","clientHeight","bottom","margin","interval","autoScrollStep","scrollTop","scrollHeight","autoScrollTimer","setInterval","stopAutoScroll","clearTimeout","setSelection","range","setSelectionOffset","focus","getSelection","getSelectionOffset","scrollTo","callback","editor","animateTimeout","animateCallback","finalScrollTop","Math","min","max","animate","diff","abs","setTimeout","onEvent","event","_onEvent","document","createElement","className","onclick","target","nodeName","preventDefault","oninput","onchange","onkeydown","onkeyup","oncut","onpaste","onmousedown","onmouseup","onmouseover","onmouseout","addEventListener","onfocusin","onfocusout","menu","title","undo","_onUndo","redo","_onRedo","onChange","disabled","canUndo","canRedo","modeBox","searchBox","type","_onKeyDown","getNodeFromTarget","keynum","which","keyCode","ctrlKey","shiftKey","handled","selectContentEditable","select","previous","next","stopPropagation","contentOuter","col","colgroupContent","width","indentation","Number","ace","textarea","clientWidth","buttonFormat","format","buttonCompact","compact","editorDom","style","edit","setTheme","setShowPrintMargin","setFontSize","getSession","setTabSize","setUseSoftTabs","setUseWrapMode","poweredBy","createTextNode","href","window","open","on","spellcheck","resize","force","setValue","jsonString","parseJS","err2","validate","jsString","chars","inString","charAt","isEscaped","push","join","replace","$0","$1","$2","$3","jsonlint","a","b","console","object","String","Boolean","RegExp","isUrlRegex","isUrl","test","obj","Object","toString","getAbsoluteLeft","elem","rect","getBoundingClientRect","left","pageXOffset","scrollLeft","pageYOffset","addClassName","classes","split","indexOf","removeClassName","index","splice","stripFormatting","divElement","childs","childNodes","iMax","child","removeAttribute","attributes","j","attribute","specified","setEndOfContentEditable","contentEditableElement","createRange","selectNodeContents","removeAllRanges","addRange","sel","getRangeAt","rangeCount","startContainer","endContainer","startOffset","endOffset","setStart","firstChild","setEnd","getInnerText","element","buffer","first","flush","nodeValue","hasChildNodes","innerText","prevChild","prevName","_ieVersion","rv","navigator","appName","ua","userAgent","re","exec","parseFloat","isFirefox","listener","useCapture","attachEvent","f","removeEventListener","detachEvent","locked","highlight","setHighlight","_cancelUnhighlight","unhighlight","unhighlightTimer","lock","unlock","actions","editField","oldValue","newValue","editValue","updateValue","appendNode","parent","insertBeforeNode","insertBefore","beforeNode","insertAfterNode","insertAfter","afterNode","removeNode","append","duplicateNode","clone","changeType","oldType","newType","moveNode","startParent","moveTo","startIndex","endParent","endIndex","sort","hideChilds","oldSort","oldChilds","showChilds","newSort","newChilds","timestamp","Date","oldSelection","newSelection","timeout","delay","lastText","tr","td","divInput","input","tableInput","tbodySearch","refreshSearch","_onDelayedSearch","_onSearch","_onKeyUp","searchNext","searchPrevious","resultIndex","_setActiveResult","activeResult","prevNode","prevElem","searchFieldActive","searchValueActive","updateDom","_clearDelay","forceSearch","resultCount","innerHTML","ContextMenu","appendNodeFactory","expanded","setField","fieldEditable","_updateEditability","editable","path","unshift","setParent","getField","_getDomField","childValue","_getType","childField","arr","forEach","_getDomValue","getLevel","fieldInnerText","valueInnerText","cloneChilds","childClone","getAppend","nextTr","nextSibling","hide","_hasChilds","newTr","appendTr","updateIndexes","moveBefore","trTemp","AppendNode","currentIndex","toLowerCase","searchField","searchValue","_updateDomField","childResults","concat","_updateDomValue","offsetTop","focusElement","elementName","drag","editableDiv","_duplicate","containsNode","_move","clearDom","removedNode","_remove","lastTr","_stringCast","silent","_unescapeHTML","str","domValue","v","t","color","isEmpty","count","domField","oldField","tdDrag","domDrag","tdMenu","tdField","tree","_createDomTree","_onDragStart","mousemove","_onDrag","mouseup","_onDragEnd","oldCursor","body","cursor","mouseX","pageX","level","trThis","trPrev","trNext","trFirst","trLast","trRoot","nodePrev","nodeNext","topThis","topPrev","topFirst","heightThis","bottomNext","heightNext","pageY","moved","offsetHeight","previousSibling","diffX","diffLevel","round","levelNext","_isChildOf","n","_createDomField","domTree","marginLeft","contentEditable","_escapeHTML","_updateDomIndexes","_createDomValue","_createDomExpandButton","borderCollapse","tdExpand","tdSeparator","tdValue","srcElement","expandable","showContextMenu","_onExpand","offsetX","onKeyDown","nextNode","nextDom","nextDom2","altKey","_onDuplicate","_onRemove","_onInsertBefore","_onInsertAfter","lastNode","_lastNode","_getElementName","firstNode","_firstNode","prevElement","_previousElement","appendDom","nextNode2","_previousNode","nextElement","_nextElement","prevDom","isVisible","_nextNode","newNode","_onAppend","_onChangeType","_onSort","direction","order","firstDom","lastDom","lastChild","TYPE_TITLES","auto","array","string","anchor","onClose","titles","items","submenu","click","submenuTitle","close","show","Array","lower","num","numFloat","isNaN","htmlEscaped","substring","escapedText","_escapeJSON","escaped","createModeSwitcher","current","switchMode","availableModes","code","form","view","item","currentMode","currentTitle","box","createMenuItems","list","domItems","separator","li","domItem","button","divIcon","buttonSubmenu","buttonExpand","divExpand","_onExpandItem","domSubItems","subItems","ul","eventListeners","visibleSubmenu","focusButton","overflow","maxHeight","_getVisibleButtons","buttons","expandedItem","subItem","visibleMenu","windowHeight","innerHeight","windowScroll","windowBottom","anchorHeight","menuHeight","mousedown","mousewheel","keydown","fn","alreadyVisible","padding","display","targetIndex","prevButton","nextButton","e","trAppend","tdAppend","domText","paddingLeft"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BA,SAA2CA,EAAMC,GAC1B,gBAAZC,UAA0C,gBAAXC,QACxCA,OAAOD,QAAUD,IACQ,kBAAXG,SAAyBA,OAAOC,IAC9CD,OAAOH,GACmB,gBAAZC,SACdA,QAAoB,WAAID,IAExBD,EAAiB,WAAIC,KACpBK,KAAM,WACT,MAAgB,UAAUC,GAKhB,QAASC,GAAoBC,GAG5B,GAAGC,EAAiBD,GACnB,MAAOC,GAAiBD,GAAUP,OAGnC,IAAIC,GAASO,EAAiBD,IAC7BP,WACAS,GAAIF,EACJG,QAAQ,EAUT,OANAL,GAAQE,GAAUI,KAAKV,EAAOD,QAASC,EAAQA,EAAOD,QAASM,GAG/DL,EAAOS,QAAS,EAGTT,EAAOD,QAvBf,GAAIQ,KAqCJ,OATAF,GAAoBM,EAAIP,EAGxBC,EAAoBO,EAAIL,EAGxBF,EAAoBQ,EAAI,GAGjBR,EAAoB,KAK/B,SAASL,EAAQD,EAASM,GAE/B,GAAIS,GAA8BC,CAAgCD,IAAgCT,EAAoB,GAAIA,EAAoB,GAAIA,EAAoB,IAAKU,EAAgC,SAAUC,EAAUC,EAAUC,GA4BvO,QAASC,GAAYC,EAAWC,EAASC,GACvC,KAAMnB,eAAgBgB,IACpB,KAAM,IAAII,OAAM,+CAIlB,IAAIC,GAAYN,EAAKO,4BACrB,IAAiB,IAAbD,GAA+B,EAAZA,EACrB,KAAM,IAAID,OAAM,iGAIdG,WAAUC,QACZxB,KAAKyB,QAAQR,EAAWC,EAASC,GA0NrC,MAvMAH,GAAWU,SASXV,EAAWW,UAAUF,QAAU,SAAUR,EAAWC,EAAS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KAAQ,OACRiD,UAAa,YACbmB,MAASwY,EAAOL,KAChBQ,MAAS,WACP1d,EAAKyc,UAAU,GAAI,GAAI,WAIzB9b,KAAQ,QACRiD,UAAa,aACbmB,MAASwY,EAAOJ,MAChBO,MAAS,WACP1d,EAAKyc,UAAU,UAIjB9b,KAAQ,SACRiD,UAAa,cACbmB,MAASwY,EAAO1T,OAChB6T,MAAS,WACP1d,EAAKyc,UAAU,UAIjB9b,KAAQ,SACRiD,UAAa,cACbmB,MAASwY,EAAOH,OAChBM,MAAS,WACP1d,EAAKyc,UAAU,GAAI,GAAI,eAO7B3X,EAAO,GAAIsO,GAAYoK,GAAQI,MAAON,GAC1CxY,GAAK+Y,KAAKR,IAOZhI,EAAWjZ,UAAUmH,QAAU,SAAUC,GACvC,GAAIkC,GAAOlC,EAAMkC,KACb5B,EAASN,EAAMM,QAAUN,EAAMmX,WAC/B/b,EAAMnE,KAAKmE,IAGXkG,EAAOlG,EAAIkG,IAWf,IAVIhB,GAAUgB,IACA,aAARY,EACFjL,KAAKmI,OAAO/D,YAAY+P,UAAUnU,KAAKiV,QAExB,YAARhK,GACPjL,KAAKmI,OAAO/D,YAAYkQ,eAKhB,SAARrJ,GAAmB5B,GAAUlF,EAAIkG,KAAM,CACzC,GAAIjG,GAAcpE,KAAKmI,OAAO/D,WAC9BA,GAAY+P,UAAUnU,KAAKiV,QAC3B7Q,EAAYoQ,OACZzT,EAAKuP,aAAanM,EAAIkG,KAAM,YAC5BrK,KAAKogB,gBAAgBjc,EAAIkG,KAAM,WAC7BtJ,EAAK2P,gBAAgBvM,EAAIkG,KAAM,YAC/BjG,EAAYqQ,SACZrQ,EAAYkQ,gBAIJ,WAARrJ,GACFjL,KAAKugB,UAAUxX,IAIZ6R,EAIT,MAAOhC,IACPhV,MAAMhE,EAASe,KAAiEkD,SAAlCjD,IAAgDf,EAAOD,QAAUgB"} \ No newline at end of file +{"version":3,"file":"jsoneditor.map","sources":["./jsoneditor.js"],"names":["root","factory","exports","module","define","amd","this","modules","__webpack_require__","moduleId","installedModules","id","loaded","call","m","c","p","__WEBPACK_AMD_DEFINE_ARRAY__","__WEBPACK_AMD_DEFINE_RESULT__","treemode","textmode","util","JSONEditor","container","options","json","Error","ieVersion","getInternetExplorerVersion","arguments","length","_create","modes","prototype","mode","setMode","_delete","set","get","setText","jsonText","parse","getText","JSON","stringify","setName","name","getName","data","extend","config","asText","clear","mixin","create","load","err","_onError","onError","log","error","registerMode","i","prop","isArray","reserved","apply","undefined","Highlighter","History","SearchBox","Node","modeswitcher","dom","highlighter","selection","_setOptions","history","_createFrame","_createTable","frame","parentNode","removeChild","search","hasOwnProperty","focusNode","domFocus","Function","content","table","params","field","value","node","_setRoot","recurse","expand","appendChild","blur","getValue","updateField","collapse","tbody","getDom","text","results","expandAll","collapseAll","_onAction","action","add","change","startAutoScroll","mouseY","me","top","getAbsoluteTop","height","clientHeight","bottom","margin","interval","autoScrollStep","scrollTop","scrollHeight","autoScrollTimer","setInterval","stopAutoScroll","clearTimeout","setSelection","range","setSelectionOffset","focus","getSelection","getSelectionOffset","scrollTo","callback","editor","animateTimeout","animateCallback","finalScrollTop","Math","min","max","animate","diff","abs","setTimeout","onEvent","event","_onEvent","document","createElement","className","onclick","target","nodeName","preventDefault","oninput","onchange","onkeydown","onkeyup","oncut","onpaste","onmousedown","onmouseup","onmouseover","onmouseout","addEventListener","onfocusin","onfocusout","menu","title","undo","_onUndo","redo","_onRedo","onChange","disabled","canUndo","canRedo","modeBox","searchBox","historyEntry","type","_onKeyDown","getNodeFromTarget","keynum","which","keyCode","ctrlKey","shiftKey","handled","selectContentEditable","select","previous","next","stopPropagation","contentOuter","col","colgroupContent","width","indentation","Number","ace","textarea","clientWidth","buttonFormat","format","buttonCompact","compact","editorDom","style","edit","setTheme","setShowPrintMargin","setFontSize","getSession","setTabSize","setUseSoftTabs","setUseWrapMode","poweredBy","createTextNode","href","window","open","on","spellcheck","resize","force","setValue","jsonString","parseJS","err2","validate","jsString","chars","inString","charAt","isEscaped","push","join","replace","$0","$1","$2","$3","jsonlint","a","b","console","object","String","Boolean","RegExp","isUrlRegex","isUrl","test","obj","Object","toString","getAbsoluteLeft","elem","rect","getBoundingClientRect","left","pageXOffset","scrollLeft","pageYOffset","addClassName","classes","split","indexOf","removeClassName","index","splice","stripFormatting","divElement","childs","childNodes","iMax","child","removeAttribute","attributes","j","attribute","specified","setEndOfContentEditable","contentEditableElement","createRange","selectNodeContents","removeAllRanges","addRange","sel","getRangeAt","rangeCount","startContainer","endContainer","startOffset","endOffset","setStart","firstChild","setEnd","getInnerText","element","buffer","first","flush","nodeValue","hasChildNodes","innerText","prevChild","prevName","_ieVersion","rv","navigator","appName","ua","userAgent","re","exec","parseFloat","isFirefox","listener","useCapture","attachEvent","f","removeEventListener","detachEvent","actions","editField","oldValue","newValue","editValue","updateValue","appendNode","parent","insertBeforeNode","insertBefore","beforeNode","insertAfterNode","insertAfter","afterNode","removeNode","append","duplicateNode","clone","changeType","oldType","newType","moveNode","startParent","moveTo","startIndex","endParent","endIndex","sort","hideChilds","oldSort","oldChilds","showChilds","newSort","newChilds","timestamp","Date","oldSelection","newSelection","locked","highlight","setHighlight","_cancelUnhighlight","unhighlight","unhighlightTimer","lock","unlock","timeout","delay","lastText","tr","td","divInput","input","tableInput","tbodySearch","refreshSearch","_onDelayedSearch","_onSearch","_onKeyUp","searchNext","searchPrevious","resultIndex","_setActiveResult","activeResult","prevNode","prevElem","searchFieldActive","searchValueActive","updateDom","_clearDelay","forceSearch","resultCount","innerHTML","ContextMenu","appendNodeFactory","expanded","setField","fieldEditable","_updateEditability","editable","path","unshift","setParent","getField","_getDomField","childValue","_getType","childField","arr","forEach","_getDomValue","getLevel","fieldInnerText","valueInnerText","cloneChilds","childClone","getAppend","nextTr","nextSibling","hide","_hasChilds","newTr","appendTr","updateIndexes","moveBefore","trTemp","AppendNode","currentIndex","toLowerCase","searchField","searchValue","_updateDomField","childResults","concat","_updateDomValue","offsetTop","focusElement","elementName","drag","editableDiv","_duplicate","containsNode","_move","clearDom","removedNode","_remove","lastTr","_stringCast","silent","_unescapeHTML","str","domValue","v","t","color","isEmpty","count","domField","oldField","tdDrag","domDrag","tdMenu","tdField","tree","_createDomTree","_onDragStart","mousemove","_onDrag","mouseup","_onDragEnd","oldCursor","body","cursor","mouseX","pageX","level","trThis","trPrev","trNext","trFirst","trLast","trRoot","nodePrev","nodeNext","topThis","topPrev","topFirst","heightThis","bottomNext","heightNext","pageY","moved","offsetHeight","previousSibling","diffX","diffLevel","round","levelNext","_isChildOf","n","_createDomField","domTree","marginLeft","contentEditable","_escapeHTML","_updateDomIndexes","_createDomValue","_createDomExpandButton","borderCollapse","tdExpand","tdSeparator","tdValue","srcElement","expandable","showContextMenu","_onExpand","offsetX","onKeyDown","nextNode","nextDom","nextDom2","altKey","_onDuplicate","_onRemove","_onInsertBefore","_onInsertAfter","lastNode","_lastNode","_getElementName","firstNode","_firstNode","prevElement","_previousElement","appendDom","nextNode2","_previousNode","nextElement","_nextElement","prevDom","isVisible","_nextNode","newNode","_onAppend","_onChangeType","_onSort","direction","order","firstDom","lastDom","lastChild","TYPE_TITLES","auto","array","string","anchor","onClose","titles","items","submenu","click","submenuTitle","close","show","Array","lower","num","numFloat","isNaN","htmlEscaped","substring","escapedText","_escapeJSON","escaped","createModeSwitcher","current","switchMode","availableModes","code","form","view","item","currentMode","currentTitle","box","createMenuItems","list","domItems","separator","li","domItem","button","divIcon","buttonSubmenu","buttonExpand","divExpand","_onExpandItem","domSubItems","subItems","ul","eventListeners","visibleSubmenu","focusButton","overflow","maxHeight","_getVisibleButtons","buttons","expandedItem","subItem","visibleMenu","windowHeight","innerHeight","windowScroll","windowBottom","anchorHeight","menuHeight","mousedown","mousewheel","keydown","fn","alreadyVisible","padding","display","targetIndex","prevButton","nextButton","e","trAppend","tdAppend","domText","paddingLeft"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BA,SAA2CA,EAAMC,GAC1B,gBAAZC,UAA0C,gBAAXC,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AAS,WACP3d,EAAK0c,UAAU,UAIjB/b,KAAQ,SACRiD,UAAa,cACbmB,MAASyY,EAAOH,OAChBM,MAAS,WACP3d,EAAK0c,UAAU,GAAI,GAAI,eAO7B5X,EAAO,GAAIuO,GAAYoK,GAAQI,MAAON,GAC1CzY,GAAKgZ,KAAKR,IAOZhI,EAAWlZ,UAAUmH,QAAU,SAAUC,GACvC,GAAImC,GAAOnC,EAAMmC,KACb7B,EAASN,EAAMM,QAAUN,EAAMoX,WAC/Bhc,EAAMnE,KAAKmE,IAGXkG,EAAOlG,EAAIkG,IAWf,IAVIhB,GAAUgB,IACA,aAARa,EACFlL,KAAKmI,OAAO/D,YAAYsS,UAAU1W,KAAK0U,QAExB,YAARxJ,GACPlL,KAAKmI,OAAO/D,YAAYyS,eAKhB,SAAR3L,GAAmB7B,GAAUlF,EAAIkG,KAAM,CACzC,GAAIjG,GAAcpE,KAAKmI,OAAO/D,WAC9BA,GAAYsS,UAAU1W,KAAK0U,QAC3BtQ,EAAY2S,OACZhW,EAAKwP,aAAapM,EAAIkG,KAAM,YAC5BrK,KAAKqgB,gBAAgBlc,EAAIkG,KAAM,WAC7BtJ,EAAK4P,gBAAgBxM,EAAIkG,KAAM,YAC/BjG,EAAY4S,SACZ5S,EAAYyS,gBAIJ,WAAR3L,GACFlL,KAAKwgB,UAAUzX,IAIZ8R,EAIT,MAAOhC,IACPjV,MAAMhE,EAASe,KAAiEkD,SAAlCjD,IAAgDf,EAAOD,QAAUgB"} \ No newline at end of file diff --git a/jsoneditor.min.js b/jsoneditor.min.js index c9f572ab8..eba26031e 100644 --- a/jsoneditor.min.js +++ b/jsoneditor.min.js @@ -24,8 +24,8 @@ * * @author Jos de Jong, * @version 3.1.2 - * @date 2014-09-03 + * @date 2014-10-14 */ -!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()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){var n,o;n=[i(1),i(2),i(3)],o=function(e,t,i){function n(e,t,o){if(!(this instanceof n))throw new Error('JSONEditor constructor called without "new".');var s=i.getInternetExplorerVersion();if(-1!=s&&9>s)throw new Error("Unsupported browser, IE9 or newer required. Please install the newest version of your browser.");arguments.length&&this._create(e,t,o)}return n.modes={},n.prototype._create=function(e,t,i){this.container=e,this.options=t||{},this.json=i||{};var n=this.options.mode||"tree";this.setMode(n)},n.prototype._delete=function(){},n.prototype.set=function(e){this.json=e},n.prototype.get=function(){return this.json},n.prototype.setText=function(e){this.json=i.parse(e)},n.prototype.getText=function(){return JSON.stringify(this.json)},n.prototype.setName=function(e){this.options||(this.options={}),this.options.name=e},n.prototype.getName=function(){return this.options&&this.options.name},n.prototype.setMode=function(e){var t,o,s=this.container,r=i.extend({},this.options);r.mode=e;var a=n.modes[e];if(!a)throw new Error('Unknown mode "'+r.mode+'"');try{var d="text"==a.data;if(o=this.getName(),t=this[d?"getText":"get"](),this._delete(),i.clear(this),i.extend(this,a.mixin),this.create(s,r),this.setName(o),this[d?"setText":"set"](t),"function"==typeof a.load)try{a.load.call(this)}catch(h){}}catch(h){this._onError(h)}},n.prototype._onError=function(e){if("function"==typeof this.onError&&(i.log("WARNING: JSONEditor.onError is deprecated. Use options.error instead."),this.onError(e)),!this.options||"function"!=typeof this.options.error)throw e;this.options.error(e)},n.registerMode=function(e){var t,o;if(i.isArray(e))for(t=0;te&&i.scrollTop>0?(n+a-e)/3:e>r-a&&o+i.scrollTop3?(i.scrollTop+=o/3,n.animateCallback=t,n.animateTimeout=setTimeout(a,50)):(t&&t(!0),i.scrollTop=r,delete n.animateTimeout,delete n.animateCallback)};a()}else t&&t(!1)},r._createFrame=function(){function e(e){t._onEvent(e)}this.frame=document.createElement("div"),this.frame.className="jsoneditor",this.container.appendChild(this.frame);var t=this;this.frame.onclick=function(t){var i=t.target;e(t),"BUTTON"==i.nodeName&&t.preventDefault()},this.frame.oninput=e,this.frame.onchange=e,this.frame.onkeydown=e,this.frame.onkeyup=e,this.frame.oncut=e,this.frame.onpaste=e,this.frame.onmousedown=e,this.frame.onmouseup=e,this.frame.onmouseover=e,this.frame.onmouseout=e,s.addEventListener(this.frame,"focus",e,!0),s.addEventListener(this.frame,"blur",e,!0),this.frame.onfocusin=e,this.frame.onfocusout=e,this.menu=document.createElement("div"),this.menu.className="menu",this.frame.appendChild(this.menu);var n=document.createElement("button");n.className="expand-all",n.title="Expand all fields",n.onclick=function(){t.expandAll()},this.menu.appendChild(n);var r=document.createElement("button");if(r.title="Collapse all fields",r.className="collapse-all",r.onclick=function(){t.collapseAll()},this.menu.appendChild(r),this.history){var a=document.createElement("button");a.className="undo separator",a.title="Undo last action (Ctrl+Z)",a.onclick=function(){t._onUndo()},this.menu.appendChild(a),this.dom.undo=a;var d=document.createElement("button");d.className="redo",d.title="Redo (Ctrl+Shift+Z)",d.onclick=function(){t._onRedo()},this.menu.appendChild(d),this.dom.redo=d,this.history.onChange=function(){a.disabled=!t.history.canUndo(),d.disabled=!t.history.canRedo()},this.history.onChange()}if(this.options&&this.options.modes&&this.options.modes.length){var h=o.create(this,this.options.modes,this.options.mode);this.menu.appendChild(h),this.dom.modeBox=h}this.options.search&&(this.searchBox=new i(this,this.menu))},r._onUndo=function(){this.history&&(this.history.undo(),this.options.change&&this.options.change())},r._onRedo=function(){this.history&&(this.history.redo(),this.options.change&&this.options.change())},r._onEvent=function(e){var t=e.target;"keydown"==e.type&&this._onKeyDown(e),"focus"==e.type&&(d=t);var i=n.getNodeFromTarget(t);i&&i.onEvent(e)},r._onKeyDown=function(e){var t=e.which||e.keyCode,i=e.ctrlKey,n=e.shiftKey,o=!1;if(9==t&&setTimeout(function(){s.selectContentEditable(d)},0),this.searchBox)if(i&&70==t)this.searchBox.dom.search.focus(),this.searchBox.dom.search.select(),o=!0;else if(114==t||i&&71==t){var r=!0;n?this.searchBox.previous(r):this.searchBox.next(r),o=!0}this.history&&(i&&!n&&90==t?(this._onUndo(),o=!0):i&&n&&90==t&&(this._onRedo(),o=!0)),o&&(e.preventDefault(),e.stopPropagation())},r._createTable=function(){var e=document.createElement("div");e.className="outer",this.contentOuter=e,this.content=document.createElement("div"),this.content.className="tree",e.appendChild(this.content),this.table=document.createElement("table"),this.table.className="tree",this.content.appendChild(this.table);var t;this.colgroupContent=document.createElement("colgroup"),"tree"===this.options.mode&&(t=document.createElement("col"),t.width="24px",this.colgroupContent.appendChild(t)),t=document.createElement("col"),t.width="24px",this.colgroupContent.appendChild(t),t=document.createElement("col"),this.colgroupContent.appendChild(t),this.table.appendChild(this.colgroupContent),this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.frame.appendChild(e)},[{mode:"tree",mixin:r,data:"json"},{mode:"view",mixin:r,data:"json"},{mode:"form",mixin:r,data:"json"}]}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(e,t,i){var n,o;n=[i(8),i(3)],o=function(e,t){var i={};return i.create=function(i,n){n=n||{},this.options=n,this.indentation=n.indentation?Number(n.indentation):2,this.mode="code"==n.mode?"code":"text","code"==this.mode&&"undefined"==typeof ace&&(this.mode="text",t.log("WARNING: Cannot load code editor, Ace library not loaded. Falling back to plain text editor"));var o=this;this.container=i,this.dom={},this.editor=void 0,this.textarea=void 0,this.width=i.clientWidth,this.height=i.clientHeight,this.frame=document.createElement("div"),this.frame.className="jsoneditor",this.frame.onclick=function(e){e.preventDefault()},this.menu=document.createElement("div"),this.menu.className="menu",this.frame.appendChild(this.menu);var s=document.createElement("button");s.className="format",s.title="Format JSON data, with proper indentation and line feeds",this.menu.appendChild(s),s.onclick=function(){try{o.format()}catch(e){o._onError(e)}};var r=document.createElement("button");if(r.className="compact",r.title="Compact JSON data, remove all whitespaces",this.menu.appendChild(r),r.onclick=function(){try{o.compact()}catch(e){o._onError(e)}},this.options&&this.options.modes&&this.options.modes.length){var a=e.create(this,this.options.modes,this.options.mode);this.menu.appendChild(a),this.dom.modeBox=a}if(this.content=document.createElement("div"),this.content.className="outer",this.frame.appendChild(this.content),this.container.appendChild(this.frame),"code"==this.mode){this.editorDom=document.createElement("div"),this.editorDom.style.height="100%",this.editorDom.style.width="100%",this.content.appendChild(this.editorDom);var d=ace.edit(this.editorDom);d.setTheme("ace/theme/jsoneditor"),d.setShowPrintMargin(!1),d.setFontSize(13),d.getSession().setMode("ace/mode/json"),d.getSession().setTabSize(2),d.getSession().setUseSoftTabs(!0),d.getSession().setUseWrapMode(!0),this.editor=d;var h=document.createElement("a");h.appendChild(document.createTextNode("powered by ace")),h.href="http://ace.ajax.org",h.target="_blank",h.className="poweredBy",h.onclick=function(){window.open(h.href,h.target)},this.menu.appendChild(h),n.change&&d.on("change",function(){n.change()})}else{var l=document.createElement("textarea");l.className="text",l.spellcheck=!1,this.content.appendChild(l),this.textarea=l,n.change&&(null===this.textarea.oninput?this.textarea.oninput=function(){n.change()}:this.textarea.onchange=function(){n.change()})}},i._delete=function(){this.frame&&this.container&&this.frame.parentNode==this.container&&this.container.removeChild(this.frame)},i._onError=function(e){if("function"==typeof this.onError&&(t.log("WARNING: JSONEditor.onError is deprecated. Use options.error instead."),this.onError(e)),!this.options||"function"!=typeof this.options.error)throw e;this.options.error(e)},i.compact=function(){var e=t.parse(this.getText());this.setText(JSON.stringify(e))},i.format=function(){var e=t.parse(this.getText());this.setText(JSON.stringify(e,null,this.indentation))},i.focus=function(){this.textarea&&this.textarea.focus(),this.editor&&this.editor.focus()},i.resize=function(){if(this.editor){var e=!1;this.editor.resize(e)}},i.set=function(e){this.setText(JSON.stringify(e,null,this.indentation))},i.get=function(){return t.parse(this.getText())},i.getText=function(){return this.textarea?this.textarea.value:this.editor?this.editor.getValue():""},i.setText=function(e){this.textarea&&(this.textarea.value=e),this.editor&&this.editor.setValue(e,-1)},[{mode:"text",mixin:i,data:"text",load:i.format},{mode:"code",mixin:i,data:"text",load:i.format}]}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(e,t,i){var n;n=function(){var e={};e.parse=function(t){try{return JSON.parse(t)}catch(i){try{return e.parseJS(t)}catch(n){throw e.validate(t),i}}},e.parseJS=function(e){for(var t=[],i=!1,n=0;nn;n++){var s=i[n];s.style&&s.removeAttribute("style");var r=s.attributes;if(r)for(var a=r.length-1;a>=0;a--){var d=r[a];1==d.specified&&s.removeAttribute(d.name)}e.stripFormatting(s)}},e.setEndOfContentEditable=function(e){var t,i;document.createRange&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),i=window.getSelection(),i.removeAllRanges(),i.addRange(t))},e.selectContentEditable=function(e){if(e&&"DIV"==e.nodeName){var t,i;window.getSelection&&document.createRange&&(i=document.createRange(),i.selectNodeContents(e),t=window.getSelection(),t.removeAllRanges(),t.addRange(i))}},e.getSelection=function(){if(window.getSelection){var e=window.getSelection();if(e.getRangeAt&&e.rangeCount)return e.getRangeAt(0)}return null},e.setSelection=function(e){if(e&&window.getSelection){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)}},e.getSelectionOffset=function(){var t=e.getSelection();return t&&"startOffset"in t&&"endOffset"in t&&t.startContainer&&t.startContainer==t.endContainer?{startOffset:t.startOffset,endOffset:t.endOffset,container:t.startContainer.parentNode}:null},e.setSelectionOffset=function(t){if(document.createRange&&window.getSelection){var i=window.getSelection();if(i){var n=document.createRange();n.setStart(t.container.firstChild,t.startOffset),n.setEnd(t.container.firstChild,t.endOffset),e.setSelection(n)}}},e.getInnerText=function(t,i){var n=void 0==i;if(n&&(i={text:"",flush:function(){var e=this.text;return this.text="",e},set:function(e){this.text=e}}),t.nodeValue)return i.flush()+t.nodeValue;if(t.hasChildNodes()){for(var o=t.childNodes,s="",r=0,a=o.length;a>r;r++){var d=o[r];if("DIV"==d.nodeName||"P"==d.nodeName){var h=o[r-1],l=h?h.nodeName:void 0;l&&"DIV"!=l&&"P"!=l&&"BR"!=l&&(s+="\n",i.flush()),s+=e.getInnerText(d,i),i.set("\n")}else"BR"==d.nodeName?(s+=i.flush(),i.set("\n")):s+=e.getInnerText(d,i)}return s}return"P"==t.nodeName&&-1!=e.getInternetExplorerVersion()?i.flush():""},e.getInternetExplorerVersion=function(){if(-1==i){var e=-1;if("Microsoft Internet Explorer"==navigator.appName){var t=navigator.userAgent,n=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!=n.exec(t)&&(e=parseFloat(RegExp.$1))}i=e}return i},e.isFirefox=function(){return-1!=navigator.userAgent.indexOf("Firefox")};var i=-1;return e.addEventListener=function(t,i,n,o){if(t.addEventListener)return void 0===o&&(o=!1),"mousewheel"===i&&e.isFirefox()&&(i="DOMMouseScroll"),t.addEventListener(i,n,o),n;if(t.attachEvent){var s=function(){return n.call(t,window.event)};return t.attachEvent("on"+i,s),s}},e.removeEventListener=function(t,i,n,o){t.removeEventListener?(void 0===o&&(o=!1),"mousewheel"===i&&e.isFirefox()&&(i="DOMMouseScroll"),t.removeEventListener(i,n,o)):t.detachEvent&&t.detachEvent("on"+i,n)},e}.call(t,i,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,i){var n;n=function(){function e(){this.locked=!1}return e.prototype.highlight=function(e){this.locked||(this.node!=e&&(this.node&&this.node.setHighlight(!1),this.node=e,this.node.setHighlight(!0)),this._cancelUnhighlight())},e.prototype.unhighlight=function(){if(!this.locked){var e=this;this.node&&(this._cancelUnhighlight(),this.unhighlightTimer=setTimeout(function(){e.node.setHighlight(!1),e.node=void 0,e.unhighlightTimer=void 0},0))}},e.prototype._cancelUnhighlight=function(){this.unhighlightTimer&&(clearTimeout(this.unhighlightTimer),this.unhighlightTimer=void 0)},e.prototype.lock=function(){this.locked=!0},e.prototype.unlock=function(){this.locked=!1},e}.call(t,i,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,i){var n,o;n=[i(3)],o=function(e){function t(e){this.editor=e,this.clear(),this.actions={editField:{undo:function(e){e.node.updateField(e.oldValue)},redo:function(e){e.node.updateField(e.newValue)}},editValue:{undo:function(e){e.node.updateValue(e.oldValue)},redo:function(e){e.node.updateValue(e.newValue)}},appendNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.appendChild(e.node)}},insertBeforeNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.insertBefore(e.node,e.beforeNode)}},insertAfterNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.insertAfter(e.node,e.afterNode)}},removeNode:{undo:function(e){var t=e.parent,i=t.childs[e.index]||t.append;t.insertBefore(e.node,i)},redo:function(e){e.parent.removeChild(e.node)}},duplicateNode:{undo:function(e){e.parent.removeChild(e.clone)},redo:function(e){e.parent.insertAfter(e.clone,e.node)}},changeType:{undo:function(e){e.node.changeType(e.oldType)},redo:function(e){e.node.changeType(e.newType)}},moveNode:{undo:function(e){e.startParent.moveTo(e.node,e.startIndex)},redo:function(e){e.endParent.moveTo(e.node,e.endIndex)}},sort:{undo:function(e){var t=e.node;t.hideChilds(),t.sort=e.oldSort,t.childs=e.oldChilds,t.showChilds()},redo:function(e){var t=e.node;t.hideChilds(),t.sort=e.newSort,t.childs=e.newChilds,t.showChilds()}}}}return t.prototype.onChange=function(){},t.prototype.add=function(e,t){this.index++,this.history[this.index]={action:e,params:t,timestamp:new Date},this.index=0},t.prototype.canRedo=function(){return this.indexthis.results.length-1&&(t=0),this._setActiveResult(t,e)}},e.prototype.previous=function(e){if(void 0!=this.results){var t=this.results.length-1,i=void 0!=this.resultIndex?this.resultIndex-1:t;0>i&&(i=t),this._setActiveResult(i,e)}},e.prototype._setActiveResult=function(e,t){if(this.activeResult){var i=this.activeResult.node,n=this.activeResult.elem;"field"==n?delete i.searchFieldActive:delete i.searchValueActive,i.updateDom()}if(!this.results||!this.results[e])return this.resultIndex=void 0,void(this.activeResult=void 0);this.resultIndex=e;var o=this.results[this.resultIndex].node,s=this.results[this.resultIndex].elem;"field"==s?o.searchFieldActive=!0:o.searchValueActive=!0,this.activeResult=this.results[this.resultIndex],o.updateDom(),o.scrollTo(function(){t&&o.focus(s)})},e.prototype._clearDelay=function(){void 0!=this.timeout&&(clearTimeout(this.timeout),delete this.timeout)},e.prototype._onDelayedSearch=function(){this._clearDelay();var e=this;this.timeout=setTimeout(function(t){e._onSearch(t)},this.delay)},e.prototype._onSearch=function(e,t){this._clearDelay();var i=this.dom.search.value,n=i.length>0?i:void 0;if(n!=this.lastText||t)if(this.lastText=n,this.results=this.editor.search(n),this._setActiveResult(void 0),void 0!=n){var o=this.results.length;switch(o){case 0:this.dom.results.innerHTML="no results";break;case 1:this.dom.results.innerHTML="1 result";break;default:this.dom.results.innerHTML=o+" results"}}else this.dom.results.innerHTML=""},e.prototype._onKeyDown=function(e){var t=e.which;27==t?(this.dom.search.value="",this._onSearch(e),e.preventDefault(),e.stopPropagation()):13==t&&(e.ctrlKey?this._onSearch(e,!0):e.shiftKey?this.previous():this.next(),e.preventDefault(),e.stopPropagation())},e.prototype._onKeyUp=function(e){var t=e.keyCode;27!=t&&13!=t&&this._onDelayedSearch(e)},e}.call(t,i,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,i){var n,o;n=[i(9),i(10),i(3)],o=function(e,t,i){function n(e,t){this.editor=e,this.dom={},this.expanded=!1,t&&t instanceof Object?(this.setField(t.field,t.fieldEditable),this.setValue(t.value,t.type)):(this.setField(""),this.setValue(null))}n.prototype._updateEditability=function(){if(this.editable={field:!0,value:!0},this.editor&&(this.editable.field="tree"===this.editor.options.mode,this.editable.value="view"!==this.editor.options.mode,"tree"===this.editor.options.mode&&"function"==typeof this.editor.options.editable)){var e=this.editor.options.editable({field:this.field,value:this.value,path:this.path()});"boolean"==typeof e?(this.editable.field=e,this.editable.value=e):("boolean"==typeof e.field&&(this.editable.field=e.field),"boolean"==typeof e.value&&(this.editable.value=e.value))}},n.prototype.path=function(){for(var e=this,t=[];e;){var i=e.field||e.index;void 0!==i&&t.unshift(i),e=e.parent}return t},n.prototype.setParent=function(e){this.parent=e},n.prototype.setField=function(e,t){this.field=e,this.fieldEditable=1==t},n.prototype.getField=function(){return void 0===this.field&&this._getDomField(),this.field},n.prototype.setValue=function(e,t){var i,o,s=this.childs;if(s)for(;s.length;)this.removeChild(s[0]);if(this.type=this._getType(e),t&&t!=this.type){if("string"!=t||"auto"!=this.type)throw new Error('Type mismatch: cannot cast value of type "'+this.type+' to the specified type "'+t+'"');this.type=t}if("array"==this.type){this.childs=[];for(var r=0,a=e.length;a>r;r++)i=e[r],void 0===i||i instanceof Function||(o=new n(this.editor,{value:i}),this.appendChild(o));this.value=""}else if("object"==this.type){this.childs=[];for(var d in e)e.hasOwnProperty(d)&&(i=e[d],void 0===i||i instanceof Function||(o=new n(this.editor,{field:d,value:i}),this.appendChild(o)));this.value=""}else this.childs=void 0,this.value=e},n.prototype.getValue=function(){if("array"==this.type){var e=[];return this.childs.forEach(function(t){e.push(t.getValue())}),e}if("object"==this.type){var t={};return this.childs.forEach(function(e){t[e.getField()]=e.getValue()}),t}return void 0===this.value&&this._getDomValue(),this.value},n.prototype.getLevel=function(){return this.parent?this.parent.getLevel()+1:0},n.prototype.clone=function(){var e=new n(this.editor);if(e.type=this.type,e.field=this.field,e.fieldInnerText=this.fieldInnerText,e.fieldEditable=this.fieldEditable,e.value=this.value,e.valueInnerText=this.valueInnerText,e.expanded=this.expanded,this.childs){var t=[];this.childs.forEach(function(i){var n=i.clone();n.setParent(e),t.push(n)}),e.childs=t}else e.childs=void 0;return e},n.prototype.expand=function(e){this.childs&&(this.expanded=!0,this.dom.expand&&(this.dom.expand.className="expanded"),this.showChilds(),0!=e&&this.childs.forEach(function(t){t.expand(e)}))},n.prototype.collapse=function(e){this.childs&&(this.hideChilds(),0!=e&&this.childs.forEach(function(t){t.collapse(e)}),this.dom.expand&&(this.dom.expand.className="collapsed"),this.expanded=!1)},n.prototype.showChilds=function(){var e=this.childs;if(e&&this.expanded){var t=this.dom.tr,i=t?t.parentNode:void 0;if(i){var n=this.getAppend(),o=t.nextSibling;o?i.insertBefore(n,o):i.appendChild(n),this.childs.forEach(function(e){i.insertBefore(e.getDom(),n),e.showChilds()})}}},n.prototype.hide=function(){var e=this.dom.tr,t=e?e.parentNode:void 0;t&&t.removeChild(e),this.hideChilds()},n.prototype.hideChilds=function(){var e=this.childs;if(e&&this.expanded){var t=this.getAppend();t.parentNode&&t.parentNode.removeChild(t),this.childs.forEach(function(e){e.hide()})}},n.prototype.appendChild=function(e){if(this._hasChilds()){if(e.setParent(this),e.fieldEditable="object"==this.type,"array"==this.type&&(e.index=this.childs.length),this.childs.push(e),this.expanded){var t=e.getDom(),i=this.getAppend(),n=i?i.parentNode:void 0;i&&n&&n.insertBefore(t,i),e.showChilds()}this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0})}},n.prototype.moveBefore=function(e,t){if(this._hasChilds()){var i=this.dom.tr?this.dom.tr.parentNode:void 0;if(i){var n=document.createElement("tr");n.style.height=i.clientHeight+"px",i.appendChild(n)}e.parent&&e.parent.removeChild(e),t instanceof o?this.appendChild(e):this.insertBefore(e,t),i&&i.removeChild(n)}},n.prototype.moveTo=function(e,t){if(e.parent==this){var i=this.childs.indexOf(e);t>i&&t++}var n=this.childs[t]||this.append;this.moveBefore(e,n)},n.prototype.insertBefore=function(e,t){if(this._hasChilds()){if(t==this.append)e.setParent(this),e.fieldEditable="object"==this.type,this.childs.push(e);else{var i=this.childs.indexOf(t);if(-1==i)throw new Error("Node not found");e.setParent(this),e.fieldEditable="object"==this.type,this.childs.splice(i,0,e)}if(this.expanded){var n=e.getDom(),o=t.getDom(),s=o?o.parentNode:void 0;o&&s&&s.insertBefore(n,o),e.showChilds()}this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0})}},n.prototype.insertAfter=function(e,t){if(this._hasChilds()){var i=this.childs.indexOf(t),n=this.childs[i+1];n?this.insertBefore(e,n):this.appendChild(e)}},n.prototype.search=function(e){var t,i=[],n=e?e.toLowerCase():void 0;if(delete this.searchField,delete this.searchValue,void 0!=this.field){var o=String(this.field).toLowerCase();t=o.indexOf(n),-1!=t&&(this.searchField=!0,i.push({node:this,elem:"field"})),this._updateDomField()}if(this._hasChilds()){if(this.childs){var s=[];this.childs.forEach(function(t){s=s.concat(t.search(e))}),i=i.concat(s)}if(void 0!=n){var r=!1;0==s.length?this.collapse(r):this.expand(r)}}else{if(void 0!=this.value){var a=String(this.value).toLowerCase();t=a.indexOf(n),-1!=t&&(this.searchValue=!0,i.push({node:this,elem:"value"}))}this._updateDomValue()}return i},n.prototype.scrollTo=function(e){if(!this.dom.tr||!this.dom.tr.parentNode)for(var t=this.parent,i=!1;t;)t.expand(i),t=t.parent;this.dom.tr&&this.dom.tr.parentNode&&this.editor.scrollTo(this.dom.tr.offsetTop,e)},n.focusElement=void 0,n.prototype.focus=function(e){if(n.focusElement=e,this.dom.tr&&this.dom.tr.parentNode){var t=this.dom;switch(e){case"drag":t.drag?t.drag.focus():t.menu.focus();break;case"menu":t.menu.focus();break;case"expand":this._hasChilds()?t.expand.focus():t.field&&this.fieldEditable?(t.field.focus(),i.selectContentEditable(t.field)):t.value&&!this._hasChilds()?(t.value.focus(),i.selectContentEditable(t.value)):t.menu.focus();break;case"field":t.field&&this.fieldEditable?(t.field.focus(),i.selectContentEditable(t.field)):t.value&&!this._hasChilds()?(t.value.focus(),i.selectContentEditable(t.value)):this._hasChilds()?t.expand.focus():t.menu.focus();break;case"value":default:t.value&&!this._hasChilds()?(t.value.focus(),i.selectContentEditable(t.value)):t.field&&this.fieldEditable?(t.field.focus(),i.selectContentEditable(t.field)):this._hasChilds()?t.expand.focus():t.menu.focus()}}},n.select=function(e){setTimeout(function(){i.selectContentEditable(e)},0)},n.prototype.blur=function(){this._getDomValue(!1),this._getDomField(!1)},n.prototype._duplicate=function(e){var t=e.clone();return this.insertAfter(t,e),t},n.prototype.containsNode=function(e){if(this==e)return!0; -var t=this.childs;if(t)for(var i=0,n=t.length;n>i;i++)if(t[i].containsNode(e))return!0;return!1},n.prototype._move=function(e,t){if(e!=t){if(e.containsNode(this))throw new Error("Cannot move a field into a child of itself");e.parent&&e.parent.removeChild(e);var i=e.clone();e.clearDom(),t?this.insertBefore(i,t):this.appendChild(i)}},n.prototype.removeChild=function(e){if(this.childs){var t=this.childs.indexOf(e);if(-1!=t){e.hide(),delete e.searchField,delete e.searchValue;var i=this.childs.splice(t,1)[0];return this.updateDom({updateIndexes:!0}),i}}return void 0},n.prototype._remove=function(e){this.removeChild(e)},n.prototype.changeType=function(e){var t=this.type;if(t!=e){if("string"!=e&&"auto"!=e||"string"!=t&&"auto"!=t){var i,n=this.dom.tr?this.dom.tr.parentNode:void 0;i=this.expanded?this.getAppend():this.getDom();var o=i&&i.parentNode?i.nextSibling:void 0;this.hide(),this.clearDom(),this.type=e,"object"==e?(this.childs||(this.childs=[]),this.childs.forEach(function(e){e.clearDom(),delete e.index,e.fieldEditable=!0,void 0==e.field&&(e.field="")}),("string"==t||"auto"==t)&&(this.expanded=!0)):"array"==e?(this.childs||(this.childs=[]),this.childs.forEach(function(e,t){e.clearDom(),e.fieldEditable=!1,e.index=t}),("string"==t||"auto"==t)&&(this.expanded=!0)):this.expanded=!1,n&&(o?n.insertBefore(this.getDom(),o):n.appendChild(this.getDom())),this.showChilds()}else this.type=e;("auto"==e||"string"==e)&&(this.value="string"==e?String(this.value):this._stringCast(String(this.value)),this.focus()),this.updateDom({updateIndexes:!0})}},n.prototype._getDomValue=function(e){if(this.dom.value&&"array"!=this.type&&"object"!=this.type&&(this.valueInnerText=i.getInnerText(this.dom.value)),void 0!=this.valueInnerText)try{var t;if("string"==this.type)t=this._unescapeHTML(this.valueInnerText);else{var n=this._unescapeHTML(this.valueInnerText);t=this._stringCast(n)}if(t!==this.value){var o=this.value;this.value=t,this.editor._onAction("editValue",{node:this,oldValue:o,newValue:t,oldSelection:this.editor.selection,newSelection:this.editor.getSelection()})}}catch(s){if(this.value=void 0,1!=e)throw s}},n.prototype._updateDomValue=function(){var e=this.dom.value;if(e){var t=this.value,n="auto"==this.type?i.type(t):this.type,o="string"==n&&i.isUrl(t),s="";s=o&&!this.editable.value?"":"string"==n?"green":"number"==n?"red":"boolean"==n?"darkorange":this._hasChilds()?"":null===t?"#004ED0":"black",e.style.color=s;var r=""==String(this.value)&&"array"!=this.type&&"object"!=this.type;if(r?i.addClassName(e,"empty"):i.removeClassName(e,"empty"),o?i.addClassName(e,"url"):i.removeClassName(e,"url"),"array"==n||"object"==n){var a=this.childs?this.childs.length:0;e.title=this.type+" containing "+a+" items"}else"string"==n&&i.isUrl(t)?this.editable.value&&(e.title="Ctrl+Click or Ctrl+Enter to open url in new window"):e.title="";this.searchValueActive?i.addClassName(e,"highlight-active"):i.removeClassName(e,"highlight-active"),this.searchValue?i.addClassName(e,"highlight"):i.removeClassName(e,"highlight"),i.stripFormatting(e)}},n.prototype._updateDomField=function(){var e=this.dom.field;if(e){var t=""==String(this.field)&&"array"!=this.parent.type;t?i.addClassName(e,"empty"):i.removeClassName(e,"empty"),this.searchFieldActive?i.addClassName(e,"highlight-active"):i.removeClassName(e,"highlight-active"),this.searchField?i.addClassName(e,"highlight"):i.removeClassName(e,"highlight"),i.stripFormatting(e)}},n.prototype._getDomField=function(e){if(this.dom.field&&this.fieldEditable&&(this.fieldInnerText=i.getInnerText(this.dom.field)),void 0!=this.fieldInnerText)try{var t=this._unescapeHTML(this.fieldInnerText);if(t!==this.field){var n=this.field;this.field=t,this.editor._onAction("editField",{node:this,oldValue:n,newValue:t,oldSelection:this.editor.selection,newSelection:this.editor.getSelection()})}}catch(o){if(this.field=void 0,1!=e)throw o}},n.prototype.clearDom=function(){this.dom={}},n.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;if(this._updateEditability(),e.tr=document.createElement("tr"),e.tr.node=this,"tree"===this.editor.options.mode){var t=document.createElement("td");if(this.editable.field&&this.parent){var i=document.createElement("button");e.drag=i,i.className="dragarea",i.title="Drag to move this field (Alt+Shift+Arrows)",t.appendChild(i)}e.tr.appendChild(t);var n=document.createElement("td"),o=document.createElement("button");e.menu=o,o.className="contextmenu",o.title="Click to open the actions menu (Ctrl+M)",n.appendChild(e.menu),e.tr.appendChild(n)}var s=document.createElement("td");return e.tr.appendChild(s),e.tree=this._createDomTree(),s.appendChild(e.tree),this.updateDom({updateIndexes:!0}),e.tr},n.prototype._onDragStart=function(e){var t=this;this.mousemove||(this.mousemove=i.addEventListener(document,"mousemove",function(e){t._onDrag(e)})),this.mouseup||(this.mouseup=i.addEventListener(document,"mouseup",function(e){t._onDragEnd(e)})),this.editor.highlighter.lock(),this.drag={oldCursor:document.body.style.cursor,startParent:this.parent,startIndex:this.parent.childs.indexOf(this),mouseX:e.pageX,level:this.getLevel()},document.body.style.cursor="move",e.preventDefault()},n.prototype._onDrag=function(e){var t,s,r,a,d,h,l,c,u,p,f,m,v,g,y=e.pageY,x=e.pageX,b=!1;if(t=this.dom.tr,u=i.getAbsoluteTop(t),m=t.offsetHeight,u>y){s=t;do s=s.previousSibling,l=n.getNodeFromTarget(s),p=s?i.getAbsoluteTop(s):0;while(s&&p>y);l&&!l.parent&&(l=void 0),l||(h=t.parentNode.firstChild,s=h?h.nextSibling:void 0,l=n.getNodeFromTarget(s),l==this&&(l=void 0)),l&&(s=l.dom.tr,p=s?i.getAbsoluteTop(s):0,y>p+m&&(l=void 0)),l&&(l.parent.moveBefore(this,l),b=!0)}else if(d=this.expanded&&this.append?this.append.getDom():this.dom.tr,a=d?d.nextSibling:void 0){f=i.getAbsoluteTop(a),r=a;do c=n.getNodeFromTarget(r),r&&(v=r.nextSibling?i.getAbsoluteTop(r.nextSibling):0,g=r?v-f:0,1==c.parent.childs.length&&c.parent.childs[0]==this&&(u+=23)),r=r.nextSibling;while(r&&y>u+g);if(c&&c.parent){var C=x-this.drag.mouseX,E=Math.round(C/24/2),N=this.drag.level+E,_=c.getLevel();for(s=c.dom.tr.previousSibling;N>_&&s;){if(l=n.getNodeFromTarget(s),l==this||l._isChildOf(this));else{if(!(l instanceof o))break;var w=l.parent.childs;if(!(w.length>1||1==w.length&&w[0]!=this))break;c=n.getNodeFromTarget(s),_=c.getLevel()}s=s.previousSibling}d.nextSibling!=c.dom.tr&&(c.parent.moveBefore(this,c),b=!0)}}b&&(this.drag.mouseX=x,this.drag.level=this.getLevel()),this.editor.startAutoScroll(y),e.preventDefault()},n.prototype._onDragEnd=function(e){var t={node:this,startParent:this.drag.startParent,startIndex:this.drag.startIndex,endParent:this.parent,endIndex:this.parent.childs.indexOf(this)};(t.startParent!=t.endParent||t.startIndex!=t.endIndex)&&this.editor._onAction("moveNode",t),document.body.style.cursor=this.drag.oldCursor,this.editor.highlighter.unlock(),delete this.drag,this.mousemove&&(i.removeEventListener(document,"mousemove",this.mousemove),delete this.mousemove),this.mouseup&&(i.removeEventListener(document,"mouseup",this.mouseup),delete this.mouseup),this.editor.stopAutoScroll(),e.preventDefault()},n.prototype._isChildOf=function(e){for(var t=this.parent;t;){if(t==e)return!0;t=t.parent}return!1},n.prototype._createDomField=function(){return document.createElement("div")},n.prototype.setHighlight=function(e){this.dom.tr&&(this.dom.tr.className=e?"highlight":"",this.append&&this.append.setHighlight(e),this.childs&&this.childs.forEach(function(t){t.setHighlight(e)}))},n.prototype.updateValue=function(e){this.value=e,this.updateDom()},n.prototype.updateField=function(e){this.field=e,this.updateDom()},n.prototype.updateDom=function(e){var t=this.dom.tree;t&&(t.style.marginLeft=24*this.getLevel()+"px");var i=this.dom.field;if(i){this.fieldEditable?(i.contentEditable=this.editable.field,i.spellcheck=!1,i.className="field"):i.className="readonly";var n;n=void 0!=this.index?this.index:void 0!=this.field?this.field:this._hasChilds()?this.type:"",i.innerHTML=this._escapeHTML(n)}var o=this.dom.value;if(o){var s=this.childs?this.childs.length:0;o.innerHTML="array"==this.type?"["+s+"]":"object"==this.type?"{"+s+"}":this._escapeHTML(this.value)}this._updateDomField(),this._updateDomValue(),e&&1==e.updateIndexes&&this._updateDomIndexes(),e&&1==e.recurse&&this.childs&&this.childs.forEach(function(t){t.updateDom(e)}),this.append&&this.append.updateDom()},n.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){void 0!=e.index&&(delete e.index,void 0==e.field&&(e.field=""))}))},n.prototype._createDomValue=function(){var e;return"array"==this.type?(e=document.createElement("div"),e.className="readonly",e.innerHTML="[...]"):"object"==this.type?(e=document.createElement("div"),e.className="readonly",e.innerHTML="{...}"):!this.editable.value&&i.isUrl(this.value)?(e=document.createElement("a"),e.className="value",e.href=this.value,e.target="_blank",e.innerHTML=this._escapeHTML(this.value)):(e=document.createElement("div"),e.contentEditable=this.editable.value,e.spellcheck=!1,e.className="value",e.innerHTML=this._escapeHTML(this.value)),e},n.prototype._createDomExpandButton=function(){var e=document.createElement("button");return this._hasChilds()?(e.className=this.expanded?"expanded":"collapsed",e.title="Click to expand/collapse this field (Ctrl+E). \nCtrl+Click to expand/collapse including all childs."):(e.className="invisible",e.title=""),e},n.prototype._createDomTree=function(){var e=this.dom,t=document.createElement("table"),i=document.createElement("tbody");t.style.borderCollapse="collapse",t.className="values",t.appendChild(i);var n=document.createElement("tr");i.appendChild(n);var o=document.createElement("td");o.className="tree",n.appendChild(o),e.expand=this._createDomExpandButton(),o.appendChild(e.expand),e.tdExpand=o;var s=document.createElement("td");s.className="tree",n.appendChild(s),e.field=this._createDomField(),s.appendChild(e.field),e.tdField=s;var r=document.createElement("td");r.className="tree",n.appendChild(r),"object"!=this.type&&"array"!=this.type&&(r.appendChild(document.createTextNode(":")),r.className="separator"),e.tdSeparator=r;var a=document.createElement("td");return a.className="tree",n.appendChild(a),e.value=this._createDomValue(),a.appendChild(e.value),e.tdValue=a,t},n.prototype.onEvent=function(e){var t,n=e.type,o=e.target||e.srcElement,s=this.dom,r=this,a=this._hasChilds();if((o==s.drag||o==s.menu)&&("mouseover"==n?this.editor.highlighter.highlight(this):"mouseout"==n&&this.editor.highlighter.unhighlight()),"mousedown"==n&&o==s.drag&&this._onDragStart(e),"click"==n&&o==s.menu){var d=r.editor.highlighter;d.highlight(r),d.lock(),i.addClassName(s.menu,"selected"),this.showContextMenu(s.menu,function(){i.removeClassName(s.menu,"selected"),d.unlock(),d.unhighlight()})}if("click"==n&&o==s.expand&&a){var h=e.ctrlKey;this._onExpand(h)}var l=s.value;if(o==l)switch(n){case"focus":t=this;break;case"blur":case"change":this._getDomValue(!0),this._updateDomValue(),this.value&&(l.innerHTML=this._escapeHTML(this.value));break;case"input":this._getDomValue(!0),this._updateDomValue();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getSelection();break;case"click":(e.ctrlKey||!this.editable.value)&&i.isUrl(this.value)&&window.open(this.value,"_blank");break;case"keyup":this._getDomValue(!0),this._updateDomValue();break;case"cut":case"paste":setTimeout(function(){r._getDomValue(!0),r._updateDomValue()},1)}var c=s.field;if(o==c)switch(n){case"focus":t=this;break;case"blur":case"change":this._getDomField(!0),this._updateDomField(),this.field&&(c.innerHTML=this._escapeHTML(this.field));break;case"input":this._getDomField(!0),this._updateDomField();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getSelection();break;case"keyup":this._getDomField(!0),this._updateDomField();break;case"cut":case"paste":setTimeout(function(){r._getDomField(!0),r._updateDomField()},1)}var u=s.tree;if(o==u.parentNode)switch(n){case"click":var p=void 0!=e.offsetX?e.offsetX<24*(this.getLevel()+1):e.pageXn[i]?t:e[i]/g,">").replace(/ /g,"  ").replace(/^ /," ").replace(/ $/," "),i=JSON.stringify(t);return i.substring(1,i.length-1)},n.prototype._unescapeHTML=function(e){var t='"'+this._escapeJSON(e)+'"',n=i.parse(t);return n.replace(/</g,"<").replace(/>/g,">").replace(/ |\u00A0/g," ")},n.prototype._escapeJSON=function(e){for(var t="",i=0,n=e.length;n>i;){var o=e.charAt(i);"\n"==o?t+="\\n":"\\"==o?(t+=o,i++,o=e.charAt(i),-1=='"\\/bfnrtu'.indexOf(o)&&(t+="\\"),t+=o):t+='"'==o?'\\"':o,i++}return t};var o=t(n);return n}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(e,t,i){var n,o;n=[i(9)],o=function(e){function t(t,i,n){function o(e){t.setMode(e);var i=t.dom&&t.dom.modeBox;i&&i.focus()}for(var s={code:{text:"Code",title:"Switch to code highlighter",click:function(){o("code")}},form:{text:"Form",title:"Switch to form editor",click:function(){o("form")}},text:{text:"Text",title:"Switch to plain text editor",click:function(){o("text")}},tree:{text:"Tree",title:"Switch to tree editor",click:function(){o("tree")}},view:{text:"View",title:"Switch to tree view",click:function(){o("view")}}},r=[],a=0;a',a.appendChild(c),o.submenuTitle&&(c.title=o.submenuTitle),l=c}else{var u=document.createElement("div");u.className="expand",d.appendChild(u),l=d}l.onclick=function(){n._onExpandItem(r),l.focus()};var p=[];r.subItems=p;var f=document.createElement("ul");r.ul=f,f.className="menu",f.style.height="0",a.appendChild(f),i(f,p,o.submenu)}else d.innerHTML='
'+o.text;t.push(r)}})}this.dom={};var n=this,o=this.dom;this.anchor=void 0,this.items=e,this.eventListeners={},this.selection=void 0,this.visibleSubmenu=void 0,this.onClose=t?t.close:void 0;var s=document.createElement("div");s.className="jsoneditor-contextmenu",o.menu=s;var r=document.createElement("ul");r.className="menu",s.appendChild(r),o.list=r,o.items=[];var a=document.createElement("button");o.focusButton=a;var d=document.createElement("li");d.style.overflow="hidden",d.style.height="0",d.appendChild(a),r.appendChild(d),i(r,this.dom.items,e),this.maxHeight=0,e.forEach(function(t){var i=24*(e.length+(t.submenu?t.submenu.length:0));n.maxHeight=Math.max(n.maxHeight,i)})}return t.prototype._getVisibleButtons=function(){var e=[],t=this;return this.dom.items.forEach(function(i){e.push(i.button),i.buttonExpand&&e.push(i.buttonExpand),i.subItems&&i==t.expandedItem&&i.subItems.forEach(function(t){e.push(t.button),t.buttonExpand&&e.push(t.buttonExpand)})}),e},t.visibleMenu=void 0,t.prototype.show=function(i){this.hide();var n=window.innerHeight,o=window.pageYOffset||document.scrollTop||0,s=n+o,r=i.offsetHeight,a=this.maxHeight,d=e.getAbsoluteLeft(i),h=e.getAbsoluteTop(i);s>h+r+a?(this.dom.menu.style.left=d+"px",this.dom.menu.style.top=h+r+"px",this.dom.menu.style.bottom=""):(this.dom.menu.style.left=d+"px",this.dom.menu.style.top="",this.dom.menu.style.bottom=n-h+"px"),document.body.appendChild(this.dom.menu);var l=this,c=this.dom.list;this.eventListeners.mousedown=e.addEventListener(document,"mousedown",function(e){var t=e.target;t==c||l._isChildOf(t,c)||(l.hide(),e.stopPropagation(),e.preventDefault())}),this.eventListeners.mousewheel=e.addEventListener(document,"mousewheel",function(e){e.stopPropagation(),e.preventDefault()}),this.eventListeners.keydown=e.addEventListener(document,"keydown",function(e){l._onKeyDown(e)}),this.selection=e.getSelection(),this.anchor=i,setTimeout(function(){l.dom.focusButton.focus()},0),t.visibleMenu&&t.visibleMenu.hide(),t.visibleMenu=this},t.prototype.hide=function(){this.dom.menu.parentNode&&(this.dom.menu.parentNode.removeChild(this.dom.menu),this.onClose&&this.onClose());for(var i in this.eventListeners)if(this.eventListeners.hasOwnProperty(i)){var n=this.eventListeners[i];n&&e.removeEventListener(document,i,n),delete this.eventListeners[i]}t.visibleMenu==this&&(t.visibleMenu=void 0)},t.prototype._onExpandItem=function(t){var i=this,n=t==this.expandedItem,o=this.expandedItem;if(o&&(o.ul.style.height="0",o.ul.style.padding="",setTimeout(function(){i.expandedItem!=o&&(o.ul.style.display="",e.removeClassName(o.ul.parentNode,"selected"))},300),this.expandedItem=void 0),!n){var s=t.ul;s.style.display="block";{s.clientHeight}setTimeout(function(){i.expandedItem==t&&(s.style.height=24*s.childNodes.length+"px",s.style.padding="5px 10px")},0),e.addClassName(s.parentNode,"selected"),this.expandedItem=t}},t.prototype._onKeyDown=function(t){var i,n,o,s,r=t.target,a=t.which,d=!1;27==a?(this.selection&&e.setSelection(this.selection),this.anchor&&this.anchor.focus(),this.hide(),d=!0):9==a?t.shiftKey?(i=this._getVisibleButtons(),n=i.indexOf(r),0==n&&(i[i.length-1].focus(),d=!0)):(i=this._getVisibleButtons(),n=i.indexOf(r),n==i.length-1&&(i[0].focus(),d=!0)):37==a?("expand"==r.className&&(i=this._getVisibleButtons(),n=i.indexOf(r),o=i[n-1],o&&o.focus()),d=!0):38==a?(i=this._getVisibleButtons(),n=i.indexOf(r),o=i[n-1],o&&"expand"==o.className&&(o=i[n-2]),o||(o=i[i.length-1]),o&&o.focus(),d=!0):39==a?(i=this._getVisibleButtons(),n=i.indexOf(r),s=i[n+1],s&&"expand"==s.className&&s.focus(),d=!0):40==a&&(i=this._getVisibleButtons(),n=i.indexOf(r),s=i[n+1],s&&"expand"==s.className&&(s=i[n+2]),s||(s=i[0]),s&&(s.focus(),d=!0),d=!0),d&&(t.stopPropagation(),t.preventDefault())},t.prototype._isChildOf=function(e,t){for(var i=e.parentNode;i;){if(i==t)return!0;i=i.parentNode}return!1},t}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(e,t,i){var n,o;n=[i(9),i(3)],o=function(e,t){function i(i){function n(e){this.editor=e,this.dom={}}return n.prototype=new i,n.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;this._updateEditability();var t=document.createElement("tr");if(t.node=this,e.tr=t,this.editable.field){e.tdDrag=document.createElement("td");var i=document.createElement("td");e.tdMenu=i;var n=document.createElement("button");n.className="contextmenu",n.title="Click to open the actions menu (Ctrl+M)",e.menu=n,i.appendChild(e.menu)}var o=document.createElement("td"),s=document.createElement("div");return s.innerHTML="(empty)",s.className="readonly",o.appendChild(s),e.td=o,e.text=s,this.updateDom(),t},n.prototype.updateDom=function(){var e=this.dom,t=e.td;t&&(t.style.paddingLeft=24*this.getLevel()+26+"px");var i=e.text;i&&(i.innerHTML="(empty "+this.parent.type+")");var n=e.tr;this.isVisible()?e.tr.firstChild||(e.tdDrag&&n.appendChild(e.tdDrag),e.tdMenu&&n.appendChild(e.tdMenu),n.appendChild(t)):e.tr.firstChild&&(e.tdDrag&&n.removeChild(e.tdDrag),e.tdMenu&&n.removeChild(e.tdMenu),n.removeChild(t))},n.prototype.isVisible=function(){return 0==this.parent.childs.length},n.prototype.showContextMenu=function(t,n){var o=this,s=i.TYPE_TITLES,r=[{text:"Append",title:"Append a new field with type 'auto' (Ctrl+Shift+Ins)",submenuTitle:"Select the type of the field to be appended",className:"insert",click:function(){o._onAppend("","","auto")},submenu:[{text:"Auto",className:"type-auto",title:s.auto,click:function(){o._onAppend("","","auto")}},{text:"Array",className:"type-array",title:s.array,click:function(){o._onAppend("",[])}},{text:"Object",className:"type-object",title:s.object,click:function(){o._onAppend("",{})}},{text:"String",className:"type-string",title:s.string,click:function(){o._onAppend("","","string")}}]}],a=new e(r,{close:n});a.show(t)},n.prototype.onEvent=function(e){var i=e.type,n=e.target||e.srcElement,o=this.dom,s=o.menu;if(n==s&&("mouseover"==i?this.editor.highlighter.highlight(this.parent):"mouseout"==i&&this.editor.highlighter.unhighlight()),"click"==i&&n==o.menu){var r=this.editor.highlighter;r.highlight(this.parent),r.lock(),t.addClassName(o.menu,"selected"),this.showContextMenu(o.menu,function(){t.removeClassName(o.menu,"selected"),r.unlock(),r.unhighlight()})}"keydown"==i&&this.onKeyDown(e)},n}return i}.apply(t,n),!(void 0!==o&&(e.exports=o))}])}); +!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()}(this,function(){return function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){var n,o;n=[i(1),i(2),i(3)],o=function(e,t,i){function n(e,t,o){if(!(this instanceof n))throw new Error('JSONEditor constructor called without "new".');var s=i.getInternetExplorerVersion();if(-1!=s&&9>s)throw new Error("Unsupported browser, IE9 or newer required. Please install the newest version of your browser.");arguments.length&&this._create(e,t,o)}return n.modes={},n.prototype._create=function(e,t,i){this.container=e,this.options=t||{},this.json=i||{};var n=this.options.mode||"tree";this.setMode(n)},n.prototype._delete=function(){},n.prototype.set=function(e){this.json=e},n.prototype.get=function(){return this.json},n.prototype.setText=function(e){this.json=i.parse(e)},n.prototype.getText=function(){return JSON.stringify(this.json)},n.prototype.setName=function(e){this.options||(this.options={}),this.options.name=e},n.prototype.getName=function(){return this.options&&this.options.name},n.prototype.setMode=function(e){var t,o,s=this.container,r=i.extend({},this.options);r.mode=e;var a=n.modes[e];if(!a)throw new Error('Unknown mode "'+r.mode+'"');try{var d="text"==a.data;if(o=this.getName(),t=this[d?"getText":"get"](),this._delete(),i.clear(this),i.extend(this,a.mixin),this.create(s,r),this.setName(o),this[d?"setText":"set"](t),"function"==typeof a.load)try{a.load.call(this)}catch(h){}}catch(h){this._onError(h)}},n.prototype._onError=function(e){if("function"==typeof this.onError&&(i.log("WARNING: JSONEditor.onError is deprecated. Use options.error instead."),this.onError(e)),!this.options||"function"!=typeof this.options.error)throw e;this.options.error(e)},n.registerMode=function(e){var t,o;if(i.isArray(e))for(t=0;te&&i.scrollTop>0?(n+a-e)/3:e>r-a&&o+i.scrollTop3?(i.scrollTop+=o/3,n.animateCallback=t,n.animateTimeout=setTimeout(a,50)):(t&&t(!0),i.scrollTop=r,delete n.animateTimeout,delete n.animateCallback)};a()}else t&&t(!1)},r._createFrame=function(){function e(e){t._onEvent(e)}this.frame=document.createElement("div"),this.frame.className="jsoneditor",this.container.appendChild(this.frame);var t=this;this.frame.onclick=function(t){var i=t.target;e(t),"BUTTON"==i.nodeName&&t.preventDefault()},this.frame.oninput=e,this.frame.onchange=e,this.frame.onkeydown=e,this.frame.onkeyup=e,this.frame.oncut=e,this.frame.onpaste=e,this.frame.onmousedown=e,this.frame.onmouseup=e,this.frame.onmouseover=e,this.frame.onmouseout=e,s.addEventListener(this.frame,"focus",e,!0),s.addEventListener(this.frame,"blur",e,!0),this.frame.onfocusin=e,this.frame.onfocusout=e,this.menu=document.createElement("div"),this.menu.className="menu",this.frame.appendChild(this.menu);var n=document.createElement("button");n.className="expand-all",n.title="Expand all fields",n.onclick=function(){t.expandAll()},this.menu.appendChild(n);var r=document.createElement("button");if(r.title="Collapse all fields",r.className="collapse-all",r.onclick=function(){t.collapseAll()},this.menu.appendChild(r),this.history){var a=document.createElement("button");a.className="undo separator",a.title="Undo last action (Ctrl+Z)",a.onclick=function(){t._onUndo()},this.menu.appendChild(a),this.dom.undo=a;var d=document.createElement("button");d.className="redo",d.title="Redo (Ctrl+Shift+Z)",d.onclick=function(){t._onRedo()},this.menu.appendChild(d),this.dom.redo=d,this.history.onChange=function(){a.disabled=!t.history.canUndo(),d.disabled=!t.history.canRedo()},this.history.onChange()}if(this.options&&this.options.modes&&this.options.modes.length){var h=o.create(this,this.options.modes,this.options.mode);this.menu.appendChild(h),this.dom.modeBox=h}this.options.search&&(this.searchBox=new i(this,this.menu))},r._onUndo=function(){if(this.history){var e=this.history.undo();this.options.change&&this.options.change(e.action,e.params)}},r._onRedo=function(){if(this.history){var e=this.history.redo();this.options.change&&this.options.change(e.action,e.params)}},r._onEvent=function(e){var t=e.target;"keydown"==e.type&&this._onKeyDown(e),"focus"==e.type&&(d=t);var i=n.getNodeFromTarget(t);i&&i.onEvent(e)},r._onKeyDown=function(e){var t=e.which||e.keyCode,i=e.ctrlKey,n=e.shiftKey,o=!1;if(9==t&&setTimeout(function(){s.selectContentEditable(d)},0),this.searchBox)if(i&&70==t)this.searchBox.dom.search.focus(),this.searchBox.dom.search.select(),o=!0;else if(114==t||i&&71==t){var r=!0;n?this.searchBox.previous(r):this.searchBox.next(r),o=!0}this.history&&(i&&!n&&90==t?(this._onUndo(),o=!0):i&&n&&90==t&&(this._onRedo(),o=!0)),o&&(e.preventDefault(),e.stopPropagation())},r._createTable=function(){var e=document.createElement("div");e.className="outer",this.contentOuter=e,this.content=document.createElement("div"),this.content.className="tree",e.appendChild(this.content),this.table=document.createElement("table"),this.table.className="tree",this.content.appendChild(this.table);var t;this.colgroupContent=document.createElement("colgroup"),"tree"===this.options.mode&&(t=document.createElement("col"),t.width="24px",this.colgroupContent.appendChild(t)),t=document.createElement("col"),t.width="24px",this.colgroupContent.appendChild(t),t=document.createElement("col"),this.colgroupContent.appendChild(t),this.table.appendChild(this.colgroupContent),this.tbody=document.createElement("tbody"),this.table.appendChild(this.tbody),this.frame.appendChild(e)},[{mode:"tree",mixin:r,data:"json"},{mode:"view",mixin:r,data:"json"},{mode:"form",mixin:r,data:"json"}]}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(e,t,i){var n,o;n=[i(8),i(3)],o=function(e,t){var i={};return i.create=function(i,n){n=n||{},this.options=n,this.indentation=n.indentation?Number(n.indentation):2,this.mode="code"==n.mode?"code":"text","code"==this.mode&&"undefined"==typeof ace&&(this.mode="text",t.log("WARNING: Cannot load code editor, Ace library not loaded. Falling back to plain text editor"));var o=this;this.container=i,this.dom={},this.editor=void 0,this.textarea=void 0,this.width=i.clientWidth,this.height=i.clientHeight,this.frame=document.createElement("div"),this.frame.className="jsoneditor",this.frame.onclick=function(e){e.preventDefault()},this.menu=document.createElement("div"),this.menu.className="menu",this.frame.appendChild(this.menu);var s=document.createElement("button");s.className="format",s.title="Format JSON data, with proper indentation and line feeds",this.menu.appendChild(s),s.onclick=function(){try{o.format()}catch(e){o._onError(e)}};var r=document.createElement("button");if(r.className="compact",r.title="Compact JSON data, remove all whitespaces",this.menu.appendChild(r),r.onclick=function(){try{o.compact()}catch(e){o._onError(e)}},this.options&&this.options.modes&&this.options.modes.length){var a=e.create(this,this.options.modes,this.options.mode);this.menu.appendChild(a),this.dom.modeBox=a}if(this.content=document.createElement("div"),this.content.className="outer",this.frame.appendChild(this.content),this.container.appendChild(this.frame),"code"==this.mode){this.editorDom=document.createElement("div"),this.editorDom.style.height="100%",this.editorDom.style.width="100%",this.content.appendChild(this.editorDom);var d=ace.edit(this.editorDom);d.setTheme("ace/theme/jsoneditor"),d.setShowPrintMargin(!1),d.setFontSize(13),d.getSession().setMode("ace/mode/json"),d.getSession().setTabSize(2),d.getSession().setUseSoftTabs(!0),d.getSession().setUseWrapMode(!0),this.editor=d;var h=document.createElement("a");h.appendChild(document.createTextNode("powered by ace")),h.href="http://ace.ajax.org",h.target="_blank",h.className="poweredBy",h.onclick=function(){window.open(h.href,h.target)},this.menu.appendChild(h),n.change&&d.on("change",function(){n.change()})}else{var l=document.createElement("textarea");l.className="text",l.spellcheck=!1,this.content.appendChild(l),this.textarea=l,n.change&&(null===this.textarea.oninput?this.textarea.oninput=function(){n.change()}:this.textarea.onchange=function(){n.change()})}},i._delete=function(){this.frame&&this.container&&this.frame.parentNode==this.container&&this.container.removeChild(this.frame)},i._onError=function(e){if("function"==typeof this.onError&&(t.log("WARNING: JSONEditor.onError is deprecated. Use options.error instead."),this.onError(e)),!this.options||"function"!=typeof this.options.error)throw e;this.options.error(e)},i.compact=function(){var e=t.parse(this.getText());this.setText(JSON.stringify(e))},i.format=function(){var e=t.parse(this.getText());this.setText(JSON.stringify(e,null,this.indentation))},i.focus=function(){this.textarea&&this.textarea.focus(),this.editor&&this.editor.focus()},i.resize=function(){if(this.editor){var e=!1;this.editor.resize(e)}},i.set=function(e){this.setText(JSON.stringify(e,null,this.indentation))},i.get=function(){return t.parse(this.getText())},i.getText=function(){return this.textarea?this.textarea.value:this.editor?this.editor.getValue():""},i.setText=function(e){this.textarea&&(this.textarea.value=e),this.editor&&this.editor.setValue(e,-1)},[{mode:"text",mixin:i,data:"text",load:i.format},{mode:"code",mixin:i,data:"text",load:i.format}]}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(e,t,i){var n;n=function(){var e={};e.parse=function(t){try{return JSON.parse(t)}catch(i){try{return e.parseJS(t)}catch(n){throw e.validate(t),i}}},e.parseJS=function(e){for(var t=[],i=!1,n=0;nn;n++){var s=i[n];s.style&&s.removeAttribute("style");var r=s.attributes;if(r)for(var a=r.length-1;a>=0;a--){var d=r[a];1==d.specified&&s.removeAttribute(d.name)}e.stripFormatting(s)}},e.setEndOfContentEditable=function(e){var t,i;document.createRange&&(t=document.createRange(),t.selectNodeContents(e),t.collapse(!1),i=window.getSelection(),i.removeAllRanges(),i.addRange(t))},e.selectContentEditable=function(e){if(e&&"DIV"==e.nodeName){var t,i;window.getSelection&&document.createRange&&(i=document.createRange(),i.selectNodeContents(e),t=window.getSelection(),t.removeAllRanges(),t.addRange(i))}},e.getSelection=function(){if(window.getSelection){var e=window.getSelection();if(e.getRangeAt&&e.rangeCount)return e.getRangeAt(0)}return null},e.setSelection=function(e){if(e&&window.getSelection){var t=window.getSelection();t.removeAllRanges(),t.addRange(e)}},e.getSelectionOffset=function(){var t=e.getSelection();return t&&"startOffset"in t&&"endOffset"in t&&t.startContainer&&t.startContainer==t.endContainer?{startOffset:t.startOffset,endOffset:t.endOffset,container:t.startContainer.parentNode}:null},e.setSelectionOffset=function(t){if(document.createRange&&window.getSelection){var i=window.getSelection();if(i){var n=document.createRange();n.setStart(t.container.firstChild,t.startOffset),n.setEnd(t.container.firstChild,t.endOffset),e.setSelection(n)}}},e.getInnerText=function(t,i){var n=void 0==i;if(n&&(i={text:"",flush:function(){var e=this.text;return this.text="",e},set:function(e){this.text=e}}),t.nodeValue)return i.flush()+t.nodeValue;if(t.hasChildNodes()){for(var o=t.childNodes,s="",r=0,a=o.length;a>r;r++){var d=o[r];if("DIV"==d.nodeName||"P"==d.nodeName){var h=o[r-1],l=h?h.nodeName:void 0;l&&"DIV"!=l&&"P"!=l&&"BR"!=l&&(s+="\n",i.flush()),s+=e.getInnerText(d,i),i.set("\n")}else"BR"==d.nodeName?(s+=i.flush(),i.set("\n")):s+=e.getInnerText(d,i)}return s}return"P"==t.nodeName&&-1!=e.getInternetExplorerVersion()?i.flush():""},e.getInternetExplorerVersion=function(){if(-1==i){var e=-1;if("Microsoft Internet Explorer"==navigator.appName){var t=navigator.userAgent,n=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");null!=n.exec(t)&&(e=parseFloat(RegExp.$1))}i=e}return i},e.isFirefox=function(){return-1!=navigator.userAgent.indexOf("Firefox")};var i=-1;return e.addEventListener=function(t,i,n,o){if(t.addEventListener)return void 0===o&&(o=!1),"mousewheel"===i&&e.isFirefox()&&(i="DOMMouseScroll"),t.addEventListener(i,n,o),n;if(t.attachEvent){var s=function(){return n.call(t,window.event)};return t.attachEvent("on"+i,s),s}},e.removeEventListener=function(t,i,n,o){t.removeEventListener?(void 0===o&&(o=!1),"mousewheel"===i&&e.isFirefox()&&(i="DOMMouseScroll"),t.removeEventListener(i,n,o)):t.detachEvent&&t.detachEvent("on"+i,n)},e}.call(t,i,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,i){var n,o;n=[i(3)],o=function(e){function t(e){this.editor=e,this.clear(),this.actions={editField:{undo:function(e){e.node.updateField(e.oldValue)},redo:function(e){e.node.updateField(e.newValue)}},editValue:{undo:function(e){e.node.updateValue(e.oldValue)},redo:function(e){e.node.updateValue(e.newValue)}},appendNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.appendChild(e.node)}},insertBeforeNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.insertBefore(e.node,e.beforeNode)}},insertAfterNode:{undo:function(e){e.parent.removeChild(e.node)},redo:function(e){e.parent.insertAfter(e.node,e.afterNode)}},removeNode:{undo:function(e){var t=e.parent,i=t.childs[e.index]||t.append;t.insertBefore(e.node,i)},redo:function(e){e.parent.removeChild(e.node)}},duplicateNode:{undo:function(e){e.parent.removeChild(e.clone)},redo:function(e){e.parent.insertAfter(e.clone,e.node)}},changeType:{undo:function(e){e.node.changeType(e.oldType)},redo:function(e){e.node.changeType(e.newType)}},moveNode:{undo:function(e){e.startParent.moveTo(e.node,e.startIndex)},redo:function(e){e.endParent.moveTo(e.node,e.endIndex)}},sort:{undo:function(e){var t=e.node;t.hideChilds(),t.sort=e.oldSort,t.childs=e.oldChilds,t.showChilds()},redo:function(e){var t=e.node;t.hideChilds(),t.sort=e.newSort,t.childs=e.newChilds,t.showChilds()}}}}return t.prototype.onChange=function(){},t.prototype.add=function(e,t){this.index++,this.history[this.index]={action:e,params:t,timestamp:new Date},this.index=0},t.prototype.canRedo=function(){return this.indexthis.results.length-1&&(t=0),this._setActiveResult(t,e)}},e.prototype.previous=function(e){if(void 0!=this.results){var t=this.results.length-1,i=void 0!=this.resultIndex?this.resultIndex-1:t;0>i&&(i=t),this._setActiveResult(i,e)}},e.prototype._setActiveResult=function(e,t){if(this.activeResult){var i=this.activeResult.node,n=this.activeResult.elem;"field"==n?delete i.searchFieldActive:delete i.searchValueActive,i.updateDom()}if(!this.results||!this.results[e])return this.resultIndex=void 0,void(this.activeResult=void 0);this.resultIndex=e;var o=this.results[this.resultIndex].node,s=this.results[this.resultIndex].elem;"field"==s?o.searchFieldActive=!0:o.searchValueActive=!0,this.activeResult=this.results[this.resultIndex],o.updateDom(),o.scrollTo(function(){t&&o.focus(s)})},e.prototype._clearDelay=function(){void 0!=this.timeout&&(clearTimeout(this.timeout),delete this.timeout)},e.prototype._onDelayedSearch=function(){this._clearDelay();var e=this;this.timeout=setTimeout(function(t){e._onSearch(t)},this.delay)},e.prototype._onSearch=function(e,t){this._clearDelay();var i=this.dom.search.value,n=i.length>0?i:void 0;if(n!=this.lastText||t)if(this.lastText=n,this.results=this.editor.search(n),this._setActiveResult(void 0),void 0!=n){var o=this.results.length;switch(o){case 0:this.dom.results.innerHTML="no results";break;case 1:this.dom.results.innerHTML="1 result";break;default:this.dom.results.innerHTML=o+" results"}}else this.dom.results.innerHTML=""},e.prototype._onKeyDown=function(e){var t=e.which;27==t?(this.dom.search.value="",this._onSearch(e),e.preventDefault(),e.stopPropagation()):13==t&&(e.ctrlKey?this._onSearch(e,!0):e.shiftKey?this.previous():this.next(),e.preventDefault(),e.stopPropagation())},e.prototype._onKeyUp=function(e){var t=e.keyCode;27!=t&&13!=t&&this._onDelayedSearch(e)},e}.call(t,i,t,e),!(void 0!==n&&(e.exports=n))},function(e,t,i){var n,o;n=[i(9),i(10),i(3)],o=function(e,t,i){function n(e,t){this.editor=e,this.dom={},this.expanded=!1,t&&t instanceof Object?(this.setField(t.field,t.fieldEditable),this.setValue(t.value,t.type)):(this.setField(""),this.setValue(null))}n.prototype._updateEditability=function(){if(this.editable={field:!0,value:!0},this.editor&&(this.editable.field="tree"===this.editor.options.mode,this.editable.value="view"!==this.editor.options.mode,"tree"===this.editor.options.mode&&"function"==typeof this.editor.options.editable)){var e=this.editor.options.editable({field:this.field,value:this.value,path:this.path()});"boolean"==typeof e?(this.editable.field=e,this.editable.value=e):("boolean"==typeof e.field&&(this.editable.field=e.field),"boolean"==typeof e.value&&(this.editable.value=e.value))}},n.prototype.path=function(){for(var e=this,t=[];e;){var i=e.field||e.index;void 0!==i&&t.unshift(i),e=e.parent}return t},n.prototype.setParent=function(e){this.parent=e},n.prototype.setField=function(e,t){this.field=e,this.fieldEditable=1==t},n.prototype.getField=function(){return void 0===this.field&&this._getDomField(),this.field},n.prototype.setValue=function(e,t){var i,o,s=this.childs;if(s)for(;s.length;)this.removeChild(s[0]);if(this.type=this._getType(e),t&&t!=this.type){if("string"!=t||"auto"!=this.type)throw new Error('Type mismatch: cannot cast value of type "'+this.type+' to the specified type "'+t+'"');this.type=t}if("array"==this.type){this.childs=[];for(var r=0,a=e.length;a>r;r++)i=e[r],void 0===i||i instanceof Function||(o=new n(this.editor,{value:i}),this.appendChild(o));this.value=""}else if("object"==this.type){this.childs=[];for(var d in e)e.hasOwnProperty(d)&&(i=e[d],void 0===i||i instanceof Function||(o=new n(this.editor,{field:d,value:i}),this.appendChild(o)));this.value=""}else this.childs=void 0,this.value=e},n.prototype.getValue=function(){if("array"==this.type){var e=[];return this.childs.forEach(function(t){e.push(t.getValue())}),e}if("object"==this.type){var t={};return this.childs.forEach(function(e){t[e.getField()]=e.getValue()}),t}return void 0===this.value&&this._getDomValue(),this.value},n.prototype.getLevel=function(){return this.parent?this.parent.getLevel()+1:0},n.prototype.clone=function(){var e=new n(this.editor);if(e.type=this.type,e.field=this.field,e.fieldInnerText=this.fieldInnerText,e.fieldEditable=this.fieldEditable,e.value=this.value,e.valueInnerText=this.valueInnerText,e.expanded=this.expanded,this.childs){var t=[];this.childs.forEach(function(i){var n=i.clone();n.setParent(e),t.push(n)}),e.childs=t}else e.childs=void 0;return e},n.prototype.expand=function(e){this.childs&&(this.expanded=!0,this.dom.expand&&(this.dom.expand.className="expanded"),this.showChilds(),0!=e&&this.childs.forEach(function(t){t.expand(e)}))},n.prototype.collapse=function(e){this.childs&&(this.hideChilds(),0!=e&&this.childs.forEach(function(t){t.collapse(e)}),this.dom.expand&&(this.dom.expand.className="collapsed"),this.expanded=!1)},n.prototype.showChilds=function(){var e=this.childs;if(e&&this.expanded){var t=this.dom.tr,i=t?t.parentNode:void 0;if(i){var n=this.getAppend(),o=t.nextSibling;o?i.insertBefore(n,o):i.appendChild(n),this.childs.forEach(function(e){i.insertBefore(e.getDom(),n),e.showChilds()})}}},n.prototype.hide=function(){var e=this.dom.tr,t=e?e.parentNode:void 0;t&&t.removeChild(e),this.hideChilds()},n.prototype.hideChilds=function(){var e=this.childs;if(e&&this.expanded){var t=this.getAppend();t.parentNode&&t.parentNode.removeChild(t),this.childs.forEach(function(e){e.hide()})}},n.prototype.appendChild=function(e){if(this._hasChilds()){if(e.setParent(this),e.fieldEditable="object"==this.type,"array"==this.type&&(e.index=this.childs.length),this.childs.push(e),this.expanded){var t=e.getDom(),i=this.getAppend(),n=i?i.parentNode:void 0;i&&n&&n.insertBefore(t,i),e.showChilds()}this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0})}},n.prototype.moveBefore=function(e,t){if(this._hasChilds()){var i=this.dom.tr?this.dom.tr.parentNode:void 0;if(i){var n=document.createElement("tr");n.style.height=i.clientHeight+"px",i.appendChild(n)}e.parent&&e.parent.removeChild(e),t instanceof o?this.appendChild(e):this.insertBefore(e,t),i&&i.removeChild(n)}},n.prototype.moveTo=function(e,t){if(e.parent==this){var i=this.childs.indexOf(e);t>i&&t++}var n=this.childs[t]||this.append;this.moveBefore(e,n)},n.prototype.insertBefore=function(e,t){if(this._hasChilds()){if(t==this.append)e.setParent(this),e.fieldEditable="object"==this.type,this.childs.push(e);else{var i=this.childs.indexOf(t);if(-1==i)throw new Error("Node not found");e.setParent(this),e.fieldEditable="object"==this.type,this.childs.splice(i,0,e)}if(this.expanded){var n=e.getDom(),o=t.getDom(),s=o?o.parentNode:void 0;o&&s&&s.insertBefore(n,o),e.showChilds()}this.updateDom({updateIndexes:!0}),e.updateDom({recurse:!0})}},n.prototype.insertAfter=function(e,t){if(this._hasChilds()){var i=this.childs.indexOf(t),n=this.childs[i+1];n?this.insertBefore(e,n):this.appendChild(e)}},n.prototype.search=function(e){var t,i=[],n=e?e.toLowerCase():void 0;if(delete this.searchField,delete this.searchValue,void 0!=this.field){var o=String(this.field).toLowerCase();t=o.indexOf(n),-1!=t&&(this.searchField=!0,i.push({node:this,elem:"field"})),this._updateDomField()}if(this._hasChilds()){if(this.childs){var s=[];this.childs.forEach(function(t){s=s.concat(t.search(e))}),i=i.concat(s)}if(void 0!=n){var r=!1;0==s.length?this.collapse(r):this.expand(r)}}else{if(void 0!=this.value){var a=String(this.value).toLowerCase();t=a.indexOf(n),-1!=t&&(this.searchValue=!0,i.push({node:this,elem:"value"}))}this._updateDomValue()}return i},n.prototype.scrollTo=function(e){if(!this.dom.tr||!this.dom.tr.parentNode)for(var t=this.parent,i=!1;t;)t.expand(i),t=t.parent;this.dom.tr&&this.dom.tr.parentNode&&this.editor.scrollTo(this.dom.tr.offsetTop,e)},n.focusElement=void 0,n.prototype.focus=function(e){if(n.focusElement=e,this.dom.tr&&this.dom.tr.parentNode){var t=this.dom;switch(e){case"drag":t.drag?t.drag.focus():t.menu.focus();break;case"menu":t.menu.focus();break;case"expand":this._hasChilds()?t.expand.focus():t.field&&this.fieldEditable?(t.field.focus(),i.selectContentEditable(t.field)):t.value&&!this._hasChilds()?(t.value.focus(),i.selectContentEditable(t.value)):t.menu.focus();break;case"field":t.field&&this.fieldEditable?(t.field.focus(),i.selectContentEditable(t.field)):t.value&&!this._hasChilds()?(t.value.focus(),i.selectContentEditable(t.value)):this._hasChilds()?t.expand.focus():t.menu.focus();break;case"value":default:t.value&&!this._hasChilds()?(t.value.focus(),i.selectContentEditable(t.value)):t.field&&this.fieldEditable?(t.field.focus(),i.selectContentEditable(t.field)):this._hasChilds()?t.expand.focus():t.menu.focus()}}},n.select=function(e){setTimeout(function(){i.selectContentEditable(e)},0)},n.prototype.blur=function(){this._getDomValue(!1),this._getDomField(!1)},n.prototype._duplicate=function(e){var t=e.clone(); +return this.insertAfter(t,e),t},n.prototype.containsNode=function(e){if(this==e)return!0;var t=this.childs;if(t)for(var i=0,n=t.length;n>i;i++)if(t[i].containsNode(e))return!0;return!1},n.prototype._move=function(e,t){if(e!=t){if(e.containsNode(this))throw new Error("Cannot move a field into a child of itself");e.parent&&e.parent.removeChild(e);var i=e.clone();e.clearDom(),t?this.insertBefore(i,t):this.appendChild(i)}},n.prototype.removeChild=function(e){if(this.childs){var t=this.childs.indexOf(e);if(-1!=t){e.hide(),delete e.searchField,delete e.searchValue;var i=this.childs.splice(t,1)[0];return this.updateDom({updateIndexes:!0}),i}}return void 0},n.prototype._remove=function(e){this.removeChild(e)},n.prototype.changeType=function(e){var t=this.type;if(t!=e){if("string"!=e&&"auto"!=e||"string"!=t&&"auto"!=t){var i,n=this.dom.tr?this.dom.tr.parentNode:void 0;i=this.expanded?this.getAppend():this.getDom();var o=i&&i.parentNode?i.nextSibling:void 0;this.hide(),this.clearDom(),this.type=e,"object"==e?(this.childs||(this.childs=[]),this.childs.forEach(function(e){e.clearDom(),delete e.index,e.fieldEditable=!0,void 0==e.field&&(e.field="")}),("string"==t||"auto"==t)&&(this.expanded=!0)):"array"==e?(this.childs||(this.childs=[]),this.childs.forEach(function(e,t){e.clearDom(),e.fieldEditable=!1,e.index=t}),("string"==t||"auto"==t)&&(this.expanded=!0)):this.expanded=!1,n&&(o?n.insertBefore(this.getDom(),o):n.appendChild(this.getDom())),this.showChilds()}else this.type=e;("auto"==e||"string"==e)&&(this.value="string"==e?String(this.value):this._stringCast(String(this.value)),this.focus()),this.updateDom({updateIndexes:!0})}},n.prototype._getDomValue=function(e){if(this.dom.value&&"array"!=this.type&&"object"!=this.type&&(this.valueInnerText=i.getInnerText(this.dom.value)),void 0!=this.valueInnerText)try{var t;if("string"==this.type)t=this._unescapeHTML(this.valueInnerText);else{var n=this._unescapeHTML(this.valueInnerText);t=this._stringCast(n)}if(t!==this.value){var o=this.value;this.value=t,this.editor._onAction("editValue",{node:this,oldValue:o,newValue:t,oldSelection:this.editor.selection,newSelection:this.editor.getSelection()})}}catch(s){if(this.value=void 0,1!=e)throw s}},n.prototype._updateDomValue=function(){var e=this.dom.value;if(e){var t=this.value,n="auto"==this.type?i.type(t):this.type,o="string"==n&&i.isUrl(t),s="";s=o&&!this.editable.value?"":"string"==n?"green":"number"==n?"red":"boolean"==n?"darkorange":this._hasChilds()?"":null===t?"#004ED0":"black",e.style.color=s;var r=""==String(this.value)&&"array"!=this.type&&"object"!=this.type;if(r?i.addClassName(e,"empty"):i.removeClassName(e,"empty"),o?i.addClassName(e,"url"):i.removeClassName(e,"url"),"array"==n||"object"==n){var a=this.childs?this.childs.length:0;e.title=this.type+" containing "+a+" items"}else"string"==n&&i.isUrl(t)?this.editable.value&&(e.title="Ctrl+Click or Ctrl+Enter to open url in new window"):e.title="";this.searchValueActive?i.addClassName(e,"highlight-active"):i.removeClassName(e,"highlight-active"),this.searchValue?i.addClassName(e,"highlight"):i.removeClassName(e,"highlight"),i.stripFormatting(e)}},n.prototype._updateDomField=function(){var e=this.dom.field;if(e){var t=""==String(this.field)&&"array"!=this.parent.type;t?i.addClassName(e,"empty"):i.removeClassName(e,"empty"),this.searchFieldActive?i.addClassName(e,"highlight-active"):i.removeClassName(e,"highlight-active"),this.searchField?i.addClassName(e,"highlight"):i.removeClassName(e,"highlight"),i.stripFormatting(e)}},n.prototype._getDomField=function(e){if(this.dom.field&&this.fieldEditable&&(this.fieldInnerText=i.getInnerText(this.dom.field)),void 0!=this.fieldInnerText)try{var t=this._unescapeHTML(this.fieldInnerText);if(t!==this.field){var n=this.field;this.field=t,this.editor._onAction("editField",{node:this,oldValue:n,newValue:t,oldSelection:this.editor.selection,newSelection:this.editor.getSelection()})}}catch(o){if(this.field=void 0,1!=e)throw o}},n.prototype.clearDom=function(){this.dom={}},n.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;if(this._updateEditability(),e.tr=document.createElement("tr"),e.tr.node=this,"tree"===this.editor.options.mode){var t=document.createElement("td");if(this.editable.field&&this.parent){var i=document.createElement("button");e.drag=i,i.className="dragarea",i.title="Drag to move this field (Alt+Shift+Arrows)",t.appendChild(i)}e.tr.appendChild(t);var n=document.createElement("td"),o=document.createElement("button");e.menu=o,o.className="contextmenu",o.title="Click to open the actions menu (Ctrl+M)",n.appendChild(e.menu),e.tr.appendChild(n)}var s=document.createElement("td");return e.tr.appendChild(s),e.tree=this._createDomTree(),s.appendChild(e.tree),this.updateDom({updateIndexes:!0}),e.tr},n.prototype._onDragStart=function(e){var t=this;this.mousemove||(this.mousemove=i.addEventListener(document,"mousemove",function(e){t._onDrag(e)})),this.mouseup||(this.mouseup=i.addEventListener(document,"mouseup",function(e){t._onDragEnd(e)})),this.editor.highlighter.lock(),this.drag={oldCursor:document.body.style.cursor,startParent:this.parent,startIndex:this.parent.childs.indexOf(this),mouseX:e.pageX,level:this.getLevel()},document.body.style.cursor="move",e.preventDefault()},n.prototype._onDrag=function(e){var t,s,r,a,d,h,l,c,u,p,f,m,v,g,y=e.pageY,x=e.pageX,b=!1;if(t=this.dom.tr,u=i.getAbsoluteTop(t),m=t.offsetHeight,u>y){s=t;do s=s.previousSibling,l=n.getNodeFromTarget(s),p=s?i.getAbsoluteTop(s):0;while(s&&p>y);l&&!l.parent&&(l=void 0),l||(h=t.parentNode.firstChild,s=h?h.nextSibling:void 0,l=n.getNodeFromTarget(s),l==this&&(l=void 0)),l&&(s=l.dom.tr,p=s?i.getAbsoluteTop(s):0,y>p+m&&(l=void 0)),l&&(l.parent.moveBefore(this,l),b=!0)}else if(d=this.expanded&&this.append?this.append.getDom():this.dom.tr,a=d?d.nextSibling:void 0){f=i.getAbsoluteTop(a),r=a;do c=n.getNodeFromTarget(r),r&&(v=r.nextSibling?i.getAbsoluteTop(r.nextSibling):0,g=r?v-f:0,1==c.parent.childs.length&&c.parent.childs[0]==this&&(u+=23)),r=r.nextSibling;while(r&&y>u+g);if(c&&c.parent){var C=x-this.drag.mouseX,E=Math.round(C/24/2),N=this.drag.level+E,_=c.getLevel();for(s=c.dom.tr.previousSibling;N>_&&s;){if(l=n.getNodeFromTarget(s),l==this||l._isChildOf(this));else{if(!(l instanceof o))break;var w=l.parent.childs;if(!(w.length>1||1==w.length&&w[0]!=this))break;c=n.getNodeFromTarget(s),_=c.getLevel()}s=s.previousSibling}d.nextSibling!=c.dom.tr&&(c.parent.moveBefore(this,c),b=!0)}}b&&(this.drag.mouseX=x,this.drag.level=this.getLevel()),this.editor.startAutoScroll(y),e.preventDefault()},n.prototype._onDragEnd=function(e){var t={node:this,startParent:this.drag.startParent,startIndex:this.drag.startIndex,endParent:this.parent,endIndex:this.parent.childs.indexOf(this)};(t.startParent!=t.endParent||t.startIndex!=t.endIndex)&&this.editor._onAction("moveNode",t),document.body.style.cursor=this.drag.oldCursor,this.editor.highlighter.unlock(),delete this.drag,this.mousemove&&(i.removeEventListener(document,"mousemove",this.mousemove),delete this.mousemove),this.mouseup&&(i.removeEventListener(document,"mouseup",this.mouseup),delete this.mouseup),this.editor.stopAutoScroll(),e.preventDefault()},n.prototype._isChildOf=function(e){for(var t=this.parent;t;){if(t==e)return!0;t=t.parent}return!1},n.prototype._createDomField=function(){return document.createElement("div")},n.prototype.setHighlight=function(e){this.dom.tr&&(this.dom.tr.className=e?"highlight":"",this.append&&this.append.setHighlight(e),this.childs&&this.childs.forEach(function(t){t.setHighlight(e)}))},n.prototype.updateValue=function(e){this.value=e,this.updateDom()},n.prototype.updateField=function(e){this.field=e,this.updateDom()},n.prototype.updateDom=function(e){var t=this.dom.tree;t&&(t.style.marginLeft=24*this.getLevel()+"px");var i=this.dom.field;if(i){this.fieldEditable?(i.contentEditable=this.editable.field,i.spellcheck=!1,i.className="field"):i.className="readonly";var n;n=void 0!=this.index?this.index:void 0!=this.field?this.field:this._hasChilds()?this.type:"",i.innerHTML=this._escapeHTML(n)}var o=this.dom.value;if(o){var s=this.childs?this.childs.length:0;o.innerHTML="array"==this.type?"["+s+"]":"object"==this.type?"{"+s+"}":this._escapeHTML(this.value)}this._updateDomField(),this._updateDomValue(),e&&1==e.updateIndexes&&this._updateDomIndexes(),e&&1==e.recurse&&this.childs&&this.childs.forEach(function(t){t.updateDom(e)}),this.append&&this.append.updateDom()},n.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){void 0!=e.index&&(delete e.index,void 0==e.field&&(e.field=""))}))},n.prototype._createDomValue=function(){var e;return"array"==this.type?(e=document.createElement("div"),e.className="readonly",e.innerHTML="[...]"):"object"==this.type?(e=document.createElement("div"),e.className="readonly",e.innerHTML="{...}"):!this.editable.value&&i.isUrl(this.value)?(e=document.createElement("a"),e.className="value",e.href=this.value,e.target="_blank",e.innerHTML=this._escapeHTML(this.value)):(e=document.createElement("div"),e.contentEditable=this.editable.value,e.spellcheck=!1,e.className="value",e.innerHTML=this._escapeHTML(this.value)),e},n.prototype._createDomExpandButton=function(){var e=document.createElement("button");return this._hasChilds()?(e.className=this.expanded?"expanded":"collapsed",e.title="Click to expand/collapse this field (Ctrl+E). \nCtrl+Click to expand/collapse including all childs."):(e.className="invisible",e.title=""),e},n.prototype._createDomTree=function(){var e=this.dom,t=document.createElement("table"),i=document.createElement("tbody");t.style.borderCollapse="collapse",t.className="values",t.appendChild(i);var n=document.createElement("tr");i.appendChild(n);var o=document.createElement("td");o.className="tree",n.appendChild(o),e.expand=this._createDomExpandButton(),o.appendChild(e.expand),e.tdExpand=o;var s=document.createElement("td");s.className="tree",n.appendChild(s),e.field=this._createDomField(),s.appendChild(e.field),e.tdField=s;var r=document.createElement("td");r.className="tree",n.appendChild(r),"object"!=this.type&&"array"!=this.type&&(r.appendChild(document.createTextNode(":")),r.className="separator"),e.tdSeparator=r;var a=document.createElement("td");return a.className="tree",n.appendChild(a),e.value=this._createDomValue(),a.appendChild(e.value),e.tdValue=a,t},n.prototype.onEvent=function(e){var t,n=e.type,o=e.target||e.srcElement,s=this.dom,r=this,a=this._hasChilds();if((o==s.drag||o==s.menu)&&("mouseover"==n?this.editor.highlighter.highlight(this):"mouseout"==n&&this.editor.highlighter.unhighlight()),"mousedown"==n&&o==s.drag&&this._onDragStart(e),"click"==n&&o==s.menu){var d=r.editor.highlighter;d.highlight(r),d.lock(),i.addClassName(s.menu,"selected"),this.showContextMenu(s.menu,function(){i.removeClassName(s.menu,"selected"),d.unlock(),d.unhighlight()})}if("click"==n&&o==s.expand&&a){var h=e.ctrlKey;this._onExpand(h)}var l=s.value;if(o==l)switch(n){case"focus":t=this;break;case"blur":case"change":this._getDomValue(!0),this._updateDomValue(),this.value&&(l.innerHTML=this._escapeHTML(this.value));break;case"input":this._getDomValue(!0),this._updateDomValue();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getSelection();break;case"click":(e.ctrlKey||!this.editable.value)&&i.isUrl(this.value)&&window.open(this.value,"_blank");break;case"keyup":this._getDomValue(!0),this._updateDomValue();break;case"cut":case"paste":setTimeout(function(){r._getDomValue(!0),r._updateDomValue()},1)}var c=s.field;if(o==c)switch(n){case"focus":t=this;break;case"blur":case"change":this._getDomField(!0),this._updateDomField(),this.field&&(c.innerHTML=this._escapeHTML(this.field));break;case"input":this._getDomField(!0),this._updateDomField();break;case"keydown":case"mousedown":this.editor.selection=this.editor.getSelection();break;case"keyup":this._getDomField(!0),this._updateDomField();break;case"cut":case"paste":setTimeout(function(){r._getDomField(!0),r._updateDomField()},1)}var u=s.tree;if(o==u.parentNode)switch(n){case"click":var p=void 0!=e.offsetX?e.offsetX<24*(this.getLevel()+1):e.pageXn[i]?t:e[i]/g,">").replace(/ /g,"  ").replace(/^ /," ").replace(/ $/," "),i=JSON.stringify(t);return i.substring(1,i.length-1)},n.prototype._unescapeHTML=function(e){var t='"'+this._escapeJSON(e)+'"',n=i.parse(t);return n.replace(/</g,"<").replace(/>/g,">").replace(/ |\u00A0/g," ")},n.prototype._escapeJSON=function(e){for(var t="",i=0,n=e.length;n>i;){var o=e.charAt(i);"\n"==o?t+="\\n":"\\"==o?(t+=o,i++,o=e.charAt(i),-1=='"\\/bfnrtu'.indexOf(o)&&(t+="\\"),t+=o):t+='"'==o?'\\"':o,i++}return t};var o=t(n);return n}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(e,t,i){var n,o;n=[i(9)],o=function(e){function t(t,i,n){function o(e){t.setMode(e);var i=t.dom&&t.dom.modeBox;i&&i.focus()}for(var s={code:{text:"Code",title:"Switch to code highlighter",click:function(){o("code")}},form:{text:"Form",title:"Switch to form editor",click:function(){o("form")}},text:{text:"Text",title:"Switch to plain text editor",click:function(){o("text")}},tree:{text:"Tree",title:"Switch to tree editor",click:function(){o("tree")}},view:{text:"View",title:"Switch to tree view",click:function(){o("view")}}},r=[],a=0;a',a.appendChild(c),o.submenuTitle&&(c.title=o.submenuTitle),l=c}else{var u=document.createElement("div");u.className="expand",d.appendChild(u),l=d}l.onclick=function(){n._onExpandItem(r),l.focus()};var p=[];r.subItems=p;var f=document.createElement("ul");r.ul=f,f.className="menu",f.style.height="0",a.appendChild(f),i(f,p,o.submenu)}else d.innerHTML='
'+o.text;t.push(r)}})}this.dom={};var n=this,o=this.dom;this.anchor=void 0,this.items=e,this.eventListeners={},this.selection=void 0,this.visibleSubmenu=void 0,this.onClose=t?t.close:void 0;var s=document.createElement("div");s.className="jsoneditor-contextmenu",o.menu=s;var r=document.createElement("ul");r.className="menu",s.appendChild(r),o.list=r,o.items=[];var a=document.createElement("button");o.focusButton=a;var d=document.createElement("li");d.style.overflow="hidden",d.style.height="0",d.appendChild(a),r.appendChild(d),i(r,this.dom.items,e),this.maxHeight=0,e.forEach(function(t){var i=24*(e.length+(t.submenu?t.submenu.length:0));n.maxHeight=Math.max(n.maxHeight,i)})}return t.prototype._getVisibleButtons=function(){var e=[],t=this;return this.dom.items.forEach(function(i){e.push(i.button),i.buttonExpand&&e.push(i.buttonExpand),i.subItems&&i==t.expandedItem&&i.subItems.forEach(function(t){e.push(t.button),t.buttonExpand&&e.push(t.buttonExpand)})}),e},t.visibleMenu=void 0,t.prototype.show=function(i){this.hide();var n=window.innerHeight,o=window.pageYOffset||document.scrollTop||0,s=n+o,r=i.offsetHeight,a=this.maxHeight,d=e.getAbsoluteLeft(i),h=e.getAbsoluteTop(i);s>h+r+a?(this.dom.menu.style.left=d+"px",this.dom.menu.style.top=h+r+"px",this.dom.menu.style.bottom=""):(this.dom.menu.style.left=d+"px",this.dom.menu.style.top="",this.dom.menu.style.bottom=n-h+"px"),document.body.appendChild(this.dom.menu);var l=this,c=this.dom.list;this.eventListeners.mousedown=e.addEventListener(document,"mousedown",function(e){var t=e.target;t==c||l._isChildOf(t,c)||(l.hide(),e.stopPropagation(),e.preventDefault())}),this.eventListeners.mousewheel=e.addEventListener(document,"mousewheel",function(e){e.stopPropagation(),e.preventDefault()}),this.eventListeners.keydown=e.addEventListener(document,"keydown",function(e){l._onKeyDown(e)}),this.selection=e.getSelection(),this.anchor=i,setTimeout(function(){l.dom.focusButton.focus()},0),t.visibleMenu&&t.visibleMenu.hide(),t.visibleMenu=this},t.prototype.hide=function(){this.dom.menu.parentNode&&(this.dom.menu.parentNode.removeChild(this.dom.menu),this.onClose&&this.onClose());for(var i in this.eventListeners)if(this.eventListeners.hasOwnProperty(i)){var n=this.eventListeners[i];n&&e.removeEventListener(document,i,n),delete this.eventListeners[i]}t.visibleMenu==this&&(t.visibleMenu=void 0)},t.prototype._onExpandItem=function(t){var i=this,n=t==this.expandedItem,o=this.expandedItem;if(o&&(o.ul.style.height="0",o.ul.style.padding="",setTimeout(function(){i.expandedItem!=o&&(o.ul.style.display="",e.removeClassName(o.ul.parentNode,"selected"))},300),this.expandedItem=void 0),!n){var s=t.ul;s.style.display="block";{s.clientHeight}setTimeout(function(){i.expandedItem==t&&(s.style.height=24*s.childNodes.length+"px",s.style.padding="5px 10px")},0),e.addClassName(s.parentNode,"selected"),this.expandedItem=t}},t.prototype._onKeyDown=function(t){var i,n,o,s,r=t.target,a=t.which,d=!1;27==a?(this.selection&&e.setSelection(this.selection),this.anchor&&this.anchor.focus(),this.hide(),d=!0):9==a?t.shiftKey?(i=this._getVisibleButtons(),n=i.indexOf(r),0==n&&(i[i.length-1].focus(),d=!0)):(i=this._getVisibleButtons(),n=i.indexOf(r),n==i.length-1&&(i[0].focus(),d=!0)):37==a?("expand"==r.className&&(i=this._getVisibleButtons(),n=i.indexOf(r),o=i[n-1],o&&o.focus()),d=!0):38==a?(i=this._getVisibleButtons(),n=i.indexOf(r),o=i[n-1],o&&"expand"==o.className&&(o=i[n-2]),o||(o=i[i.length-1]),o&&o.focus(),d=!0):39==a?(i=this._getVisibleButtons(),n=i.indexOf(r),s=i[n+1],s&&"expand"==s.className&&s.focus(),d=!0):40==a&&(i=this._getVisibleButtons(),n=i.indexOf(r),s=i[n+1],s&&"expand"==s.className&&(s=i[n+2]),s||(s=i[0]),s&&(s.focus(),d=!0),d=!0),d&&(t.stopPropagation(),t.preventDefault())},t.prototype._isChildOf=function(e,t){for(var i=e.parentNode;i;){if(i==t)return!0;i=i.parentNode}return!1},t}.apply(t,n),!(void 0!==o&&(e.exports=o))},function(e,t,i){var n,o;n=[i(9),i(3)],o=function(e,t){function i(i){function n(e){this.editor=e,this.dom={}}return n.prototype=new i,n.prototype.getDom=function(){var e=this.dom;if(e.tr)return e.tr;this._updateEditability();var t=document.createElement("tr");if(t.node=this,e.tr=t,this.editable.field){e.tdDrag=document.createElement("td");var i=document.createElement("td");e.tdMenu=i;var n=document.createElement("button");n.className="contextmenu",n.title="Click to open the actions menu (Ctrl+M)",e.menu=n,i.appendChild(e.menu)}var o=document.createElement("td"),s=document.createElement("div");return s.innerHTML="(empty)",s.className="readonly",o.appendChild(s),e.td=o,e.text=s,this.updateDom(),t},n.prototype.updateDom=function(){var e=this.dom,t=e.td;t&&(t.style.paddingLeft=24*this.getLevel()+26+"px");var i=e.text;i&&(i.innerHTML="(empty "+this.parent.type+")");var n=e.tr;this.isVisible()?e.tr.firstChild||(e.tdDrag&&n.appendChild(e.tdDrag),e.tdMenu&&n.appendChild(e.tdMenu),n.appendChild(t)):e.tr.firstChild&&(e.tdDrag&&n.removeChild(e.tdDrag),e.tdMenu&&n.removeChild(e.tdMenu),n.removeChild(t))},n.prototype.isVisible=function(){return 0==this.parent.childs.length},n.prototype.showContextMenu=function(t,n){var o=this,s=i.TYPE_TITLES,r=[{text:"Append",title:"Append a new field with type 'auto' (Ctrl+Shift+Ins)",submenuTitle:"Select the type of the field to be appended",className:"insert",click:function(){o._onAppend("","","auto")},submenu:[{text:"Auto",className:"type-auto",title:s.auto,click:function(){o._onAppend("","","auto")}},{text:"Array",className:"type-array",title:s.array,click:function(){o._onAppend("",[])}},{text:"Object",className:"type-object",title:s.object,click:function(){o._onAppend("",{})}},{text:"String",className:"type-string",title:s.string,click:function(){o._onAppend("","","string")}}]}],a=new e(r,{close:n});a.show(t)},n.prototype.onEvent=function(e){var i=e.type,n=e.target||e.srcElement,o=this.dom,s=o.menu;if(n==s&&("mouseover"==i?this.editor.highlighter.highlight(this.parent):"mouseout"==i&&this.editor.highlighter.unhighlight()),"click"==i&&n==o.menu){var r=this.editor.highlighter;r.highlight(this.parent),r.lock(),t.addClassName(o.menu,"selected"),this.showContextMenu(o.menu,function(){t.removeClassName(o.menu,"selected"),r.unlock(),r.unhighlight()})}"keydown"==i&&this.onKeyDown(e)},n}return i}.apply(t,n),!(void 0!==o&&(e.exports=o))}])}); //# sourceMappingURL=jsoneditor.map \ No newline at end of file diff --git a/src/js/History.js b/src/js/History.js index 72da3f8e5..416137073 100644 --- a/src/js/History.js +++ b/src/js/History.js @@ -170,6 +170,7 @@ define(['./util'], function (util) { /** * Undo the last action + * @returns applied history entry see {@link #add} */ History.prototype.undo = function () { if (this.canUndo()) { @@ -191,10 +192,12 @@ define(['./util'], function (util) { // fire onchange event this.onChange(); } + return obj || null; }; /** * Redo the last action + * @returns applied history entry see {@link #add} */ History.prototype.redo = function () { if (this.canRedo()) { @@ -217,6 +220,7 @@ define(['./util'], function (util) { // fire onchange event this.onChange(); } + return obj || null; }; return History; diff --git a/src/js/treemode.js b/src/js/treemode.js index 1467f148b..f9018663e 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -270,7 +270,7 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', // trigger the onChange callback if (this.options.change) { try { - this.options.change(); + this.options.change(action, params); } catch (err) { util.log('Error in change callback: ', err); @@ -549,11 +549,10 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', treemode._onUndo = function () { if (this.history) { // undo last action - this.history.undo(); - - // trigger change callback - if (this.options.change) { - this.options.change(); + var historyEntry = this.history.undo(); + // trigger change callback if anything have changed + if (this.options.change && historyEntry) { + this.options.change(historyEntry.action, historyEntry.params); } } }; @@ -565,11 +564,10 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', treemode._onRedo = function () { if (this.history) { // redo last action - this.history.redo(); - - // trigger change callback - if (this.options.change) { - this.options.change(); + var historyEntry = this.history.redo(); + // trigger change callback if anything have changed + if (this.options.change && historyEntry) { + this.options.change(historyEntry.action, historyEntry.params); } } }; From 0ce73abcc87f3c7047ce1ac362983546d11ad112 Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Sat, 18 Oct 2014 02:46:56 +0200 Subject: [PATCH 4/9] Pass the change callback arguments in JSON-Patch format --- src/js/treemode.js | 105 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 102 insertions(+), 3 deletions(-) diff --git a/src/js/treemode.js b/src/js/treemode.js index f9018663e..279b62c73 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -270,7 +270,7 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', // trigger the onChange callback if (this.options.change) { try { - this.options.change(action, params); + this.options.change(translateChangeToJSONPatch(action, params)); } catch (err) { util.log('Error in change callback: ', err); @@ -552,7 +552,9 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', var historyEntry = this.history.undo(); // trigger change callback if anything have changed if (this.options.change && historyEntry) { - this.options.change(historyEntry.action, historyEntry.params); + this.options.change( + translateChangeToJSONPatch(historyEntry.action, historyEntry.params) + ); } } }; @@ -567,7 +569,9 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', var historyEntry = this.history.redo(); // trigger change callback if anything have changed if (this.options.change && historyEntry) { - this.options.change(historyEntry.action, historyEntry.params); + this.options.change( + translateChangeToJSONPatch(historyEntry.action, historyEntry.params) + ); } } }; @@ -691,6 +695,101 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', this.frame.appendChild(contentOuter); }; + /** + * Translate our internal change info into JSON-Patch format + * @see http://tools.ietf.org/html/rfc6902 + * @param {String} action JSONEditor action + * @param {Object} params JSONEditor params + * @return {Object} single JSON-Patch entry + */ + function translateChangeToJSONPatch(action, params){ + /** + * Get path to node in JSON Pointer format + * (http://tools.ietf.org/html/rfc6901) + * _Almost_ like params.node.path().join("/") + * @param {Node} node jsoneditor node in question + * @returns {String} path + */ + function JSONPointer(node){ + var path = ""; + while (node) { + var field = node.field != undefined ? node.field : node.index; + switch(typeof field){ + case "string": + path = "/" + escapePathComponent(field) + path; + break; + case "number": + path = "/" + field + path; + break; + } + node = node.parent; + } + return path; + + } + /** + * Escape `/` and `~`, according to JSON-Pointer rules. + * @param {String} str string to escape + * @returns {String} escaped string + */ + function escapePathComponent(str) { + if (str.indexOf('/') === -1 && str.indexOf('~') === -1) + return str; + return str.replace(/~/g, '~0').replace(/\//g, '~1'); + } + var patch; + switch(action){ + case "duplicateNode": + console.warn("duplicateNode->copy Is not supported yet, as currently new node with same name is created, what violates JSON-Patch"); + break; + case "changeType": + console.warn("changeType->replace may behave strange, as even if new node is created with specified type, its `node.value==\"\"`") + patch = { + op: "replace", + path: JSONPointer(params.node), + value: params.node.value + } + break; + case "editValue": + patch = { + op: "replace", + path: JSONPointer(params.node), + value: params.newValue + } + break; + case "removeNode": + patch = { + op: "remove", + path: JSONPointer(params.node) + } + break; + case "insertBeforeNode": + case "appendNode": + patch = { + op: "add", + path: JSONPointer(params.node), + value: params.node.value + } + break; + case "moveNode": + if(params.startParent !== params.endParent){ + patch = { + op: "move", + from: JSONPointer(params.startParent) + "/" + params.node.field, + path: JSONPointer(params.node) + } + } + break; + case "editField": + patch = { + op: "move", + from: JSONPointer(params.node.parent) + "/" + params.oldValue, + path: JSONPointer(params.node) + } + break; + } + return patch; + } // define modes return [ { From 661bfc91683ab51e61e8d11735128822fbd1ebb8 Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Sat, 18 Oct 2014 02:58:54 +0200 Subject: [PATCH 5/9] Add warns and comments about missing JSON-Patch features --- src/js/treemode.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/js/treemode.js b/src/js/treemode.js index 279b62c73..2c6d9c636 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -765,6 +765,8 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', break; case "insertBeforeNode": case "appendNode": + console.warn("insertBeforeNode,appendNode->add may behave strange, as even if new node is created with specified type, its `node.value==\"\"`", + "also when inserting item into an array, new path is given, and there is no info about previous indexes, so it's hard to distinguish whether to use `-`, old index, or if it is not an array item, so we should stick to the given path"); patch = { op: "add", path: JSONPointer(params.node), @@ -772,6 +774,7 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', } break; case "moveNode": + console.warn("moveNode->move Still does not cover moving array items, as their name was already changed to `\"\"` which is fully valid object key, so we cannot distinguish it"); if(params.startParent !== params.endParent){ patch = { op: "move", From b6340a030a0e09085e697c0cf029aae265481892 Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Wed, 22 Oct 2014 23:54:01 +0200 Subject: [PATCH 6/9] Do not consider root object name as it's path in JSON-Patch --- src/js/treemode.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/js/treemode.js b/src/js/treemode.js index 2c6d9c636..612b1f5f5 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -712,7 +712,7 @@ define(['./Highlighter', './History', './SearchBox', './Node', './modeswitcher', */ function JSONPointer(node){ var path = ""; - while (node) { + while (node.parent) { var field = node.field != undefined ? node.field : node.index; switch(typeof field){ case "string": From 4bf0c2928c904f0be0dae8138dafe263516ce754 Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Mon, 10 Nov 2014 00:31:09 +0100 Subject: [PATCH 7/9] Add JSONPatch support in textmode --- src/js/textmode.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/js/textmode.js b/src/js/textmode.js index 0d2147f60..aa6e78695 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -130,7 +130,7 @@ define(['./modeswitcher', './util'], function (modeswitcher, util) { if (options.change) { // register onchange event editor.on('change', function () { - options.change(); + options.change(replaceRootJSONPatch(me)); }); } } @@ -146,13 +146,13 @@ define(['./modeswitcher', './util'], function (modeswitcher, util) { // register onchange event if (this.textarea.oninput === null) { this.textarea.oninput = function () { - options.change(); + options.change(replaceRootJSONPatch(me)); } } else { // oninput is undefined. For IE8- this.textarea.onchange = function () { - options.change(); + options.change(replaceRootJSONPatch(me)); } } } @@ -272,6 +272,14 @@ define(['./modeswitcher', './util'], function (modeswitcher, util) { } }; + function replaceRootJSONPatch(textmode){ + return { + op: "replace", + path: "", + value: textmode.get() + } + } + // define modes return [ { From f6bca2949d1f2a27bd45c4a55f612dd8a4481c47 Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Mon, 8 Jun 2015 22:13:02 +0200 Subject: [PATCH 8/9] Add some test for JSON Patch in change callback --- package.json | 4 +- src/js/treemode.js | 8 +- test/change.JSONPatch.test.js | 238 ++++++++++++++++++++++++++++++++++ test/index.html | 24 ++++ 4 files changed, 271 insertions(+), 3 deletions(-) create mode 100644 test/change.JSONPatch.test.js create mode 100644 test/index.html diff --git a/package.json b/package.json index 19bda3093..940ef1690 100644 --- a/package.json +++ b/package.json @@ -25,13 +25,15 @@ "jsonlint": "josdejong/jsonlint#85a19d7" }, "devDependencies": { + "chai": "^3.0.0", + "chai-spies": "^0.6.0", "gulp": "^3.8.11", "gulp-concat-css": "^2.0.0", "gulp-minify-css": "^0.4.5", "gulp-shell": "^0.3.0", "gulp-util": "^3.0.3", "mkdirp": "^0.5.0", - "mocha": "^2.1.0", + "mocha": "^2.2.5", "uglify-js": "^2.4.16", "webpack": "^1.5.3" } diff --git a/src/js/treemode.js b/src/js/treemode.js index c9a746761..39c0d4583 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -774,7 +774,7 @@ treemode.focus = function () { console.warn("duplicateNode->copy Is not supported yet, as currently new node with same name is created, what violates JSON-Patch"); break; case "changeType": - console.warn("changeType->replace may behave strange, as even if new node is created with specified type, its `node.value==\"\"`") + (params.node.type == "array" || params.node.type == "object") && console.warn("changeType->replace may behave strange, as even if new node is created with specified type, its `node.value==\"\"`") patch = { op: "replace", path: JSONPointer(params.node), @@ -794,6 +794,7 @@ treemode.focus = function () { path: JSONPointer(params.node) } break; + case "insertAfterNode": case "insertBeforeNode": case "appendNode": console.warn("insertBeforeNode,appendNode->add may behave strange, as even if new node is created with specified type, its `node.value==\"\"`", @@ -821,6 +822,9 @@ treemode.focus = function () { path: JSONPointer(params.node) } break; + case "sort": + // no changes to the JSON itself + break; } return patch; } @@ -841,4 +845,4 @@ module.exports = [ mixin: treemode, data: 'json' } -]; \ No newline at end of file +]; diff --git a/test/change.JSONPatch.test.js b/test/change.JSONPatch.test.js new file mode 100644 index 000000000..1d0e54e26 --- /dev/null +++ b/test/change.JSONPatch.test.js @@ -0,0 +1,238 @@ +// var assert = require('assert'); +// var util = require('../src/js/util'); + +// var chai = require('chai') +// , spies = require('chai-spies'); +// chai.use(spies); + +var assert = chai.assert; +var expect = chai.expect; + +describe('@change', function () { + + context('should return JSON Patch', function(){ + var container, editor, json, changeSpy; + beforeEach(function(){ + container = document.createElement("div"); + document.body.appendChild(container); + changeSpy = chai.spy(); + editor = new JSONEditor(container,{ + change: changeSpy + }); + json = { + "Array": [1, 2, 3], + "Boolean": true, + "Null": null, + "Number": 123, + "Object": {"a": "b", "c": "d"}, + "String": "Hello World" + }; + editor.set(json); + }); + afterEach(function(){ + container && container.parentElement && container.parentElement.removeChild(container); + }) + + context('when changes value', function () { + it('from Boolean, replace', function () { + var valueField = container.querySelectorAll("[contenteditable=true][class=value]")[0]; + valueField.textContent = "false"; + valueField.dispatchEvent(new Event("blur")); + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Boolean",value: false}); + }); + + it('from null, replace', function () { + var valueField = container.querySelectorAll("[contenteditable=true][class=value]")[1]; + valueField.textContent = "notNull"; + valueField.dispatchEvent(new Event("blur")); + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Null",value: "notNull"}); + }); + + it('from Number, replace', function () { + var valueField = container.querySelectorAll("[contenteditable=true][class=value]")[2]; + valueField.textContent = "1234"; + valueField.dispatchEvent(new Event("blur")); + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Number",value: 1234}); + }); + + it('from String, replace', function () { + var valueField = container.querySelectorAll("[contenteditable=true][class=value]")[3]; + valueField.textContent = "Hello JSON Patch"; + valueField.dispatchEvent(new Event("blur")); + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/String",value: "Hello JSON Patch"}); + }); + + }); + + context('when changes type', function () { + + context('from Array', function () { + it('to String, replace', function () { + editor.node.childs[0]._onChangeType("string"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Array",value: ""}); + }); + it('to Object, replace (pending)', function () { + editor.node.childs[0]._onChangeType("object"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Array",value: {"":3}}); + }); + + }); // EO Array + + context('from Boolean', function () { + it('to String, replace', function () { + editor.node.childs[1]._onChangeType("string"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Boolean",value: "true"}); + }); + it('to Object, replace (pending)', function () { + editor.node.childs[1]._onChangeType("object"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Boolean",value: {}}); + }); + it('to Array, replace (pending)', function () { + editor.node.childs[1]._onChangeType("array"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Boolean",value: []}); + }); + + }); // EO Boolean + + context('from Null', function () { + it('to String, replace', function () { + editor.node.childs[2]._onChangeType("string"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Null",value: "null"}); + }); + it('to Object, replace (pending)', function () { + editor.node.childs[2]._onChangeType("object"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Null",value: {}}); + }); + it('to Array, replace (pending)', function () { + editor.node.childs[2]._onChangeType("array"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Null",value: []}); + }); + + }); // EO Null + + context('from Number', function () { + it('to String, replace', function () { + editor.node.childs[3]._onChangeType("string"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Number",value: "123"}); + }); + it('to Object, replace (pending)', function () { + editor.node.childs[3]._onChangeType("object"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Number",value: {}}); + }); + it('to Array, replace (pending)', function () { + editor.node.childs[3]._onChangeType("array"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Number",value: []}); + }); + + }); // EO Number + + context('from Object', function () { + it('to String, replace', function () { + editor.node.childs[4]._onChangeType("string"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Object",value: ""}); + }); + it('to Array, replace (pending)', function () { + editor.node.childs[4]._onChangeType("array"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/Object",value: ["b","d"]}); + }); + + }); // EO Object + + context('from String', function () { + it('to Object, replace (pending)', function () { + editor.node.childs[5]._onChangeType("object"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/String",value: {}}); + }); + it('to Array, replace (pending)', function () { + editor.node.childs[5]._onChangeType("array"); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "replace",path: "/String",value: []}); + }); + + }); // EO String + });// EO change type + + context('when removes a node', function () { + + it('from Array, remove', function () { + editor.node.childs[0].childs[1]._onRemove(); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "remove",path: "/Array/1"}); + }); + it('from Object, remove', function () { + editor.node.childs[1]._onRemove(); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "remove",path: "/Boolean"}); + }); + });// EO remove node + + context('when edits a node\'s key', function () { + + it('move', function () { + var keyField = container.querySelectorAll("[contenteditable=true][class=field]")[0]; + keyField.innerText = "newArray"; + keyField.dispatchEvent(new Event("blur")); + + expect(changeSpy).to.have.been.called(); + expect(changeSpy).to.have.been.called.once; + expect(changeSpy).to.have.been.called.with({op: "move", from: "/Array", path: "/newArray"}); + }); + });// EO edit + }); +}); diff --git a/test/index.html b/test/index.html new file mode 100644 index 000000000..3e9e4ccfe --- /dev/null +++ b/test/index.html @@ -0,0 +1,24 @@ + + + + Mocha + + + + + +
+ + + + + + + + + + + + From f4186b149cf7477ec0d4aeb5a5b32f5ccbed0c9b Mon Sep 17 00:00:00 2001 From: Tomek Wytrebowicz Date: Mon, 8 Jun 2015 22:37:09 +0200 Subject: [PATCH 9/9] Fix indentations --- src/js/History.js | 398 ++++++------ src/js/textmode.js | 506 +++++++-------- src/js/treemode.js | 1458 ++++++++++++++++++++++---------------------- 3 files changed, 1182 insertions(+), 1180 deletions(-) diff --git a/src/js/History.js b/src/js/History.js index 53a9e442a..6ebddcd7f 100644 --- a/src/js/History.js +++ b/src/js/History.js @@ -1,226 +1,226 @@ var util = require('./util'); - /** - * @constructor History - * Store action history, enables undo and redo - * @param {JSONEditor} editor - */ - function History (editor) { - this.editor = editor; - this.clear(); - - // map with all supported actions - this.actions = { - 'editField': { - 'undo': function (params) { - params.node.updateField(params.oldValue); - }, - 'redo': function (params) { - params.node.updateField(params.newValue); - } +/** + * @constructor History + * Store action history, enables undo and redo + * @param {JSONEditor} editor + */ +function History (editor) { + this.editor = editor; + this.clear(); + + // map with all supported actions + this.actions = { + 'editField': { + 'undo': function (params) { + params.node.updateField(params.oldValue); }, - 'editValue': { - 'undo': function (params) { - params.node.updateValue(params.oldValue); - }, - 'redo': function (params) { - params.node.updateValue(params.newValue); - } + 'redo': function (params) { + params.node.updateField(params.newValue); + } + }, + 'editValue': { + 'undo': function (params) { + params.node.updateValue(params.oldValue); }, - 'appendNode': { - 'undo': function (params) { - params.parent.removeChild(params.node); - }, - 'redo': function (params) { - params.parent.appendChild(params.node); - } + 'redo': function (params) { + params.node.updateValue(params.newValue); + } + }, + 'appendNode': { + 'undo': function (params) { + params.parent.removeChild(params.node); }, - 'insertBeforeNode': { - 'undo': function (params) { - params.parent.removeChild(params.node); - }, - 'redo': function (params) { - params.parent.insertBefore(params.node, params.beforeNode); - } + 'redo': function (params) { + params.parent.appendChild(params.node); + } + }, + 'insertBeforeNode': { + 'undo': function (params) { + params.parent.removeChild(params.node); }, - 'insertAfterNode': { - 'undo': function (params) { - params.parent.removeChild(params.node); - }, - 'redo': function (params) { - params.parent.insertAfter(params.node, params.afterNode); - } + 'redo': function (params) { + params.parent.insertBefore(params.node, params.beforeNode); + } + }, + 'insertAfterNode': { + 'undo': function (params) { + params.parent.removeChild(params.node); }, - 'removeNode': { - 'undo': function (params) { - var parent = params.parent; - var beforeNode = parent.childs[params.index] || parent.append; - parent.insertBefore(params.node, beforeNode); - }, - 'redo': function (params) { - params.parent.removeChild(params.node); - } + 'redo': function (params) { + params.parent.insertAfter(params.node, params.afterNode); + } + }, + 'removeNode': { + 'undo': function (params) { + var parent = params.parent; + var beforeNode = parent.childs[params.index] || parent.append; + parent.insertBefore(params.node, beforeNode); }, - 'duplicateNode': { - 'undo': function (params) { - params.parent.removeChild(params.clone); - }, - 'redo': function (params) { - params.parent.insertAfter(params.clone, params.node); - } + 'redo': function (params) { + params.parent.removeChild(params.node); + } + }, + 'duplicateNode': { + 'undo': function (params) { + params.parent.removeChild(params.clone); }, - 'changeType': { - 'undo': function (params) { - params.node.changeType(params.oldType); - }, - 'redo': function (params) { - params.node.changeType(params.newType); - } + 'redo': function (params) { + params.parent.insertAfter(params.clone, params.node); + } + }, + 'changeType': { + 'undo': function (params) { + params.node.changeType(params.oldType); }, - 'moveNode': { - 'undo': function (params) { - params.startParent.moveTo(params.node, params.startIndex); - }, - 'redo': function (params) { - params.endParent.moveTo(params.node, params.endIndex); - } + 'redo': function (params) { + params.node.changeType(params.newType); + } + }, + 'moveNode': { + 'undo': function (params) { + params.startParent.moveTo(params.node, params.startIndex); }, - 'sort': { - 'undo': function (params) { - var node = params.node; - node.hideChilds(); - node.sort = params.oldSort; - node.childs = params.oldChilds; - node.showChilds(); - }, - 'redo': function (params) { - var node = params.node; - node.hideChilds(); - node.sort = params.newSort; - node.childs = params.newChilds; - node.showChilds(); - } + 'redo': function (params) { + params.endParent.moveTo(params.node, params.endIndex); + } + }, + 'sort': { + 'undo': function (params) { + var node = params.node; + node.hideChilds(); + node.sort = params.oldSort; + node.childs = params.oldChilds; + node.showChilds(); + }, + 'redo': function (params) { + var node = params.node; + node.hideChilds(); + node.sort = params.newSort; + node.childs = params.newChilds; + node.showChilds(); } - - // TODO: restore the original caret position and selection with each undo - // TODO: implement history for actions "expand", "collapse", "scroll", "setDocument" - }; - } - - /** - * The method onChange is executed when the History is changed, and can - * be overloaded. - */ - History.prototype.onChange = function () {}; - - /** - * Add a new action to the history - * @param {String} action The executed action. Available actions: "editField", - * "editValue", "changeType", "appendNode", - * "removeNode", "duplicateNode", "moveNode" - * @param {Object} params Object containing parameters describing the change. - * The parameters in params depend on the action (for - * example for "editValue" the Node, old value, and new - * value are provided). params contains all information - * needed to undo or redo the action. - */ - History.prototype.add = function (action, params) { - this.index++; - this.history[this.index] = { - 'action': action, - 'params': params, - 'timestamp': new Date() - }; - - // remove redo actions which are invalid now - if (this.index < this.history.length - 1) { - this.history.splice(this.index + 1, this.history.length - this.index - 1); } - // fire onchange event - this.onChange(); + // TODO: restore the original caret position and selection with each undo + // TODO: implement history for actions "expand", "collapse", "scroll", "setDocument" }; - - /** - * Clear history - */ - History.prototype.clear = function () { - this.history = []; - this.index = -1; - - // fire onchange event - this.onChange(); +} + +/** + * The method onChange is executed when the History is changed, and can + * be overloaded. + */ +History.prototype.onChange = function () {}; + +/** + * Add a new action to the history + * @param {String} action The executed action. Available actions: "editField", + * "editValue", "changeType", "appendNode", + * "removeNode", "duplicateNode", "moveNode" + * @param {Object} params Object containing parameters describing the change. + * The parameters in params depend on the action (for + * example for "editValue" the Node, old value, and new + * value are provided). params contains all information + * needed to undo or redo the action. + */ +History.prototype.add = function (action, params) { + this.index++; + this.history[this.index] = { + 'action': action, + 'params': params, + 'timestamp': new Date() }; - /** - * Check if there is an action available for undo - * @return {Boolean} canUndo - */ - History.prototype.canUndo = function () { - return (this.index >= 0); - }; - - /** - * Check if there is an action available for redo - * @return {Boolean} canRedo - */ - History.prototype.canRedo = function () { - return (this.index < this.history.length - 1); - }; + // remove redo actions which are invalid now + if (this.index < this.history.length - 1) { + this.history.splice(this.index + 1, this.history.length - this.index - 1); + } - /** - * Undo the last action - * @returns applied history entry see {@link #add} - */ - History.prototype.undo = function () { - if (this.canUndo()) { - var obj = this.history[this.index]; - if (obj) { - var action = this.actions[obj.action]; - if (action && action.undo) { - action.undo(obj.params); - if (obj.params.oldSelection) { - this.editor.setSelection(obj.params.oldSelection); - } - } - else { - util.log('Error: unknown action "' + obj.action + '"'); + // fire onchange event + this.onChange(); +}; + +/** + * Clear history + */ +History.prototype.clear = function () { + this.history = []; + this.index = -1; + + // fire onchange event + this.onChange(); +}; + +/** + * Check if there is an action available for undo + * @return {Boolean} canUndo + */ +History.prototype.canUndo = function () { + return (this.index >= 0); +}; + +/** + * Check if there is an action available for redo + * @return {Boolean} canRedo + */ +History.prototype.canRedo = function () { + return (this.index < this.history.length - 1); +}; + +/** + * Undo the last action + * @returns applied history entry see {@link #add} + */ +History.prototype.undo = function () { + if (this.canUndo()) { + var obj = this.history[this.index]; + if (obj) { + var action = this.actions[obj.action]; + if (action && action.undo) { + action.undo(obj.params); + if (obj.params.oldSelection) { + this.editor.setSelection(obj.params.oldSelection); } } - this.index--; - - // fire onchange event - this.onChange(); + else { + util.log('Error: unknown action "' + obj.action + '"'); + } } - return obj || null; - }; + this.index--; - /** - * Redo the last action - * @returns applied history entry see {@link #add} - */ - History.prototype.redo = function () { - if (this.canRedo()) { - this.index++; - - var obj = this.history[this.index]; - if (obj) { - var action = this.actions[obj.action]; - if (action && action.redo) { - action.redo(obj.params); - if (obj.params.newSelection) { - this.editor.setSelection(obj.params.newSelection); - } - } - else { - util.log('Error: unknown action "' + obj.action + '"'); + // fire onchange event + this.onChange(); + } + return obj || null; +}; + +/** + * Redo the last action + * @returns applied history entry see {@link #add} + */ +History.prototype.redo = function () { + if (this.canRedo()) { + this.index++; + + var obj = this.history[this.index]; + if (obj) { + var action = this.actions[obj.action]; + if (action && action.redo) { + action.redo(obj.params); + if (obj.params.newSelection) { + this.editor.setSelection(obj.params.newSelection); } } - - // fire onchange event - this.onChange(); + else { + util.log('Error: unknown action "' + obj.action + '"'); + } } - return obj || null; - }; + + // fire onchange event + this.onChange(); + } + return obj || null; +}; module.exports = History; diff --git a/src/js/textmode.js b/src/js/textmode.js index 29b6f9613..3d006b01a 100644 --- a/src/js/textmode.js +++ b/src/js/textmode.js @@ -9,181 +9,181 @@ catch (err) { var modeswitcher = require('./modeswitcher'); var util = require('./util'); - // create a mixin with the functions for text mode - var textmode = {}; - - /** - * Create a text editor - * @param {Element} container - * @param {Object} [options] Object with options. available options: - * {String} mode Available values: - * "text" (default) - * or "code". - * {Number} indentation Number of indentation - * spaces. 2 by default. - * {function} change Callback method - * triggered on change +// create a mixin with the functions for text mode +var textmode = {}; + +/** + * Create a text editor + * @param {Element} container + * @param {Object} [options] Object with options. available options: + * {String} mode Available values: + * "text" (default) + * or "code". + * {Number} indentation Number of indentation + * spaces. 2 by default. + * {function} change Callback method + * triggered on change * {Object} ace A custom instance of * Ace editor. - * @private - */ - textmode.create = function (container, options) { - // read options - options = options || {}; - this.options = options; + * @private + */ +textmode.create = function (container, options) { + // read options + options = options || {}; + this.options = options; // indentation - if (options.indentation) { - this.indentation = Number(options.indentation); - } - else { - this.indentation = 2; // number of spaces - } + if (options.indentation) { + this.indentation = Number(options.indentation); + } + else { + this.indentation = 2; // number of spaces + } // grab ace from options if provided var _ace = options.ace ? options.ace : ace; // determine mode - this.mode = (options.mode == 'code') ? 'code' : 'text'; - if (this.mode == 'code') { - // verify whether Ace editor is available and supported + this.mode = (options.mode == 'code') ? 'code' : 'text'; + if (this.mode == 'code') { + // verify whether Ace editor is available and supported if (typeof _ace === 'undefined') { - this.mode = 'text'; - util.log('WARNING: Cannot load code editor, Ace library not loaded. ' + - 'Falling back to plain text editor'); - } + this.mode = 'text'; + util.log('WARNING: Cannot load code editor, Ace library not loaded. ' + + 'Falling back to plain text editor'); } + } // determine theme this.theme = options.theme || 'ace/theme/jsoneditor'; - var me = this; - this.container = container; - this.dom = {}; - this.editor = undefined; // ace code editor - this.textarea = undefined; // plain text editor (fallback when Ace is not available) + var me = this; + this.container = container; + this.dom = {}; + this.editor = undefined; // ace code editor + this.textarea = undefined; // plain text editor (fallback when Ace is not available) - this.width = container.clientWidth; - this.height = container.clientHeight; + this.width = container.clientWidth; + this.height = container.clientHeight; - this.frame = document.createElement('div'); - this.frame.className = 'jsoneditor'; - this.frame.onclick = function (event) { - // prevent default submit action when the editor is located inside a form - event.preventDefault(); - }; + this.frame = document.createElement('div'); + this.frame.className = 'jsoneditor'; + this.frame.onclick = function (event) { + // prevent default submit action when the editor is located inside a form + event.preventDefault(); + }; this.frame.onkeydown = function (event) { me._onKeyDown(event); }; - // create menu - this.menu = document.createElement('div'); - this.menu.className = 'menu'; - this.frame.appendChild(this.menu); + // create menu + this.menu = document.createElement('div'); + this.menu.className = 'menu'; + this.frame.appendChild(this.menu); - // create format button - var buttonFormat = document.createElement('button'); - buttonFormat.className = 'format'; + // create format button + var buttonFormat = document.createElement('button'); + buttonFormat.className = 'format'; buttonFormat.title = 'Format JSON data, with proper indentation and line feeds (Ctrl+\\)'; - this.menu.appendChild(buttonFormat); - buttonFormat.onclick = function () { - try { - me.format(); - } - catch (err) { - me._onError(err); - } - }; + this.menu.appendChild(buttonFormat); + buttonFormat.onclick = function () { + try { + me.format(); + } + catch (err) { + me._onError(err); + } + }; - // create compact button - var buttonCompact = document.createElement('button'); - buttonCompact.className = 'compact'; + // create compact button + var buttonCompact = document.createElement('button'); + buttonCompact.className = 'compact'; buttonCompact.title = 'Compact JSON data, remove all whitespaces (Ctrl+Shift+\\)'; - this.menu.appendChild(buttonCompact); - buttonCompact.onclick = function () { - try { - me.compact(); - } - catch (err) { - me._onError(err); - } - }; - - // create mode box - if (this.options && this.options.modes && this.options.modes.length) { - var modeBox = modeswitcher.create(this, this.options.modes, this.options.mode); - this.menu.appendChild(modeBox); - this.dom.modeBox = modeBox; + this.menu.appendChild(buttonCompact); + buttonCompact.onclick = function () { + try { + me.compact(); + } + catch (err) { + me._onError(err); } + }; + + // create mode box + if (this.options && this.options.modes && this.options.modes.length) { + var modeBox = modeswitcher.create(this, this.options.modes, this.options.mode); + this.menu.appendChild(modeBox); + this.dom.modeBox = modeBox; + } - this.content = document.createElement('div'); - this.content.className = 'outer'; - this.frame.appendChild(this.content); + this.content = document.createElement('div'); + this.content.className = 'outer'; + this.frame.appendChild(this.content); - this.container.appendChild(this.frame); + this.container.appendChild(this.frame); - if (this.mode == 'code') { - this.editorDom = document.createElement('div'); - this.editorDom.style.height = '100%'; // TODO: move to css - this.editorDom.style.width = '100%'; // TODO: move to css - this.content.appendChild(this.editorDom); + if (this.mode == 'code') { + this.editorDom = document.createElement('div'); + this.editorDom.style.height = '100%'; // TODO: move to css + this.editorDom.style.width = '100%'; // TODO: move to css + this.content.appendChild(this.editorDom); var editor = _ace.edit(this.editorDom); editor.setTheme(this.theme); - editor.setShowPrintMargin(false); - editor.setFontSize(13); - editor.getSession().setMode('ace/mode/json'); + editor.setShowPrintMargin(false); + editor.setFontSize(13); + editor.getSession().setMode('ace/mode/json'); editor.getSession().setTabSize(this.indentation); - editor.getSession().setUseSoftTabs(true); - editor.getSession().setUseWrapMode(true); - this.editor = editor; - - var poweredBy = document.createElement('a'); - poweredBy.appendChild(document.createTextNode('powered by ace')); - poweredBy.href = 'http://ace.ajax.org'; - poweredBy.target = '_blank'; - poweredBy.className = 'poweredBy'; - poweredBy.onclick = function () { - // TODO: this anchor falls below the margin of the content, - // therefore the normal a.href does not work. We use a click event - // for now, but this should be fixed. - window.open(poweredBy.href, poweredBy.target); - }; - this.menu.appendChild(poweredBy); - - if (options.change) { - // register onchange event - editor.on('change', function () { - options.change(replaceRootJSONPatch(me)); - }); - } + editor.getSession().setUseSoftTabs(true); + editor.getSession().setUseWrapMode(true); + this.editor = editor; + + var poweredBy = document.createElement('a'); + poweredBy.appendChild(document.createTextNode('powered by ace')); + poweredBy.href = 'http://ace.ajax.org'; + poweredBy.target = '_blank'; + poweredBy.className = 'poweredBy'; + poweredBy.onclick = function () { + // TODO: this anchor falls below the margin of the content, + // therefore the normal a.href does not work. We use a click event + // for now, but this should be fixed. + window.open(poweredBy.href, poweredBy.target); + }; + this.menu.appendChild(poweredBy); + + if (options.change) { + // register onchange event + editor.on('change', function () { + options.change(replaceRootJSONPatch(me)); + }); } - else { - // load a plain text textarea - var textarea = document.createElement('textarea'); - textarea.className = 'text'; - textarea.spellcheck = false; - this.content.appendChild(textarea); - this.textarea = textarea; - - if (options.change) { - // register onchange event - if (this.textarea.oninput === null) { - this.textarea.oninput = function () { - options.change(replaceRootJSONPatch(me)); - } + } + else { + // load a plain text textarea + var textarea = document.createElement('textarea'); + textarea.className = 'text'; + textarea.spellcheck = false; + this.content.appendChild(textarea); + this.textarea = textarea; + + if (options.change) { + // register onchange event + if (this.textarea.oninput === null) { + this.textarea.oninput = function () { + options.change(replaceRootJSONPatch(me)); } - else { - // oninput is undefined. For IE8- - this.textarea.onchange = function () { - options.change(replaceRootJSONPatch(me)); - } + } + else { + // oninput is undefined. For IE8- + this.textarea.onchange = function () { + options.change(replaceRootJSONPatch(me)); } } } - }; + } +}; - /** +/** * Event handler for keydown. Handles shortcut keys * @param {Event} event * @private @@ -209,90 +209,90 @@ textmode._onKeyDown = function (event) { }; /** - * Detach the editor from the DOM - * @private - */ - textmode._delete = function () { - if (this.frame && this.container && this.frame.parentNode == this.container) { - this.container.removeChild(this.frame); - } - }; + * Detach the editor from the DOM + * @private + */ +textmode._delete = function () { + if (this.frame && this.container && this.frame.parentNode == this.container) { + this.container.removeChild(this.frame); + } +}; - /** - * Throw an error. If an error callback is configured in options.error, this - * callback will be invoked. Else, a regular error is thrown. - * @param {Error} err - * @private - */ - textmode._onError = function(err) { - // TODO: onError is deprecated since version 2.2.0. cleanup some day - if (typeof this.onError === 'function') { - util.log('WARNING: JSONEditor.onError is deprecated. ' + - 'Use options.error instead.'); - this.onError(err); - } +/** + * Throw an error. If an error callback is configured in options.error, this + * callback will be invoked. Else, a regular error is thrown. + * @param {Error} err + * @private + */ +textmode._onError = function(err) { + // TODO: onError is deprecated since version 2.2.0. cleanup some day + if (typeof this.onError === 'function') { + util.log('WARNING: JSONEditor.onError is deprecated. ' + + 'Use options.error instead.'); + this.onError(err); + } - if (this.options && typeof this.options.error === 'function') { - this.options.error(err); - } - else { - throw err; - } - }; + if (this.options && typeof this.options.error === 'function') { + this.options.error(err); + } + else { + throw err; + } +}; - /** - * Compact the code in the formatter - */ - textmode.compact = function () { +/** + * Compact the code in the formatter + */ +textmode.compact = function () { var json = this.get(); var text = JSON.stringify(json); this.setText(text); - }; +}; - /** - * Format the code in the formatter - */ - textmode.format = function () { +/** + * Format the code in the formatter + */ +textmode.format = function () { var json = this.get(); var text = JSON.stringify(json, null, this.indentation); this.setText(text); - }; +}; - /** - * Set focus to the formatter - */ - textmode.focus = function () { - if (this.textarea) { - this.textarea.focus(); - } - if (this.editor) { - this.editor.focus(); - } - }; +/** + * Set focus to the formatter + */ +textmode.focus = function () { + if (this.textarea) { + this.textarea.focus(); + } + if (this.editor) { + this.editor.focus(); + } +}; - /** - * Resize the formatter - */ - textmode.resize = function () { - if (this.editor) { - var force = false; - this.editor.resize(force); - } - }; +/** + * Resize the formatter + */ +textmode.resize = function () { + if (this.editor) { + var force = false; + this.editor.resize(force); + } +}; - /** - * Set json data in the formatter - * @param {Object} json - */ - textmode.set = function(json) { - this.setText(JSON.stringify(json, null, this.indentation)); - }; +/** + * Set json data in the formatter + * @param {Object} json + */ +textmode.set = function(json) { + this.setText(JSON.stringify(json, null, this.indentation)); +}; - /** - * Get json data from the formatter - * @return {Object} json - */ - textmode.get = function() { +/** + * Get json data from the formatter + * @return {Object} json + */ +textmode.get = function() { var text = this.getText(); var json; @@ -308,55 +308,55 @@ textmode._onKeyDown = function (event) { } return json; - }; - - /** - * Get the text contents of the editor - * @return {String} jsonText - */ - textmode.getText = function() { - if (this.textarea) { - return this.textarea.value; - } - if (this.editor) { - return this.editor.getValue(); - } - return ''; - }; +}; - /** - * Set the text contents of the editor - * @param {String} jsonText - */ - textmode.setText = function(jsonText) { - if (this.textarea) { - this.textarea.value = jsonText; - } - if (this.editor) { - this.editor.setValue(jsonText, -1); - } - }; +/** + * Get the text contents of the editor + * @return {String} jsonText + */ +textmode.getText = function() { + if (this.textarea) { + return this.textarea.value; + } + if (this.editor) { + return this.editor.getValue(); + } + return ''; +}; - function replaceRootJSONPatch(textmode){ - return { - op: "replace", - path: "", - value: textmode.get() - } +/** + * Set the text contents of the editor + * @param {String} jsonText + */ +textmode.setText = function(jsonText) { + if (this.textarea) { + this.textarea.value = jsonText; + } + if (this.editor) { + this.editor.setValue(jsonText, -1); } +}; + +function replaceRootJSONPatch(textmode){ + return { + op: "replace", + path: "", + value: textmode.get() + }; +} - // define modes +// define modes module.exports = [ - { - mode: 'text', - mixin: textmode, - data: 'text', - load: textmode.format - }, - { - mode: 'code', - mixin: textmode, - data: 'text', - load: textmode.format - } - ]; + { + mode: 'text', + mixin: textmode, + data: 'text', + load: textmode.format + }, + { + mode: 'code', + mixin: textmode, + data: 'text', + load: textmode.format + } +]; diff --git a/src/js/treemode.js b/src/js/treemode.js index 39c0d4583..b865594c9 100644 --- a/src/js/treemode.js +++ b/src/js/treemode.js @@ -5,180 +5,180 @@ var Node = require('./Node'); var modeswitcher = require('./modeswitcher'); var util = require('./util'); - // create a mixin with the functions for tree mode - var treemode = {}; - - /** - * Create a tree editor - * @param {Element} container Container element - * @param {Object} [options] Object with options. available options: - * {String} mode Editor mode. Available values: - * 'tree' (default), 'view', - * and 'form'. - * {Boolean} search Enable search box. - * True by default - * {Boolean} history Enable history (undo/redo). - * True by default - * {function} change Callback method, triggered - * on change of contents - * {String} name Field name for the root node. - * @private - */ - treemode.create = function (container, options) { - if (!container) { - throw new Error('No container element provided.'); - } - this.container = container; - this.dom = {}; - this.highlighter = new Highlighter(); - this.selection = undefined; // will hold the last input selection +// create a mixin with the functions for tree mode +var treemode = {}; - this._setOptions(options); +/** + * Create a tree editor + * @param {Element} container Container element + * @param {Object} [options] Object with options. available options: + * {String} mode Editor mode. Available values: + * 'tree' (default), 'view', + * and 'form'. + * {Boolean} search Enable search box. + * True by default + * {Boolean} history Enable history (undo/redo). + * True by default + * {function} change Callback method, triggered + * on change of contents + * {String} name Field name for the root node. + * @private + */ +treemode.create = function (container, options) { + if (!container) { + throw new Error('No container element provided.'); + } + this.container = container; + this.dom = {}; + this.highlighter = new Highlighter(); + this.selection = undefined; // will hold the last input selection - if (this.options.history && this.options.mode !== 'view') { - this.history = new History(this); - } + this._setOptions(options); - this._createFrame(); - this._createTable(); - }; + if (this.options.history && this.options.mode !== 'view') { + this.history = new History(this); + } - /** - * Detach the editor from the DOM - * @private - */ - treemode._delete = function () { - if (this.frame && this.container && this.frame.parentNode == this.container) { - this.container.removeChild(this.frame); - } - }; + this._createFrame(); + this._createTable(); +}; - /** - * Initialize and set default options - * @param {Object} [options] See description in constructor - * @private - */ - treemode._setOptions = function (options) { - this.options = { - search: true, - history: true, - mode: 'tree', - name: undefined // field name of root node - }; +/** + * Detach the editor from the DOM + * @private + */ +treemode._delete = function () { + if (this.frame && this.container && this.frame.parentNode == this.container) { + this.container.removeChild(this.frame); + } +}; - // copy all options - if (options) { - for (var prop in options) { - if (options.hasOwnProperty(prop)) { - this.options[prop] = options[prop]; - } +/** + * Initialize and set default options + * @param {Object} [options] See description in constructor + * @private + */ +treemode._setOptions = function (options) { + this.options = { + search: true, + history: true, + mode: 'tree', + name: undefined // field name of root node + }; + + // copy all options + if (options) { + for (var prop in options) { + if (options.hasOwnProperty(prop)) { + this.options[prop] = options[prop]; } } - }; + } +}; - // node currently being edited - var focusNode = undefined; +// node currently being edited +var focusNode = undefined; - // dom having focus - var domFocus = null; +// dom having focus +var domFocus = null; - /** - * Set JSON object in editor - * @param {Object | undefined} json JSON data - * @param {String} [name] Optional field name for the root node. - * Can also be set using setName(name). - */ - treemode.set = function (json, name) { - // adjust field name for root node - if (name) { - // TODO: deprecated since version 2.2.0. Cleanup some day. - util.log('Warning: second parameter "name" is deprecated. ' + - 'Use setName(name) instead.'); - this.options.name = name; - } +/** + * Set JSON object in editor + * @param {Object | undefined} json JSON data + * @param {String} [name] Optional field name for the root node. + * Can also be set using setName(name). + */ +treemode.set = function (json, name) { + // adjust field name for root node + if (name) { + // TODO: deprecated since version 2.2.0. Cleanup some day. + util.log('Warning: second parameter "name" is deprecated. ' + + 'Use setName(name) instead.'); + this.options.name = name; + } - // verify if json is valid JSON, ignore when a function - if (json instanceof Function || (json === undefined)) { - this.clear(); - } - else { - this.content.removeChild(this.table); // Take the table offline - - // replace the root node - var params = { - 'field': this.options.name, - 'value': json - }; - var node = new Node(this, params); - this._setRoot(node); - - // expand - var recurse = false; - this.node.expand(recurse); - - this.content.appendChild(this.table); // Put the table online again - } + // verify if json is valid JSON, ignore when a function + if (json instanceof Function || (json === undefined)) { + this.clear(); + } + else { + this.content.removeChild(this.table); // Take the table offline - // TODO: maintain history, store last state and previous document - if (this.history) { - this.history.clear(); - } - }; + // replace the root node + var params = { + 'field': this.options.name, + 'value': json + }; + var node = new Node(this, params); + this._setRoot(node); - /** - * Get JSON object from editor - * @return {Object | undefined} json - */ - treemode.get = function () { - // remove focus from currently edited node - if (focusNode) { - focusNode.blur(); - } + // expand + var recurse = false; + this.node.expand(recurse); - if (this.node) { - return this.node.getValue(); - } - else { - return undefined; - } - }; + this.content.appendChild(this.table); // Put the table online again + } - /** - * Get the text contents of the editor - * @return {String} jsonText - */ - treemode.getText = function() { - return JSON.stringify(this.get()); - }; + // TODO: maintain history, store last state and previous document + if (this.history) { + this.history.clear(); + } +}; - /** - * Set the text contents of the editor - * @param {String} jsonText - */ - treemode.setText = function(jsonText) { - this.set(util.parse(jsonText)); - }; +/** + * Get JSON object from editor + * @return {Object | undefined} json + */ +treemode.get = function () { + // remove focus from currently edited node + if (focusNode) { + focusNode.blur(); + } - /** - * Set a field name for the root node. - * @param {String | undefined} name - */ - treemode.setName = function (name) { - this.options.name = name; - if (this.node) { - this.node.updateField(this.options.name); - } - }; + if (this.node) { + return this.node.getValue(); + } + else { + return undefined; + } +}; - /** - * Get the field name for the root node. - * @return {String | undefined} name - */ - treemode.getName = function () { - return this.options.name; - }; +/** + * Get the text contents of the editor + * @return {String} jsonText + */ +treemode.getText = function() { + return JSON.stringify(this.get()); +}; - /** +/** + * Set the text contents of the editor + * @param {String} jsonText + */ +treemode.setText = function(jsonText) { + this.set(util.parse(jsonText)); +}; + +/** + * Set a field name for the root node. + * @param {String | undefined} name + */ +treemode.setName = function (name) { + this.options.name = name; + if (this.node) { + this.node.updateField(this.options.name); + } +}; + +/** + * Get the field name for the root node. + * @return {String | undefined} name + */ +treemode.getName = function () { + return this.options.name; +}; + +/** * Set focus to the editor. Focus will be set to: * - the first editable field or value, or else * - to the expand button of the root node, or else @@ -206,643 +206,645 @@ treemode.focus = function () { }; /** - * Remove the root node from the editor - */ - treemode.clear = function () { - if (this.node) { - this.node.collapse(); - this.tbody.removeChild(this.node.getDom()); - delete this.node; - } - }; + * Remove the root node from the editor + */ +treemode.clear = function () { + if (this.node) { + this.node.collapse(); + this.tbody.removeChild(this.node.getDom()); + delete this.node; + } +}; - /** - * Set the root node for the json editor - * @param {Node} node - * @private - */ - treemode._setRoot = function (node) { - this.clear(); +/** + * Set the root node for the json editor + * @param {Node} node + * @private + */ +treemode._setRoot = function (node) { + this.clear(); - this.node = node; + this.node = node; - // append to the dom - this.tbody.appendChild(node.getDom()); - }; + // append to the dom + this.tbody.appendChild(node.getDom()); +}; - /** - * Search text in all nodes - * The nodes will be expanded when the text is found one of its childs, - * else it will be collapsed. Searches are case insensitive. - * @param {String} text - * @return {Object[]} results Array with nodes containing the search results - * The result objects contains fields: - * - {Node} node, - * - {String} elem the dom element name where - * the result is found ('field' or - * 'value') - */ - treemode.search = function (text) { - var results; - if (this.node) { - this.content.removeChild(this.table); // Take the table offline - results = this.node.search(text); - this.content.appendChild(this.table); // Put the table online again - } - else { - results = []; - } +/** + * Search text in all nodes + * The nodes will be expanded when the text is found one of its childs, + * else it will be collapsed. Searches are case insensitive. + * @param {String} text + * @return {Object[]} results Array with nodes containing the search results + * The result objects contains fields: + * - {Node} node, + * - {String} elem the dom element name where + * the result is found ('field' or + * 'value') + */ +treemode.search = function (text) { + var results; + if (this.node) { + this.content.removeChild(this.table); // Take the table offline + results = this.node.search(text); + this.content.appendChild(this.table); // Put the table online again + } + else { + results = []; + } - return results; - }; + return results; +}; - /** - * Expand all nodes - */ - treemode.expandAll = function () { - if (this.node) { - this.content.removeChild(this.table); // Take the table offline - this.node.expand(); - this.content.appendChild(this.table); // Put the table online again - } - }; +/** + * Expand all nodes + */ +treemode.expandAll = function () { + if (this.node) { + this.content.removeChild(this.table); // Take the table offline + this.node.expand(); + this.content.appendChild(this.table); // Put the table online again + } +}; - /** - * Collapse all nodes - */ - treemode.collapseAll = function () { - if (this.node) { - this.content.removeChild(this.table); // Take the table offline - this.node.collapse(); - this.content.appendChild(this.table); // Put the table online again - } - }; +/** + * Collapse all nodes + */ +treemode.collapseAll = function () { + if (this.node) { + this.content.removeChild(this.table); // Take the table offline + this.node.collapse(); + this.content.appendChild(this.table); // Put the table online again + } +}; - /** - * The method onChange is called whenever a field or value is changed, created, - * deleted, duplicated, etc. - * @param {String} action Change action. Available values: "editField", - * "editValue", "changeType", "appendNode", - * "removeNode", "duplicateNode", "moveNode", "expand", - * "collapse". - * @param {Object} params Object containing parameters describing the change. - * The parameters in params depend on the action (for - * example for "editValue" the Node, old value, and new - * value are provided). params contains all information - * needed to undo or redo the action. - * @private - */ - treemode._onAction = function (action, params) { - // add an action to the history - if (this.history) { - this.history.add(action, params); - } +/** + * The method onChange is called whenever a field or value is changed, created, + * deleted, duplicated, etc. + * @param {String} action Change action. Available values: "editField", + * "editValue", "changeType", "appendNode", + * "removeNode", "duplicateNode", "moveNode", "expand", + * "collapse". + * @param {Object} params Object containing parameters describing the change. + * The parameters in params depend on the action (for + * example for "editValue" the Node, old value, and new + * value are provided). params contains all information + * needed to undo or redo the action. + * @private + */ +treemode._onAction = function (action, params) { + // add an action to the history + if (this.history) { + this.history.add(action, params); + } - // trigger the onChange callback - if (this.options.change) { - try { - this.options.change(translateChangeToJSONPatch(action, params)); - } - catch (err) { - util.log('Error in change callback: ', err); - } + // trigger the onChange callback + if (this.options.change) { + try { + this.options.change(translateChangeToJSONPatch(action, params)); } - }; + catch (err) { + util.log('Error in change callback: ', err); + } + } +}; - /** - * Start autoscrolling when given mouse position is above the top of the - * editor contents, or below the bottom. - * @param {Number} mouseY Absolute mouse position in pixels - */ - treemode.startAutoScroll = function (mouseY) { - var me = this; - var content = this.content; - var top = util.getAbsoluteTop(content); - var height = content.clientHeight; - var bottom = top + height; - var margin = 24; - var interval = 50; // ms +/** + * Start autoscrolling when given mouse position is above the top of the + * editor contents, or below the bottom. + * @param {Number} mouseY Absolute mouse position in pixels + */ +treemode.startAutoScroll = function (mouseY) { + var me = this; + var content = this.content; + var top = util.getAbsoluteTop(content); + var height = content.clientHeight; + var bottom = top + height; + var margin = 24; + var interval = 50; // ms + + if ((mouseY < top + margin) && content.scrollTop > 0) { + this.autoScrollStep = ((top + margin) - mouseY) / 3; + } + else if (mouseY > bottom - margin && + height + content.scrollTop < content.scrollHeight) { + this.autoScrollStep = ((bottom - margin) - mouseY) / 3; + } + else { + this.autoScrollStep = undefined; + } - if ((mouseY < top + margin) && content.scrollTop > 0) { - this.autoScrollStep = ((top + margin) - mouseY) / 3; - } - else if (mouseY > bottom - margin && - height + content.scrollTop < content.scrollHeight) { - this.autoScrollStep = ((bottom - margin) - mouseY) / 3; - } - else { - this.autoScrollStep = undefined; + if (this.autoScrollStep) { + if (!this.autoScrollTimer) { + this.autoScrollTimer = setInterval(function () { + if (me.autoScrollStep) { + content.scrollTop -= me.autoScrollStep; + } + else { + me.stopAutoScroll(); + } + }, interval); } + } + else { + this.stopAutoScroll(); + } +}; - if (this.autoScrollStep) { - if (!this.autoScrollTimer) { - this.autoScrollTimer = setInterval(function () { - if (me.autoScrollStep) { - content.scrollTop -= me.autoScrollStep; - } - else { - me.stopAutoScroll(); - } - }, interval); - } - } - else { - this.stopAutoScroll(); - } - }; +/** + * Stop auto scrolling. Only applicable when scrolling + */ +treemode.stopAutoScroll = function () { + if (this.autoScrollTimer) { + clearTimeout(this.autoScrollTimer); + delete this.autoScrollTimer; + } + if (this.autoScrollStep) { + delete this.autoScrollStep; + } +}; - /** - * Stop auto scrolling. Only applicable when scrolling - */ - treemode.stopAutoScroll = function () { - if (this.autoScrollTimer) { - clearTimeout(this.autoScrollTimer); - delete this.autoScrollTimer; - } - if (this.autoScrollStep) { - delete this.autoScrollStep; - } - }; +/** + * Set the focus to an element in the editor, set text selection, and + * set scroll position. + * @param {Object} selection An object containing fields: + * {Element | undefined} dom The dom element + * which has focus + * {Range | TextRange} range A text selection + * {Number} scrollTop Scroll position + */ +treemode.setSelection = function (selection) { + if (!selection) { + return; + } - /** - * Set the focus to an element in the editor, set text selection, and - * set scroll position. - * @param {Object} selection An object containing fields: - * {Element | undefined} dom The dom element - * which has focus - * {Range | TextRange} range A text selection - * {Number} scrollTop Scroll position - */ - treemode.setSelection = function (selection) { - if (!selection) { - return; - } + if ('scrollTop' in selection && this.content) { + // TODO: animated scroll + this.content.scrollTop = selection.scrollTop; + } + if (selection.range) { + util.setSelectionOffset(selection.range); + } + if (selection.dom) { + selection.dom.focus(); + } +}; - if ('scrollTop' in selection && this.content) { - // TODO: animated scroll - this.content.scrollTop = selection.scrollTop; - } - if (selection.range) { - util.setSelectionOffset(selection.range); - } - if (selection.dom) { - selection.dom.focus(); - } +/** + * Get the current focus + * @return {Object} selection An object containing fields: + * {Element | undefined} dom The dom element + * which has focus + * {Range | TextRange} range A text selection + * {Number} scrollTop Scroll position + */ +treemode.getSelection = function () { + return { + dom: domFocus, + scrollTop: this.content ? this.content.scrollTop : 0, + range: util.getSelectionOffset() }; +}; - /** - * Get the current focus - * @return {Object} selection An object containing fields: - * {Element | undefined} dom The dom element - * which has focus - * {Range | TextRange} range A text selection - * {Number} scrollTop Scroll position - */ - treemode.getSelection = function () { - return { - dom: domFocus, - scrollTop: this.content ? this.content.scrollTop : 0, - range: util.getSelectionOffset() - }; - }; +/** + * Adjust the scroll position such that given top position is shown at 1/4 + * of the window height. + * @param {Number} top + * @param {function(boolean)} [callback] Callback, executed when animation is + * finished. The callback returns true + * when animation is finished, or false + * when not. + */ +treemode.scrollTo = function (top, callback) { + var content = this.content; + if (content) { + var editor = this; + // cancel any running animation + if (editor.animateTimeout) { + clearTimeout(editor.animateTimeout); + delete editor.animateTimeout; + } + if (editor.animateCallback) { + editor.animateCallback(false); + delete editor.animateCallback; + } - /** - * Adjust the scroll position such that given top position is shown at 1/4 - * of the window height. - * @param {Number} top - * @param {function(boolean)} [callback] Callback, executed when animation is - * finished. The callback returns true - * when animation is finished, or false - * when not. - */ - treemode.scrollTo = function (top, callback) { - var content = this.content; - if (content) { - var editor = this; - // cancel any running animation - if (editor.animateTimeout) { - clearTimeout(editor.animateTimeout); - delete editor.animateTimeout; - } - if (editor.animateCallback) { - editor.animateCallback(false); - delete editor.animateCallback; + // calculate final scroll position + var height = content.clientHeight; + var bottom = content.scrollHeight - height; + var finalScrollTop = Math.min(Math.max(top - height / 4, 0), bottom); + + // animate towards the new scroll position + var animate = function () { + var scrollTop = content.scrollTop; + var diff = (finalScrollTop - scrollTop); + if (Math.abs(diff) > 3) { + content.scrollTop += diff / 3; + editor.animateCallback = callback; + editor.animateTimeout = setTimeout(animate, 50); } - - // calculate final scroll position - var height = content.clientHeight; - var bottom = content.scrollHeight - height; - var finalScrollTop = Math.min(Math.max(top - height / 4, 0), bottom); - - // animate towards the new scroll position - var animate = function () { - var scrollTop = content.scrollTop; - var diff = (finalScrollTop - scrollTop); - if (Math.abs(diff) > 3) { - content.scrollTop += diff / 3; - editor.animateCallback = callback; - editor.animateTimeout = setTimeout(animate, 50); + else { + // finished + if (callback) { + callback(true); } - else { - // finished - if (callback) { - callback(true); - } - content.scrollTop = finalScrollTop; - delete editor.animateTimeout; - delete editor.animateCallback; - } - }; - animate(); - } - else { - if (callback) { - callback(false); + content.scrollTop = finalScrollTop; + delete editor.animateTimeout; + delete editor.animateCallback; } + }; + animate(); + } + else { + if (callback) { + callback(false); } - }; - - /** - * Create main frame - * @private - */ - treemode._createFrame = function () { - // create the frame - this.frame = document.createElement('div'); - this.frame.className = 'jsoneditor'; - this.container.appendChild(this.frame); + } +}; - // create one global event listener to handle all events from all nodes - var editor = this; - function onEvent(event) { - editor._onEvent(event); - } - this.frame.onclick = function (event) { - var target = event.target;// || event.srcElement; +/** + * Create main frame + * @private + */ +treemode._createFrame = function () { + // create the frame + this.frame = document.createElement('div'); + this.frame.className = 'jsoneditor'; + this.container.appendChild(this.frame); + + // create one global event listener to handle all events from all nodes + var editor = this; + function onEvent(event) { + editor._onEvent(event); + } + this.frame.onclick = function (event) { + var target = event.target;// || event.srcElement; - onEvent(event); + onEvent(event); - // prevent default submit action of buttons when editor is located - // inside a form - if (target.nodeName == 'BUTTON') { - event.preventDefault(); - } + // prevent default submit action of buttons when editor is located + // inside a form + if (target.nodeName == 'BUTTON') { + event.preventDefault(); + } + }; + this.frame.oninput = onEvent; + this.frame.onchange = onEvent; + this.frame.onkeydown = onEvent; + this.frame.onkeyup = onEvent; + this.frame.oncut = onEvent; + this.frame.onpaste = onEvent; + this.frame.onmousedown = onEvent; + this.frame.onmouseup = onEvent; + this.frame.onmouseover = onEvent; + this.frame.onmouseout = onEvent; + // Note: focus and blur events do not propagate, therefore they defined + // using an eventListener with useCapture=true + // see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html + util.addEventListener(this.frame, 'focus', onEvent, true); + util.addEventListener(this.frame, 'blur', onEvent, true); + this.frame.onfocusin = onEvent; // for IE + this.frame.onfocusout = onEvent; // for IE + + // create menu + this.menu = document.createElement('div'); + this.menu.className = 'menu'; + this.frame.appendChild(this.menu); + + // create expand all button + var expandAll = document.createElement('button'); + expandAll.className = 'expand-all'; + expandAll.title = 'Expand all fields'; + expandAll.onclick = function () { + editor.expandAll(); + }; + this.menu.appendChild(expandAll); + + // create expand all button + var collapseAll = document.createElement('button'); + collapseAll.title = 'Collapse all fields'; + collapseAll.className = 'collapse-all'; + collapseAll.onclick = function () { + editor.collapseAll(); + }; + this.menu.appendChild(collapseAll); + + // create undo/redo buttons + if (this.history) { + // create undo button + var undo = document.createElement('button'); + undo.className = 'undo separator'; + undo.title = 'Undo last action (Ctrl+Z)'; + undo.onclick = function () { + editor._onUndo(); }; - this.frame.oninput = onEvent; - this.frame.onchange = onEvent; - this.frame.onkeydown = onEvent; - this.frame.onkeyup = onEvent; - this.frame.oncut = onEvent; - this.frame.onpaste = onEvent; - this.frame.onmousedown = onEvent; - this.frame.onmouseup = onEvent; - this.frame.onmouseover = onEvent; - this.frame.onmouseout = onEvent; - // Note: focus and blur events do not propagate, therefore they defined - // using an eventListener with useCapture=true - // see http://www.quirksmode.org/blog/archives/2008/04/delegating_the.html - util.addEventListener(this.frame, 'focus', onEvent, true); - util.addEventListener(this.frame, 'blur', onEvent, true); - this.frame.onfocusin = onEvent; // for IE - this.frame.onfocusout = onEvent; // for IE - - // create menu - this.menu = document.createElement('div'); - this.menu.className = 'menu'; - this.frame.appendChild(this.menu); - - // create expand all button - var expandAll = document.createElement('button'); - expandAll.className = 'expand-all'; - expandAll.title = 'Expand all fields'; - expandAll.onclick = function () { - editor.expandAll(); + this.menu.appendChild(undo); + this.dom.undo = undo; + + // create redo button + var redo = document.createElement('button'); + redo.className = 'redo'; + redo.title = 'Redo (Ctrl+Shift+Z)'; + redo.onclick = function () { + editor._onRedo(); }; - this.menu.appendChild(expandAll); - - // create expand all button - var collapseAll = document.createElement('button'); - collapseAll.title = 'Collapse all fields'; - collapseAll.className = 'collapse-all'; - collapseAll.onclick = function () { - editor.collapseAll(); + this.menu.appendChild(redo); + this.dom.redo = redo; + + // register handler for onchange of history + this.history.onChange = function () { + undo.disabled = !editor.history.canUndo(); + redo.disabled = !editor.history.canRedo(); }; - this.menu.appendChild(collapseAll); - - // create undo/redo buttons - if (this.history) { - // create undo button - var undo = document.createElement('button'); - undo.className = 'undo separator'; - undo.title = 'Undo last action (Ctrl+Z)'; - undo.onclick = function () { - editor._onUndo(); - }; - this.menu.appendChild(undo); - this.dom.undo = undo; - - // create redo button - var redo = document.createElement('button'); - redo.className = 'redo'; - redo.title = 'Redo (Ctrl+Shift+Z)'; - redo.onclick = function () { - editor._onRedo(); - }; - this.menu.appendChild(redo); - this.dom.redo = redo; - - // register handler for onchange of history - this.history.onChange = function () { - undo.disabled = !editor.history.canUndo(); - redo.disabled = !editor.history.canRedo(); - }; - this.history.onChange(); - } + this.history.onChange(); + } - // create mode box - if (this.options && this.options.modes && this.options.modes.length) { - var modeBox = modeswitcher.create(this, this.options.modes, this.options.mode); - this.menu.appendChild(modeBox); - this.dom.modeBox = modeBox; - } + // create mode box + if (this.options && this.options.modes && this.options.modes.length) { + var modeBox = modeswitcher.create(this, this.options.modes, this.options.mode); + this.menu.appendChild(modeBox); + this.dom.modeBox = modeBox; + } - // create search box - if (this.options.search) { - this.searchBox = new SearchBox(this, this.menu); - } - }; + // create search box + if (this.options.search) { + this.searchBox = new SearchBox(this, this.menu); + } +}; - /** - * Perform an undo action - * @private - */ - treemode._onUndo = function () { - if (this.history) { - // undo last action - var historyEntry = this.history.undo(); - // trigger change callback if anything have changed - if (this.options.change && historyEntry) { - this.options.change( - translateChangeToJSONPatch(historyEntry.action, historyEntry.params) - ); - } - } - }; +/** + * Perform an undo action + * @private + */ +treemode._onUndo = function () { + if (this.history) { + // undo last action + var historyEntry = this.history.undo(); - /** - * Perform a redo action - * @private - */ - treemode._onRedo = function () { - if (this.history) { - // redo last action - var historyEntry = this.history.redo(); - // trigger change callback if anything have changed - if (this.options.change && historyEntry) { - this.options.change( - translateChangeToJSONPatch(historyEntry.action, historyEntry.params) - ); - } + // trigger change callback if anything have changed + if (this.options.change && historyEntry) { + this.options.change( + translateChangeToJSONPatch(historyEntry.action, historyEntry.params) + ); } - }; - - /** - * Event handler - * @param event - * @private - */ - treemode._onEvent = function (event) { - var target = event.target; + } +}; - if (event.type == 'keydown') { - this._onKeyDown(event); +/** + * Perform a redo action + * @private + */ +treemode._onRedo = function () { + if (this.history) { + // redo last action + var historyEntry = this.history.redo(); + // trigger change callback if anything have changed + if (this.options.change && historyEntry) { + this.options.change( + translateChangeToJSONPatch(historyEntry.action, historyEntry.params) + ); } + } +}; - if (event.type == 'focus') { - domFocus = target; - } +/** + * Event handler + * @param event + * @private + */ +treemode._onEvent = function (event) { + var target = event.target; - var node = Node.getNodeFromTarget(target); - if (node) { - node.onEvent(event); - } - }; + if (event.type == 'keydown') { + this._onKeyDown(event); + } - /** - * Event handler for keydown. Handles shortcut keys - * @param {Event} event - * @private - */ - treemode._onKeyDown = function (event) { - var keynum = event.which || event.keyCode; - var ctrlKey = event.ctrlKey; - var shiftKey = event.shiftKey; - var handled = false; - - if (keynum == 9) { // Tab or Shift+Tab - setTimeout(function () { - // select all text when moving focus to an editable div - util.selectContentEditable(domFocus); - }, 0); - } + if (event.type == 'focus') { + domFocus = target; + } - if (this.searchBox) { - if (ctrlKey && keynum == 70) { // Ctrl+F - this.searchBox.dom.search.focus(); - this.searchBox.dom.search.select(); - handled = true; - } - else if (keynum == 114 || (ctrlKey && keynum == 71)) { // F3 or Ctrl+G - var focus = true; - if (!shiftKey) { - // select next search result (F3 or Ctrl+G) - this.searchBox.next(focus); - } - else { - // select previous search result (Shift+F3 or Ctrl+Shift+G) - this.searchBox.previous(focus); - } + var node = Node.getNodeFromTarget(target); + if (node) { + node.onEvent(event); + } +}; - handled = true; - } - } +/** + * Event handler for keydown. Handles shortcut keys + * @param {Event} event + * @private + */ +treemode._onKeyDown = function (event) { + var keynum = event.which || event.keyCode; + var ctrlKey = event.ctrlKey; + var shiftKey = event.shiftKey; + var handled = false; + + if (keynum == 9) { // Tab or Shift+Tab + setTimeout(function () { + // select all text when moving focus to an editable div + util.selectContentEditable(domFocus); + }, 0); + } - if (this.history) { - if (ctrlKey && !shiftKey && keynum == 90) { // Ctrl+Z - // undo - this._onUndo(); - handled = true; + if (this.searchBox) { + if (ctrlKey && keynum == 70) { // Ctrl+F + this.searchBox.dom.search.focus(); + this.searchBox.dom.search.select(); + handled = true; + } + else if (keynum == 114 || (ctrlKey && keynum == 71)) { // F3 or Ctrl+G + var focus = true; + if (!shiftKey) { + // select next search result (F3 or Ctrl+G) + this.searchBox.next(focus); } - else if (ctrlKey && shiftKey && keynum == 90) { // Ctrl+Shift+Z - // redo - this._onRedo(); - handled = true; + else { + // select previous search result (Shift+F3 or Ctrl+Shift+G) + this.searchBox.previous(focus); } - } - if (handled) { - event.preventDefault(); - event.stopPropagation(); + handled = true; } - }; + } - /** - * Create main table - * @private - */ - treemode._createTable = function () { - var contentOuter = document.createElement('div'); - contentOuter.className = 'outer'; - this.contentOuter = contentOuter; - - this.content = document.createElement('div'); - this.content.className = 'tree'; - contentOuter.appendChild(this.content); - - this.table = document.createElement('table'); - this.table.className = 'tree'; - this.content.appendChild(this.table); - - // create colgroup where the first two columns don't have a fixed - // width, and the edit columns do have a fixed width - var col; - this.colgroupContent = document.createElement('colgroup'); - if (this.options.mode === 'tree') { - col = document.createElement('col'); - col.width = "24px"; - this.colgroupContent.appendChild(col); + if (this.history) { + if (ctrlKey && !shiftKey && keynum == 90) { // Ctrl+Z + // undo + this._onUndo(); + handled = true; } + else if (ctrlKey && shiftKey && keynum == 90) { // Ctrl+Shift+Z + // redo + this._onRedo(); + handled = true; + } + } + + if (handled) { + event.preventDefault(); + event.stopPropagation(); + } +}; + +/** + * Create main table + * @private + */ +treemode._createTable = function () { + var contentOuter = document.createElement('div'); + contentOuter.className = 'outer'; + this.contentOuter = contentOuter; + + this.content = document.createElement('div'); + this.content.className = 'tree'; + contentOuter.appendChild(this.content); + + this.table = document.createElement('table'); + this.table.className = 'tree'; + this.content.appendChild(this.table); + + // create colgroup where the first two columns don't have a fixed + // width, and the edit columns do have a fixed width + var col; + this.colgroupContent = document.createElement('colgroup'); + if (this.options.mode === 'tree') { col = document.createElement('col'); col.width = "24px"; this.colgroupContent.appendChild(col); - col = document.createElement('col'); - this.colgroupContent.appendChild(col); - this.table.appendChild(this.colgroupContent); + } + col = document.createElement('col'); + col.width = "24px"; + this.colgroupContent.appendChild(col); + col = document.createElement('col'); + this.colgroupContent.appendChild(col); + this.table.appendChild(this.colgroupContent); - this.tbody = document.createElement('tbody'); - this.table.appendChild(this.tbody); + this.tbody = document.createElement('tbody'); + this.table.appendChild(this.tbody); - this.frame.appendChild(contentOuter); - }; + this.frame.appendChild(contentOuter); +}; +/** + * Translate our internal change info into JSON-Patch format + * @see http://tools.ietf.org/html/rfc6902 + * @param {String} action JSONEditor action + * @param {Object} params JSONEditor params + * @return {Object} single JSON-Patch entry + */ +function translateChangeToJSONPatch(action, params){ /** - * Translate our internal change info into JSON-Patch format - * @see http://tools.ietf.org/html/rfc6902 - * @param {String} action JSONEditor action - * @param {Object} params JSONEditor params - * @return {Object} single JSON-Patch entry + * Get path to node in JSON Pointer format + * (http://tools.ietf.org/html/rfc6901) + * _Almost_ like params.node.path().join("/") + * @param {Node} node jsoneditor node in question + * @returns {String} path */ - function translateChangeToJSONPatch(action, params){ - /** - * Get path to node in JSON Pointer format - * (http://tools.ietf.org/html/rfc6901) - * _Almost_ like params.node.path().join("/") - * @param {Node} node jsoneditor node in question - * @returns {String} path - */ - function JSONPointer(node){ - var path = ""; - while (node.parent) { - var field = node.field != undefined ? node.field : node.index; - switch(typeof field){ - case "string": - path = "/" + escapePathComponent(field) + path; - break; - case "number": - path = "/" + field + path; - break; - } - node = node.parent; - } - return path; - - } - /** - * Escape `/` and `~`, according to JSON-Pointer rules. - * @param {String} str string to escape - * @returns {String} escaped string - */ - function escapePathComponent(str) { - if (str.indexOf('/') === -1 && str.indexOf('~') === -1) - return str; - return str.replace(/~/g, '~0').replace(/\//g, '~1'); + function JSONPointer(node){ + var path = ""; + while (node.parent) { + var field = node.field != undefined ? node.field : node.index; + switch(typeof field){ + case "string": + path = "/" + escapePathComponent(field) + path; + break; + case "number": + path = "/" + field + path; + break; + } + node = node.parent; } - var patch; - switch(action){ - case "duplicateNode": - console.warn("duplicateNode->copy Is not supported yet, as currently new node with same name is created, what violates JSON-Patch"); - break; - case "changeType": - (params.node.type == "array" || params.node.type == "object") && console.warn("changeType->replace may behave strange, as even if new node is created with specified type, its `node.value==\"\"`") - patch = { - op: "replace", - path: JSONPointer(params.node), - value: params.node.value - } - break; - case "editValue": - patch = { - op: "replace", - path: JSONPointer(params.node), - value: params.newValue - } - break; - case "removeNode": - patch = { - op: "remove", - path: JSONPointer(params.node) - } - break; - case "insertAfterNode": - case "insertBeforeNode": - case "appendNode": - console.warn("insertBeforeNode,appendNode->add may behave strange, as even if new node is created with specified type, its `node.value==\"\"`", - "also when inserting item into an array, new path is given, and there is no info about previous indexes, so it's hard to distinguish whether to use `-`, old index, or if it is not an array item, so we should stick to the given path"); - patch = { - op: "add", - path: JSONPointer(params.node), - value: params.node.value - } - break; - case "moveNode": - console.warn("moveNode->move Still does not cover moving array items, as their name was already changed to `\"\"` which is fully valid object key, so we cannot distinguish it"); - if(params.startParent !== params.endParent){ - patch = { - op: "move", - from: JSONPointer(params.startParent) + "/" + params.node.field, - path: JSONPointer(params.node) - } - } - break; - case "editField": + return path; + + } + /** + * Escape `/` and `~`, according to JSON-Pointer rules. + * @param {String} str string to escape + * @returns {String} escaped string + */ + function escapePathComponent(str) { + if (str.indexOf('/') === -1 && str.indexOf('~') === -1) + return str; + return str.replace(/~/g, '~0').replace(/\//g, '~1'); + } + var patch; + switch(action){ + case "duplicateNode": + console.warn("duplicateNode->copy Is not supported yet, as currently new node with same name is created, what violates JSON-Patch"); + break; + case "changeType": + (params.node.type == "array" || params.node.type == "object") && console.warn("changeType->replace may behave strange, as even if new node is created with specified type, its `node.value==\"\"`") + patch = { + op: "replace", + path: JSONPointer(params.node), + value: params.node.value + } + break; + case "editValue": + patch = { + op: "replace", + path: JSONPointer(params.node), + value: params.newValue + } + break; + case "removeNode": + patch = { + op: "remove", + path: JSONPointer(params.node) + } + break; + case "insertAfterNode": + case "insertBeforeNode": + case "appendNode": + console.warn("insertBeforeNode,appendNode->add may behave strange, as even if new node is created with specified type, its `node.value==\"\"`", + "also when inserting item into an array, new path is given, and there is no info about previous indexes, so it's hard to distinguish whether to use `-`, old index, or if it is not an array item, so we should stick to the given path"); + patch = { + op: "add", + path: JSONPointer(params.node), + value: params.node.value + } + break; + case "moveNode": + console.warn("moveNode->move Still does not cover moving array items, as their name was already changed to `\"\"` which is fully valid object key, so we cannot distinguish it"); + if(params.startParent !== params.endParent){ patch = { op: "move", - from: JSONPointer(params.node.parent) + "/" + params.oldValue, + from: JSONPointer(params.startParent) + "/" + params.node.field, path: JSONPointer(params.node) } - break; - case "sort": - // no changes to the JSON itself - break; - } - return patch; + } + break; + case "editField": + patch = { + op: "move", + from: JSONPointer(params.node.parent) + "/" + params.oldValue, + path: JSONPointer(params.node) + } + break; + case "sort": + // no changes to the JSON itself + break; } - // define modes + return patch; +} + +// define modes module.exports = [ - { - mode: 'tree', - mixin: treemode, - data: 'json' - }, - { - mode: 'view', - mixin: treemode, - data: 'json' - }, - { - mode: 'form', - mixin: treemode, - data: 'json' - } + { + mode: 'tree', + mixin: treemode, + data: 'json' + }, + { + mode: 'view', + mixin: treemode, + data: 'json' + }, + { + mode: 'form', + mixin: treemode, + data: 'json' + } ];