fixed a typo in method _escape (missing semicolon after )
This commit is contained in:
parent
b56b6a6df1
commit
ec1dee480f
|
@ -72,8 +72,8 @@ JSONEditor.showDropDownList=function(a){var b=document.createElement("div");b.cl
|
||||||
b.appendChild(g)}document.body.appendChild(b);a.node.setHighlight(!0);JSONEditor.freezeHighlight=!0;var h=JSONEditor.Events.addEventListener(document,"mousedown",function(){JSONEditor.freezeHighlight=!1;a.node.setHighlight(!1);document.body.removeChild(b);JSONEditor.Events.removeEventListener(document,"mousedown",h)})};JSONEditor.Node.prototype.getAppend=function(){if(!this.append)this.append=new JSONEditor.AppendNode,this.append.setParent(this);return this.append.getDom()};
|
b.appendChild(g)}document.body.appendChild(b);a.node.setHighlight(!0);JSONEditor.freezeHighlight=!0;var h=JSONEditor.Events.addEventListener(document,"mousedown",function(){JSONEditor.freezeHighlight=!1;a.node.setHighlight(!1);document.body.removeChild(b);JSONEditor.Events.removeEventListener(document,"mousedown",h)})};JSONEditor.Node.prototype.getAppend=function(){if(!this.append)this.append=new JSONEditor.AppendNode,this.append.setParent(this);return this.append.getDom()};
|
||||||
JSONEditor.Node.prototype._createDomRemoveButton=function(){if(this.parent&&(this.parent.type=="array"||this.parent.type=="object")){var a=document.createElement("button");a.className="jsoneditor-remove";a.title="Remove field (including all its childs)";return a}};
|
JSONEditor.Node.prototype._createDomRemoveButton=function(){if(this.parent&&(this.parent.type=="array"||this.parent.type=="object")){var a=document.createElement("button");a.className="jsoneditor-remove";a.title="Remove field (including all its childs)";return a}};
|
||||||
JSONEditor.Node.prototype._createDomDuplicateButton=function(){if(this.parent&&(this.parent.type=="array"||this.parent.type=="object")){var a=document.createElement("button");a.className="jsoneditor-duplicate";a.title="Duplicate field (including all childs)";return a}};JSONEditor.Node.prototype._getType=function(a){return a instanceof Array?"array":a instanceof Object?"object":typeof a=="string"&&typeof this._stringCast(a)!="string"?"string":"auto"};
|
JSONEditor.Node.prototype._createDomDuplicateButton=function(){if(this.parent&&(this.parent.type=="array"||this.parent.type=="object")){var a=document.createElement("button");a.className="jsoneditor-duplicate";a.title="Duplicate field (including all childs)";return a}};JSONEditor.Node.prototype._getType=function(a){return a instanceof Array?"array":a instanceof Object?"object":typeof a=="string"&&typeof this._stringCast(a)!="string"?"string":"auto"};
|
||||||
JSONEditor.Node.prototype._stringCast=function(a){var b=a.toLowerCase(),c=Number(a),d=parseFloat(a);return a==""?"":b=="null"?null:b=="true"?!0:b=="false"?!1:!isNaN(c)&&!isNaN(d)?c:a};JSONEditor.Node.prototype._escape=function(a){a=String(a).replace(/</g,"<").replace(/>/g,">").replace(/ /g," ");a=JSON.stringify(a);return a.substring(1,a.length-1)};JSONEditor.Node.prototype._unescape=function(a){return JSON.parse('"'+a+'"').replace(/</g,"<").replace(/>/g,">").replace(/ /g," ")};
|
JSONEditor.Node.prototype._stringCast=function(a){var b=a.toLowerCase(),c=Number(a),d=parseFloat(a);return a==""?"":b=="null"?null:b=="true"?!0:b=="false"?!1:!isNaN(c)&&!isNaN(d)?c:a};JSONEditor.Node.prototype._escape=function(a){a=String(a).replace(/</g,"<").replace(/>/g,">").replace(/ /g," ").replace(/^ /," ").replace(/ $/," ");a=JSON.stringify(a);return a.substring(1,a.length-1)};
|
||||||
JSONEditor.Node.prototype._stripHTML=function(a){return a.replace(/<(?:.|\n)*?>/gm,"")};JSONEditor.AppendNode=function(){this.dom={}};JSONEditor.AppendNode.prototype=new JSONEditor.Node;
|
JSONEditor.Node.prototype._unescape=function(a){return JSON.parse('"'+a+'"').replace(/</g,"<").replace(/>/g,">").replace(/ /g," ")};JSONEditor.Node.prototype._stripHTML=function(a){return a.replace(/<(?:.|\n)*?>/gm,"")};JSONEditor.AppendNode=function(){this.dom={}};JSONEditor.AppendNode.prototype=new JSONEditor.Node;
|
||||||
JSONEditor.AppendNode.prototype.getDom=function(){function a(a){var b=document.createElement("td");b.className=a||"";return b}if(this.dom.tr)return this.dom.tr;var b=document.createElement("tr");b.appendChild(a("jsoneditor-td"));b.node=this;var c=document.createElement("td");b.appendChild(c);c.className="jsoneditor-td";var d=document.createElement("button");d.className="jsoneditor-append";d.title="Append a field";this.dom.append=d;c.appendChild(d);b.appendChild(a("jsoneditor-td jsoneditor-td-edit"));
|
JSONEditor.AppendNode.prototype.getDom=function(){function a(a){var b=document.createElement("td");b.className=a||"";return b}if(this.dom.tr)return this.dom.tr;var b=document.createElement("tr");b.appendChild(a("jsoneditor-td"));b.node=this;var c=document.createElement("td");b.appendChild(c);c.className="jsoneditor-td";var d=document.createElement("button");d.className="jsoneditor-append";d.title="Append a field";this.dom.append=d;c.appendChild(d);b.appendChild(a("jsoneditor-td jsoneditor-td-edit"));
|
||||||
b.appendChild(a("jsoneditor-td jsoneditor-td-edit"));b.appendChild(a("jsoneditor-td jsoneditor-td-edit"));this.dom.tr=b;this.dom.td=c;this.updateDom();return b};JSONEditor.AppendNode.prototype.updateDom=function(){var a=this.dom.td;if(a)a.style.paddingLeft=this.getLevel()*24+26+"px"};
|
b.appendChild(a("jsoneditor-td jsoneditor-td-edit"));b.appendChild(a("jsoneditor-td jsoneditor-td-edit"));this.dom.tr=b;this.dom.td=c;this.updateDom();return b};JSONEditor.AppendNode.prototype.updateDom=function(){var a=this.dom.td;if(a)a.style.paddingLeft=this.getLevel()*24+26+"px"};
|
||||||
JSONEditor.AppendNode.prototype.onEvent=function(a){var b=a.type;if((a.target||a.srcElement)==this.dom.append)switch(b){case "click":a=new JSONEditor.Node({field:"field",value:"value"});this.parent.appendChild(a);this.parent.setHighlight(!1);a.focus();break;case "mouseover":this.parent.setHighlight(!0);break;case "mouseout":this.parent.setHighlight(!1)}};
|
JSONEditor.AppendNode.prototype.onEvent=function(a){var b=a.type;if((a.target||a.srcElement)==this.dom.append)switch(b){case "click":a=new JSONEditor.Node({field:"field",value:"value"});this.parent.appendChild(a);this.parent.setHighlight(!1);a.focus();break;case "mouseover":this.parent.setHighlight(!0);break;case "mouseout":this.parent.setHighlight(!1)}};
|
||||||
|
|
|
@ -1990,8 +1990,8 @@ JSONEditor.Node.prototype._escape = function (text) {
|
||||||
.replace(/</g, '<')
|
.replace(/</g, '<')
|
||||||
.replace(/>/g, '>')
|
.replace(/>/g, '>')
|
||||||
.replace(/ /g, ' ') // replace double space with an nbsp and space
|
.replace(/ /g, ' ') // replace double space with an nbsp and space
|
||||||
.replace(/^ /, ' ') // space at start
|
.replace(/^ /, ' ') // space at start
|
||||||
.replace(/ $/, ' '); // space at end
|
.replace(/ $/, ' '); // space at end
|
||||||
|
|
||||||
var json = JSON.stringify(htmlEscaped);
|
var json = JSON.stringify(htmlEscaped);
|
||||||
return json.substring(1, json.length - 1);
|
return json.substring(1, json.length - 1);
|
||||||
|
|
Loading…
Reference in New Issue