|
|
|
@ -911,7 +911,7 @@ mxCell.prototype.getParent=function(){return this.parent};mxCell.prototype.setPa
|
|
|
|
|
mxCell.prototype.getChildAt=function(a){return null==this.children?null:this.children[a]};mxCell.prototype.insert=function(a,b){null!=a&&(null==b&&(b=this.getChildCount(),a.getParent()==this&&b--),a.removeFromParent(),a.setParent(this),null==this.children?(this.children=[],this.children.push(a)):this.children.splice(b,0,a));return a};mxCell.prototype.remove=function(a){var b=null;null!=this.children&&0<=a&&(b=this.getChildAt(a),null!=b&&(this.children.splice(a,1),b.setParent(null)));return b};
|
|
|
|
|
mxCell.prototype.removeFromParent=function(){if(null!=this.parent){var a=this.parent.getIndex(this);this.parent.remove(a)}};mxCell.prototype.getEdgeCount=function(){return null==this.edges?0:this.edges.length};mxCell.prototype.getEdgeIndex=function(a){return mxUtils.indexOf(this.edges,a)};mxCell.prototype.getEdgeAt=function(a){return null==this.edges?null:this.edges[a]};
|
|
|
|
|
mxCell.prototype.insertEdge=function(a,b){null!=a&&(a.removeFromTerminal(b),a.setTerminal(this,b),null==this.edges||a.getTerminal(!b)!=this||0>mxUtils.indexOf(this.edges,a))&&(null==this.edges&&(this.edges=[]),this.edges.push(a));return a};mxCell.prototype.removeEdge=function(a,b){if(null!=a){if(a.getTerminal(!b)!=this&&null!=this.edges){var c=this.getEdgeIndex(a);0<=c&&this.edges.splice(c,1)}a.setTerminal(null,b)}return a};
|
|
|
|
|
mxCell.prototype.removeFromTerminal=function(a){var b=this.getTerminal(a);null!=b&&b.removeEdge(this,a)};mxCell.prototype.hasAttribute=function(a){var b=this.getValue();return null!=b&&b.nodeType==mxConstants.NODETYPE_ELEMENT&&b.hasAttribute?b.hasAttribute(a):null!=b.getAttribute(a)};mxCell.prototype.getAttribute=function(a,b){var c=this.getValue();return(null!=c&&c.nodeType==mxConstants.NODETYPE_ELEMENT?c.getAttribute(a):null)||b};
|
|
|
|
|
mxCell.prototype.removeFromTerminal=function(a){var b=this.getTerminal(a);null!=b&&b.removeEdge(this,a)};mxCell.prototype.hasAttribute=function(a){var b=this.getValue();return null!=b&&b.nodeType==mxConstants.NODETYPE_ELEMENT&&b.hasAttribute?b.hasAttribute(a):null!=b.getAttribute(a)};mxCell.prototype.getAttribute=function(a,b){var c=this.getValue(),c=null!=c&&c.nodeType==mxConstants.NODETYPE_ELEMENT?c.getAttribute(a):null;return null!=c?c:b};
|
|
|
|
|
mxCell.prototype.setAttribute=function(a,b){var c=this.getValue();null!=c&&c.nodeType==mxConstants.NODETYPE_ELEMENT&&c.setAttribute(a,b)};mxCell.prototype.clone=function(){var a=mxUtils.clone(this,this.mxTransient);a.setValue(this.cloneValue());return a};mxCell.prototype.cloneValue=function(){var a=this.getValue();null!=a&&("function"==typeof a.clone?a=a.clone():isNaN(a.nodeType)||(a=a.cloneNode(!0)));return a};function mxGeometry(a,b,c,d){mxRectangle.call(this,a,b,c,d)}mxGeometry.prototype=new mxRectangle;
|
|
|
|
|
mxGeometry.prototype.constructor=mxGeometry;mxGeometry.prototype.TRANSLATE_CONTROL_POINTS=!0;mxGeometry.prototype.alternateBounds=null;mxGeometry.prototype.sourcePoint=null;mxGeometry.prototype.targetPoint=null;mxGeometry.prototype.points=null;mxGeometry.prototype.offset=null;mxGeometry.prototype.relative=!1;
|
|
|
|
|
mxGeometry.prototype.swap=function(){if(null!=this.alternateBounds){var a=new mxRectangle(this.x,this.y,this.width,this.height);this.x=this.alternateBounds.x;this.y=this.alternateBounds.y;this.width=this.alternateBounds.width;this.height=this.alternateBounds.height;this.alternateBounds=a}};mxGeometry.prototype.getTerminalPoint=function(a){return a?this.sourcePoint:this.targetPoint};mxGeometry.prototype.setTerminalPoint=function(a,b){b?this.sourcePoint=a:this.targetPoint=a;return a};
|
|
|
|
@ -1304,9 +1304,10 @@ mxConstants.STYLE_ENTRY_DY]),e=isFinite(e)?e:0,f=isFinite(f)?f:0);return new mxC
|
|
|
|
|
mxGraph.prototype.setConnectionConstraint=function(a,b,c,d){if(null!=d){this.model.beginUpdate();try{null==d||null==d.point?(this.setCellStyles(c?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,null,[a]),this.setCellStyles(c?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,null,[a]),this.setCellStyles(c?mxConstants.STYLE_EXIT_DX:mxConstants.STYLE_ENTRY_DX,null,[a]),this.setCellStyles(c?mxConstants.STYLE_EXIT_DY:mxConstants.STYLE_ENTRY_DY,null,[a]),this.setCellStyles(c?mxConstants.STYLE_EXIT_PERIMETER:
|
|
|
|
|
mxConstants.STYLE_ENTRY_PERIMETER,null,[a])):null!=d.point&&(this.setCellStyles(c?mxConstants.STYLE_EXIT_X:mxConstants.STYLE_ENTRY_X,d.point.x,[a]),this.setCellStyles(c?mxConstants.STYLE_EXIT_Y:mxConstants.STYLE_ENTRY_Y,d.point.y,[a]),this.setCellStyles(c?mxConstants.STYLE_EXIT_DX:mxConstants.STYLE_ENTRY_DX,d.dx,[a]),this.setCellStyles(c?mxConstants.STYLE_EXIT_DY:mxConstants.STYLE_ENTRY_DY,d.dy,[a]),d.perimeter?this.setCellStyles(c?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,
|
|
|
|
|
null,[a]):this.setCellStyles(c?mxConstants.STYLE_EXIT_PERIMETER:mxConstants.STYLE_ENTRY_PERIMETER,"0",[a]))}finally{this.model.endUpdate()}}};
|
|
|
|
|
mxGraph.prototype.getConnectionPoint=function(a,b,c){c=null!=c?c:!0;var d=null;if(null!=a&&null!=b.point){var e=this.view.getPerimeterBounds(a),f=new mxPoint(e.getCenterX(),e.getCenterY()),d=a.style[mxConstants.STYLE_DIRECTION],g=0;null!=d&&1==mxUtils.getValue(a.style,mxConstants.STYLE_ANCHOR_POINT_DIRECTION,1)&&(d==mxConstants.DIRECTION_NORTH?g+=270:d==mxConstants.DIRECTION_WEST?g+=180:d==mxConstants.DIRECTION_SOUTH&&(g+=90),d!=mxConstants.DIRECTION_NORTH&&d!=mxConstants.DIRECTION_SOUTH||e.rotate90());
|
|
|
|
|
var d=this.view.scale,d=new mxPoint(e.x+b.point.x*e.width+b.dx*d,e.y+b.point.y*e.height+b.dy*d),k=a.style[mxConstants.STYLE_ROTATION]||0;b.perimeter?(0!=g&&(b=e=0,90==g?b=1:180==g?e=-1:270==g&&(b=-1),d=mxUtils.getRotatedPoint(d,e,b,f)),d=this.view.getPerimeterPoint(a,d,!1)):(k+=g,this.getModel().isVertex(a.cell)&&(g=1==a.style[mxConstants.STYLE_FLIPH],b=1==a.style[mxConstants.STYLE_FLIPV],null!=a.shape&&null!=a.shape.stencil&&(g=1==mxUtils.getValue(a.style,"stencilFlipH",0)||g,b=1==mxUtils.getValue(a.style,
|
|
|
|
|
"stencilFlipV",0)||b),g&&(d.x=2*e.getCenterX()-d.x),b&&(d.y=2*e.getCenterY()-d.y)));0!=k&&null!=d&&(a=mxUtils.toRadians(k),e=Math.cos(a),b=Math.sin(a),d=mxUtils.getRotatedPoint(d,e,b,f))}c&&null!=d&&(d.x=Math.round(d.x),d.y=Math.round(d.y));return d};mxGraph.prototype.connectCell=function(a,b,c,d){this.model.beginUpdate();try{var e=this.model.getTerminal(a,c);this.cellConnected(a,b,c,d);this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL,"edge",a,"terminal",b,"source",c,"previous",e))}finally{this.model.endUpdate()}return a};
|
|
|
|
|
mxGraph.prototype.getConnectionPoint=function(a,b,c){c=null!=c?c:!0;var d=null;if(null!=a&&null!=b.point){var e=this.view.getPerimeterBounds(a),f=new mxPoint(e.getCenterX(),e.getCenterY()),g=a.style[mxConstants.STYLE_DIRECTION],k=0;null!=g&&1==mxUtils.getValue(a.style,mxConstants.STYLE_ANCHOR_POINT_DIRECTION,1)&&(g==mxConstants.DIRECTION_NORTH?k+=270:g==mxConstants.DIRECTION_WEST?k+=180:g==mxConstants.DIRECTION_SOUTH&&(k+=90),g!=mxConstants.DIRECTION_NORTH&&g!=mxConstants.DIRECTION_SOUTH||e.rotate90());
|
|
|
|
|
var d=this.view.scale,d=new mxPoint(e.x+b.point.x*e.width+b.dx*d,e.y+b.point.y*e.height+b.dy*d),l=a.style[mxConstants.STYLE_ROTATION]||0;if(b.perimeter)0!=k&&(g=e=0,90==k?g=1:180==k?e=-1:270==k&&(g=-1),d=mxUtils.getRotatedPoint(d,e,g,f)),d=this.view.getPerimeterPoint(a,d,!1);else if(l+=k,this.getModel().isVertex(a.cell)){k=1==a.style[mxConstants.STYLE_FLIPH];b=1==a.style[mxConstants.STYLE_FLIPV];null!=a.shape&&null!=a.shape.stencil&&(k=1==mxUtils.getValue(a.style,"stencilFlipH",0)||k,b=1==mxUtils.getValue(a.style,
|
|
|
|
|
"stencilFlipV",0)||b);if(g==mxConstants.DIRECTION_NORTH||g==mxConstants.DIRECTION_SOUTH)a=k,k=b,b=a;k&&(d.x=2*e.getCenterX()-d.x);b&&(d.y=2*e.getCenterY()-d.y)}0!=l&&null!=d&&(a=mxUtils.toRadians(l),e=Math.cos(a),g=Math.sin(a),d=mxUtils.getRotatedPoint(d,e,g,f))}c&&null!=d&&(d.x=Math.round(d.x),d.y=Math.round(d.y));return d};
|
|
|
|
|
mxGraph.prototype.connectCell=function(a,b,c,d){this.model.beginUpdate();try{var e=this.model.getTerminal(a,c);this.cellConnected(a,b,c,d);this.fireEvent(new mxEventObject(mxEvent.CONNECT_CELL,"edge",a,"terminal",b,"source",c,"previous",e))}finally{this.model.endUpdate()}return a};
|
|
|
|
|
mxGraph.prototype.cellConnected=function(a,b,c,d){if(null!=a){this.model.beginUpdate();try{var e=this.model.getTerminal(a,c);this.setConnectionConstraint(a,b,c,d);this.isPortsEnabled()&&(d=null,this.isPort(b)&&(d=b.getId(),b=this.getTerminalForPort(b,c)),this.setCellStyles(c?mxConstants.STYLE_SOURCE_PORT:mxConstants.STYLE_TARGET_PORT,d,[a]));this.model.setTerminal(a,b,c);this.resetEdgesOnConnect&&this.resetEdge(a);this.fireEvent(new mxEventObject(mxEvent.CELL_CONNECTED,"edge",a,"terminal",b,"source",
|
|
|
|
|
c,"previous",e))}finally{this.model.endUpdate()}}};
|
|
|
|
|
mxGraph.prototype.disconnectGraph=function(a){if(null!=a){this.model.beginUpdate();try{for(var b=this.view.scale,c=this.view.translate,d=new mxDictionary,e=0;e<a.length;e++)d.put(a[e],!0);for(e=0;e<a.length;e++)if(this.model.isEdge(a[e])){var f=this.model.getGeometry(a[e]);if(null!=f){var g=this.view.getState(a[e]),k=this.view.getState(this.model.getParent(a[e]));if(null!=g&&null!=k){var f=f.clone(),l=-k.origin.x,m=-k.origin.y,n=g.absolutePoints,p=this.model.getTerminal(a[e],!0);if(null!=p&&this.isCellDisconnectable(a[e],
|
|
|
|
@ -2023,11 +2024,11 @@ Editor.prototype.setFilename=function(a){this.filename=a};
|
|
|
|
|
Editor.prototype.createUndoManager=function(){var a=this.graph,b=new mxUndoManager;this.undoListener=function(a,e){b.undoableEditHappened(e.getProperty("edit"))};var e=mxUtils.bind(this,function(a,b){this.undoListener.apply(this,arguments)});a.getModel().addListener(mxEvent.UNDO,e);a.getView().addListener(mxEvent.UNDO,e);e=function(b,e){var d=a.getSelectionCellsForChanges(e.getProperty("edit").changes);a.getModel();for(var k=[],v=0;v<d.length;v++)null!=a.view.getState(d[v])&&k.push(d[v]);a.setSelectionCells(k)};
|
|
|
|
|
b.addListener(mxEvent.UNDO,e);b.addListener(mxEvent.REDO,e);return b};Editor.prototype.initStencilRegistry=function(){};Editor.prototype.destroy=function(){null!=this.graph&&(this.graph.destroy(),this.graph=null)};OpenFile=function(a){this.consumer=this.producer=null;this.done=a;this.args=null};OpenFile.prototype.setConsumer=function(a){this.consumer=a;this.execute()};OpenFile.prototype.setData=function(){this.args=arguments;this.execute()};OpenFile.prototype.error=function(a){this.cancel(!0);mxUtils.alert(a)};
|
|
|
|
|
OpenFile.prototype.execute=function(){null!=this.consumer&&null!=this.args&&(this.cancel(!1),this.consumer.apply(this,this.args))};OpenFile.prototype.cancel=function(a){null!=this.done&&this.done(null!=a?a:!0)};
|
|
|
|
|
function Dialog(a,b,e,d,k,m,p,v,z,B,c){var f=0;mxClient.IS_VML&&(null==document.documentMode||8>document.documentMode)&&(f=80);e+=f;d+=f;var g=e,q=d,n=mxUtils.getDocumentSize(),l=n.height,x=Math.max(1,Math.round((n.width-e-64)/2)),C=Math.max(1,Math.round((l-d-a.footerHeight)/3));mxClient.IS_QUIRKS||(b.style.maxHeight="100%");e=null!=document.body?Math.min(e,document.body.scrollWidth-64):e;d=Math.min(d,l-64);0<a.dialogs.length&&(this.zIndex+=2*a.dialogs.length);null==this.bg&&(this.bg=a.createDiv("background"),
|
|
|
|
|
this.bg.style.position="absolute",this.bg.style.background=Dialog.backdropColor,this.bg.style.height=l+"px",this.bg.style.right="0px",this.bg.style.zIndex=this.zIndex-2,mxUtils.setOpacity(this.bg,this.bgOpacity),mxClient.IS_QUIRKS&&new mxDivResizer(this.bg));n=mxUtils.getDocumentScrollOrigin(document);this.bg.style.left=n.x+"px";this.bg.style.top=n.y+"px";x+=n.x;C+=n.y;k&&document.body.appendChild(this.bg);var t=a.createDiv(z?"geTransDialog":"geDialog");k=this.getPosition(x,C,e,d);x=k.x;C=k.y;t.style.width=
|
|
|
|
|
e+"px";t.style.height=d+"px";t.style.left=x+"px";t.style.top=C+"px";t.style.zIndex=this.zIndex;t.appendChild(b);document.body.appendChild(t);!v&&b.clientHeight>t.clientHeight-64&&(b.style.overflowY="auto");m&&(m=document.createElement("img"),m.setAttribute("src",Dialog.prototype.closeImage),m.setAttribute("title",mxResources.get("close")),m.className="geDialogClose",m.style.top=C+14+"px",m.style.left=x+e+38-f+"px",m.style.zIndex=this.zIndex,mxEvent.addListener(m,"click",mxUtils.bind(this,function(){a.hideDialog(!0)})),
|
|
|
|
|
document.body.appendChild(m),this.dialogImg=m,c||mxEvent.addGestureListeners(this.bg,null,null,mxUtils.bind(this,function(c){a.hideDialog(!0)})));this.resizeListener=mxUtils.bind(this,function(){if(null!=B){var c=B();null!=c&&(g=e=c.w,q=d=c.h)}c=mxUtils.getDocumentSize();l=c.height;this.bg.style.height=l+"px";x=Math.max(1,Math.round((c.width-e-64)/2));C=Math.max(1,Math.round((l-d-a.footerHeight)/3));e=null!=document.body?Math.min(g,document.body.scrollWidth-64):g;d=Math.min(q,l-64);c=this.getPosition(x,
|
|
|
|
|
C,e,d);x=c.x;C=c.y;t.style.left=x+"px";t.style.top=C+"px";t.style.width=e+"px";t.style.height=d+"px";!v&&b.clientHeight>t.clientHeight-64&&(b.style.overflowY="auto");null!=this.dialogImg&&(this.dialogImg.style.top=C+14+"px",this.dialogImg.style.left=x+e+38-f+"px")});mxEvent.addListener(window,"resize",this.resizeListener);this.onDialogClose=p;this.container=t;a.editor.fireEvent(new mxEventObject("showDialog"))}Dialog.backdropColor="white";Dialog.prototype.zIndex=mxPopupMenu.prototype.zIndex-1;
|
|
|
|
|
function Dialog(a,b,e,d,k,m,p,v,z,B,c){var f=0;mxClient.IS_VML&&(null==document.documentMode||8>document.documentMode)&&(f=80);e+=f;d+=f;var g=e,q=d,n=mxUtils.getDocumentSize(),l=n.height,y=Math.max(1,Math.round((n.width-e-64)/2)),C=Math.max(1,Math.round((l-d-a.footerHeight)/3));mxClient.IS_QUIRKS||(b.style.maxHeight="100%");e=null!=document.body?Math.min(e,document.body.scrollWidth-64):e;d=Math.min(d,l-64);0<a.dialogs.length&&(this.zIndex+=2*a.dialogs.length);null==this.bg&&(this.bg=a.createDiv("background"),
|
|
|
|
|
this.bg.style.position="absolute",this.bg.style.background=Dialog.backdropColor,this.bg.style.height=l+"px",this.bg.style.right="0px",this.bg.style.zIndex=this.zIndex-2,mxUtils.setOpacity(this.bg,this.bgOpacity),mxClient.IS_QUIRKS&&new mxDivResizer(this.bg));n=mxUtils.getDocumentScrollOrigin(document);this.bg.style.left=n.x+"px";this.bg.style.top=n.y+"px";y+=n.x;C+=n.y;k&&document.body.appendChild(this.bg);var t=a.createDiv(z?"geTransDialog":"geDialog");k=this.getPosition(y,C,e,d);y=k.x;C=k.y;t.style.width=
|
|
|
|
|
e+"px";t.style.height=d+"px";t.style.left=y+"px";t.style.top=C+"px";t.style.zIndex=this.zIndex;t.appendChild(b);document.body.appendChild(t);!v&&b.clientHeight>t.clientHeight-64&&(b.style.overflowY="auto");m&&(m=document.createElement("img"),m.setAttribute("src",Dialog.prototype.closeImage),m.setAttribute("title",mxResources.get("close")),m.className="geDialogClose",m.style.top=C+14+"px",m.style.left=y+e+38-f+"px",m.style.zIndex=this.zIndex,mxEvent.addListener(m,"click",mxUtils.bind(this,function(){a.hideDialog(!0)})),
|
|
|
|
|
document.body.appendChild(m),this.dialogImg=m,c||mxEvent.addGestureListeners(this.bg,null,null,mxUtils.bind(this,function(c){a.hideDialog(!0)})));this.resizeListener=mxUtils.bind(this,function(){if(null!=B){var c=B();null!=c&&(g=e=c.w,q=d=c.h)}c=mxUtils.getDocumentSize();l=c.height;this.bg.style.height=l+"px";y=Math.max(1,Math.round((c.width-e-64)/2));C=Math.max(1,Math.round((l-d-a.footerHeight)/3));e=null!=document.body?Math.min(g,document.body.scrollWidth-64):g;d=Math.min(q,l-64);c=this.getPosition(y,
|
|
|
|
|
C,e,d);y=c.x;C=c.y;t.style.left=y+"px";t.style.top=C+"px";t.style.width=e+"px";t.style.height=d+"px";!v&&b.clientHeight>t.clientHeight-64&&(b.style.overflowY="auto");null!=this.dialogImg&&(this.dialogImg.style.top=C+14+"px",this.dialogImg.style.left=y+e+38-f+"px")});mxEvent.addListener(window,"resize",this.resizeListener);this.onDialogClose=p;this.container=t;a.editor.fireEvent(new mxEventObject("showDialog"))}Dialog.backdropColor="white";Dialog.prototype.zIndex=mxPopupMenu.prototype.zIndex-1;
|
|
|
|
|
Dialog.prototype.noColorImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyBpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBXaW5kb3dzIiB4bXBNTTpJbnN0YW5jZUlEPSJ4bXAuaWlkOkEzRDlBMUUwODYxMTExRTFCMzA4RDdDMjJBMEMxRDM3IiB4bXBNTTpEb2N1bWVudElEPSJ4bXAuZGlkOkEzRDlBMUUxODYxMTExRTFCMzA4RDdDMjJBMEMxRDM3Ij4gPHhtcE1NOkRlcml2ZWRGcm9tIHN0UmVmOmluc3RhbmNlSUQ9InhtcC5paWQ6QTNEOUExREU4NjExMTFFMUIzMDhEN0MyMkEwQzFEMzciIHN0UmVmOmRvY3VtZW50SUQ9InhtcC5kaWQ6QTNEOUExREY4NjExMTFFMUIzMDhEN0MyMkEwQzFEMzciLz4gPC9yZGY6RGVzY3JpcHRpb24+IDwvcmRmOlJERj4gPC94OnhtcG1ldGE+IDw/eHBhY2tldCBlbmQ9InIiPz5xh3fmAAAABlBMVEX////MzMw46qqDAAAAGElEQVR42mJggAJGKGAYIIGBth8KAAIMAEUQAIElnLuQAAAAAElFTkSuQmCC":
|
|
|
|
|
IMAGE_PATH+"/nocolor.png";Dialog.prototype.closeImage=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAkAAAAJAQMAAADaX5RTAAAABlBMVEV7mr3///+wksspAAAAAnRSTlP/AOW3MEoAAAAdSURBVAgdY9jXwCDDwNDRwHCwgeExmASygSL7GgB12QiqNHZZIwAAAABJRU5ErkJggg==":IMAGE_PATH+"/close.png";
|
|
|
|
|
Dialog.prototype.clearImage=mxClient.IS_SVG?"data:image/gif;base64,R0lGODlhDQAKAIABAMDAwP///yH/C1hNUCBEYXRhWE1QPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS4wLWMwNjAgNjEuMTM0Nzc3LCAyMDEwLzAyLzEyLTE3OjMyOjAwICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOnhtcE1NPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvbW0vIiB4bWxuczpzdFJlZj0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL3NUeXBlL1Jlc291cmNlUmVmIyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ1M1IFdpbmRvd3MiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6OUIzOEM1NzI4NjEyMTFFMUEzMkNDMUE3NjZERDE2QjIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6OUIzOEM1NzM4NjEyMTFFMUEzMkNDMUE3NjZERDE2QjIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo5QjM4QzU3MDg2MTIxMUUxQTMyQ0MxQTc2NkREMTZCMiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo5QjM4QzU3MTg2MTIxMUUxQTMyQ0MxQTc2NkREMTZCMiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PgH//v38+/r5+Pf29fTz8vHw7+7t7Ovq6ejn5uXk4+Lh4N/e3dzb2tnY19bV1NPS0dDPzs3My8rJyMfGxcTDwsHAv769vLu6ubi3trW0s7KxsK+urayrqqmop6alpKOioaCfnp2cm5qZmJeWlZSTkpGQj46NjIuKiYiHhoWEg4KBgH9+fXx7enl4d3Z1dHNycXBvbm1sa2ppaGdmZWRjYmFgX15dXFtaWVhXVlVUU1JRUE9OTUxLSklIR0ZFRENCQUA/Pj08Ozo5ODc2NTQzMjEwLy4tLCsqKSgnJiUkIyIhIB8eHRwbGhkYFxYVFBMSERAPDg0MCwoJCAcGBQQDAgEAACH5BAEAAAEALAAAAAANAAoAAAIXTGCJebD9jEOTqRlttXdrB32PJ2ncyRQAOw==":IMAGE_PATH+
|
|
|
|
@ -2059,10 +2060,10 @@ PageSetupDialog.addPageFormatPanel=function(a,b,e,d){function k(a,b,d){if(d||f!=
|
|
|
|
|
e.height==d.format.height?(v.value=d.key,m.setAttribute("checked","checked"),m.defaultChecked=!0,m.checked=!0,p.removeAttribute("checked"),p.defaultChecked=!1,p.checked=!1,a=!0):e.width==d.format.height&&e.height==d.format.width&&(v.value=d.key,m.removeAttribute("checked"),m.defaultChecked=!1,m.checked=!1,p.setAttribute("checked","checked"),p.defaultChecked=!0,a=p.checked=!0));a?(z.style.display="",c.style.display="none"):(f.value=e.width/100,g.value=e.height/100,m.setAttribute("checked","checked"),
|
|
|
|
|
v.value="custom",z.style.display="none",c.style.display="")}}b="format-"+b;var m=document.createElement("input");m.setAttribute("name",b);m.setAttribute("type","radio");m.setAttribute("value","portrait");var p=document.createElement("input");p.setAttribute("name",b);p.setAttribute("type","radio");p.setAttribute("value","landscape");var v=document.createElement("select");v.style.marginBottom="8px";v.style.width="202px";var z=document.createElement("div");z.style.marginLeft="4px";z.style.width="210px";
|
|
|
|
|
z.style.height="24px";m.style.marginRight="6px";z.appendChild(m);b=document.createElement("span");b.style.maxWidth="100px";mxUtils.write(b,mxResources.get("portrait"));z.appendChild(b);p.style.marginLeft="10px";p.style.marginRight="6px";z.appendChild(p);var B=document.createElement("span");B.style.width="100px";mxUtils.write(B,mxResources.get("landscape"));z.appendChild(B);var c=document.createElement("div");c.style.marginLeft="4px";c.style.width="210px";c.style.height="24px";var f=document.createElement("input");
|
|
|
|
|
f.setAttribute("size","7");f.style.textAlign="right";c.appendChild(f);mxUtils.write(c," in x ");var g=document.createElement("input");g.setAttribute("size","7");g.style.textAlign="right";c.appendChild(g);mxUtils.write(c," in");z.style.display="none";c.style.display="none";for(var q={},n=PageSetupDialog.getFormats(),l=0;l<n.length;l++){var x=n[l];q[x.key]=x;var C=document.createElement("option");C.setAttribute("value",x.key);mxUtils.write(C,x.title);v.appendChild(C)}var t=!1;k();a.appendChild(v);mxUtils.br(a);
|
|
|
|
|
a.appendChild(z);a.appendChild(c);var E=e,y=function(a,b){var l=q[v.value];null!=l.format?(f.value=l.format.width/100,g.value=l.format.height/100,c.style.display="none",z.style.display=""):(z.style.display="none",c.style.display="");l=parseFloat(f.value);if(isNaN(l)||0>=l)f.value=e.width/100;l=parseFloat(g.value);if(isNaN(l)||0>=l)g.value=e.height/100;l=new mxRectangle(0,0,Math.floor(100*parseFloat(f.value)),Math.floor(100*parseFloat(g.value)));"custom"!=v.value&&p.checked&&(l=new mxRectangle(0,0,
|
|
|
|
|
l.height,l.width));b&&t||l.width==E.width&&l.height==E.height||(E=l,null!=d&&d(E))};mxEvent.addListener(b,"click",function(a){m.checked=!0;y(a);mxEvent.consume(a)});mxEvent.addListener(B,"click",function(a){p.checked=!0;y(a);mxEvent.consume(a)});mxEvent.addListener(f,"blur",y);mxEvent.addListener(f,"click",y);mxEvent.addListener(g,"blur",y);mxEvent.addListener(g,"click",y);mxEvent.addListener(p,"change",y);mxEvent.addListener(m,"change",y);mxEvent.addListener(v,"change",function(a){t="custom"==v.value;
|
|
|
|
|
y(a,!0)});y();return{set:function(a){e=a;k(null,null,!0)},get:function(){return E},widthInput:f,heightInput:g}};
|
|
|
|
|
f.setAttribute("size","7");f.style.textAlign="right";c.appendChild(f);mxUtils.write(c," in x ");var g=document.createElement("input");g.setAttribute("size","7");g.style.textAlign="right";c.appendChild(g);mxUtils.write(c," in");z.style.display="none";c.style.display="none";for(var q={},n=PageSetupDialog.getFormats(),l=0;l<n.length;l++){var y=n[l];q[y.key]=y;var C=document.createElement("option");C.setAttribute("value",y.key);mxUtils.write(C,y.title);v.appendChild(C)}var t=!1;k();a.appendChild(v);mxUtils.br(a);
|
|
|
|
|
a.appendChild(z);a.appendChild(c);var E=e,x=function(a,b){var l=q[v.value];null!=l.format?(f.value=l.format.width/100,g.value=l.format.height/100,c.style.display="none",z.style.display=""):(z.style.display="none",c.style.display="");l=parseFloat(f.value);if(isNaN(l)||0>=l)f.value=e.width/100;l=parseFloat(g.value);if(isNaN(l)||0>=l)g.value=e.height/100;l=new mxRectangle(0,0,Math.floor(100*parseFloat(f.value)),Math.floor(100*parseFloat(g.value)));"custom"!=v.value&&p.checked&&(l=new mxRectangle(0,0,
|
|
|
|
|
l.height,l.width));b&&t||l.width==E.width&&l.height==E.height||(E=l,null!=d&&d(E))};mxEvent.addListener(b,"click",function(a){m.checked=!0;x(a);mxEvent.consume(a)});mxEvent.addListener(B,"click",function(a){p.checked=!0;x(a);mxEvent.consume(a)});mxEvent.addListener(f,"blur",x);mxEvent.addListener(f,"click",x);mxEvent.addListener(g,"blur",x);mxEvent.addListener(g,"click",x);mxEvent.addListener(p,"change",x);mxEvent.addListener(m,"change",x);mxEvent.addListener(v,"change",function(a){t="custom"==v.value;
|
|
|
|
|
x(a,!0)});x();return{set:function(a){e=a;k(null,null,!0)},get:function(){return E},widthInput:f,heightInput:g}};
|
|
|
|
|
PageSetupDialog.getFormats=function(){return[{key:"letter",title:'US-Letter (8,5" x 11")',format:mxConstants.PAGE_FORMAT_LETTER_PORTRAIT},{key:"legal",title:'US-Legal (8,5" x 14")',format:new mxRectangle(0,0,850,1400)},{key:"tabloid",title:'US-Tabloid (11" x 17")',format:new mxRectangle(0,0,1100,1700)},{key:"executive",title:'US-Executive (7" x 10")',format:new mxRectangle(0,0,700,1E3)},{key:"a0",title:"A0 (841 mm x 1189 mm)",format:new mxRectangle(0,0,3300,4681)},{key:"a1",title:"A1 (594 mm x 841 mm)",
|
|
|
|
|
format:new mxRectangle(0,0,2339,3300)},{key:"a2",title:"A2 (420 mm x 594 mm)",format:new mxRectangle(0,0,1654,2336)},{key:"a3",title:"A3 (297 mm x 420 mm)",format:new mxRectangle(0,0,1169,1654)},{key:"a4",title:"A4 (210 mm x 297 mm)",format:mxConstants.PAGE_FORMAT_A4_PORTRAIT},{key:"a5",title:"A5 (148 mm x 210 mm)",format:new mxRectangle(0,0,583,827)},{key:"a6",title:"A6 (105 mm x 148 mm)",format:new mxRectangle(0,0,413,583)},{key:"a7",title:"A7 (74 mm x 105 mm)",format:new mxRectangle(0,0,291,413)},
|
|
|
|
|
{key:"b4",title:"B4 (250 mm x 353 mm)",format:new mxRectangle(0,0,980,1390)},{key:"b5",title:"B5 (176 mm x 250 mm)",format:new mxRectangle(0,0,690,980)},{key:"16-9",title:"16:9 (1600 x 900)",format:new mxRectangle(0,0,1600,900)},{key:"16-10",title:"16:10 (1920 x 1200)",format:new mxRectangle(0,0,1920,1200)},{key:"4-3",title:"4:3 (1600 x 1200)",format:new mxRectangle(0,0,1600,1200)},{key:"custom",title:mxResources.get("custom"),format:null}]};
|
|
|
|
@ -2074,7 +2075,7 @@ c="url("+this.gridImage+")";var g=d=0;null!=a.view.backgroundPageShape&&(g=this.
|
|
|
|
|
b,a.container.className="geDiagramContainer geDiagramBackdrop",d.style.backgroundImage="none",d.style.backgroundColor=""):(a.container.className="geDiagramContainer",d.style.backgroundPosition=f,d.style.backgroundColor=b,d.style.backgroundImage=c)};mxGraphView.prototype.createSvgGrid=function(a){for(var b=this.graph.gridSize*this.scale;b<this.minGridSize;)b*=2;for(var d=this.gridSteps*b,c=[],f=1;f<this.gridSteps;f++){var g=f*b;c.push("M 0 "+g+" L "+d+" "+g+" M "+g+" 0 L "+g+" "+d)}return'<svg width="'+
|
|
|
|
|
d+'" height="'+d+'" xmlns="'+mxConstants.NS_SVG+'"><defs><pattern id="grid" width="'+d+'" height="'+d+'" patternUnits="userSpaceOnUse"><path d="'+c.join(" ")+'" fill="none" stroke="'+a+'" opacity="0.2" stroke-width="1"/><path d="M '+d+" 0 L 0 0 0 "+d+'" fill="none" stroke="'+a+'" stroke-width="1"/></pattern></defs><rect width="100%" height="100%" fill="url(#grid)"/></svg>'};var a=mxGraph.prototype.panGraph;mxGraph.prototype.panGraph=function(b,d){a.apply(this,arguments);if(null!=this.shiftPreview1){var e=
|
|
|
|
|
this.view.canvas;null!=e.ownerSVGElement&&(e=e.ownerSVGElement);var c=this.gridSize*this.view.scale*this.view.gridSteps,c=-Math.round(c-mxUtils.mod(this.view.translate.x*this.view.scale+b,c))+"px "+-Math.round(c-mxUtils.mod(this.view.translate.y*this.view.scale+d,c))+"px";e.style.backgroundPosition=c}};mxGraph.prototype.updatePageBreaks=function(a,b,d){var c=this.view.scale,f=this.view.translate,g=this.pageFormat,e=c*this.pageScale,n=this.view.getBackgroundPageBounds();b=n.width;d=n.height;var l=
|
|
|
|
|
new mxRectangle(c*f.x,c*f.y,g.width*e,g.height*e),x=(a=a&&Math.min(l.width,l.height)>this.minPageBreakDist)?Math.ceil(d/l.height)-1:0,C=a?Math.ceil(b/l.width)-1:0,t=n.x+b,k=n.y+d;null==this.horizontalPageBreaks&&0<x&&(this.horizontalPageBreaks=[]);null==this.verticalPageBreaks&&0<C&&(this.verticalPageBreaks=[]);a=mxUtils.bind(this,function(a){if(null!=a){for(var c=a==this.horizontalPageBreaks?x:C,f=0;f<=c;f++){var b=a==this.horizontalPageBreaks?[new mxPoint(Math.round(n.x),Math.round(n.y+(f+1)*l.height)),
|
|
|
|
|
new mxRectangle(c*f.x,c*f.y,g.width*e,g.height*e),y=(a=a&&Math.min(l.width,l.height)>this.minPageBreakDist)?Math.ceil(d/l.height)-1:0,C=a?Math.ceil(b/l.width)-1:0,t=n.x+b,k=n.y+d;null==this.horizontalPageBreaks&&0<y&&(this.horizontalPageBreaks=[]);null==this.verticalPageBreaks&&0<C&&(this.verticalPageBreaks=[]);a=mxUtils.bind(this,function(a){if(null!=a){for(var c=a==this.horizontalPageBreaks?y:C,f=0;f<=c;f++){var b=a==this.horizontalPageBreaks?[new mxPoint(Math.round(n.x),Math.round(n.y+(f+1)*l.height)),
|
|
|
|
|
new mxPoint(Math.round(t),Math.round(n.y+(f+1)*l.height))]:[new mxPoint(Math.round(n.x+(f+1)*l.width),Math.round(n.y)),new mxPoint(Math.round(n.x+(f+1)*l.width),Math.round(k))];null!=a[f]?(a[f].points=b,a[f].redraw()):(b=new mxPolyline(b,this.pageBreakColor),b.dialect=this.dialect,b.isDashed=this.pageBreakDashed,b.pointerEvents=!1,b.init(this.view.backgroundPane),b.redraw(),a[f]=b)}for(f=c;f<a.length;f++)a[f].destroy();a.splice(c,a.length-c)}});a(this.horizontalPageBreaks);a(this.verticalPageBreaks)};
|
|
|
|
|
var b=mxGraphHandler.prototype.shouldRemoveCellsFromParent;mxGraphHandler.prototype.shouldRemoveCellsFromParent=function(a,d,e){for(var c=0;c<d.length;c++)if(this.graph.getModel().isVertex(d[c])){var f=this.graph.getCellGeometry(d[c]);if(null!=f&&f.relative)return!1}return b.apply(this,arguments)};var e=mxConnectionHandler.prototype.createMarker;mxConnectionHandler.prototype.createMarker=function(){var a=e.apply(this,arguments);a.intersects=mxUtils.bind(this,function(b,d){return this.isConnecting()?
|
|
|
|
|
!0:mxCellMarker.prototype.intersects.apply(a,arguments)});return a};mxGraphView.prototype.createBackgroundPageShape=function(a){return new mxRectangleShape(a,"#ffffff",this.graph.defaultPageBorderColor)};mxGraphView.prototype.getBackgroundPageBounds=function(){var a=this.getGraphBounds(),b=0<a.width?a.x/this.scale-this.translate.x:0,d=0<a.height?a.y/this.scale-this.translate.y:0,c=this.graph.pageFormat,f=this.graph.pageScale,g=c.width*f,c=c.height*f,f=Math.floor(Math.min(0,b)/g),e=Math.floor(Math.min(0,
|
|
|
|
@ -2091,15 +2092,15 @@ function(a,c){return m||p.apply(this,arguments)};this.keydownHandler=mxUtils.bin
|
|
|
|
|
this.keyupHandler);var v=d.panningHandler.isForcePanningEvent;d.panningHandler.isForcePanningEvent=function(a){return v.apply(this,arguments)||m||mxEvent.isMouseEvent(a.getEvent())&&(this.usePopupTrigger||!mxEvent.isPopupTrigger(a.getEvent()))&&(!mxEvent.isControlDown(a.getEvent())&&mxEvent.isRightMouseButton(a.getEvent())||mxEvent.isMiddleMouseButton(a.getEvent()))};var z=d.cellEditor.isStopEditingEvent;d.cellEditor.isStopEditingEvent=function(a){return z.apply(this,arguments)||13==a.keyCode&&(!mxClient.IS_SF&&
|
|
|
|
|
mxEvent.isControlDown(a)||mxClient.IS_MAC&&mxEvent.isMetaDown(a)||mxClient.IS_SF&&mxEvent.isShiftDown(a))};var B=!1,c=null,f=null,g=null,q=mxUtils.bind(this,function(){if(null!=this.toolbar&&B!=d.cellEditor.isContentEditing()){for(var a=this.toolbar.container.firstChild,b=[];null!=a;){var e=a.nextSibling;0>mxUtils.indexOf(this.toolbar.staticElements,a)&&(a.parentNode.removeChild(a),b.push(a));a=e}a=this.toolbar.fontMenu;e=this.toolbar.sizeMenu;if(null==g)this.toolbar.createTextToolbar();else{for(var l=
|
|
|
|
|
0;l<g.length;l++)this.toolbar.container.appendChild(g[l]);this.toolbar.fontMenu=c;this.toolbar.sizeMenu=f}B=d.cellEditor.isContentEditing();c=a;f=e;g=b}}),n=this,l=d.cellEditor.startEditing;d.cellEditor.startEditing=function(){l.apply(this,arguments);q();if(d.cellEditor.isContentEditing()){var a=!1,c=function(){a||(a=!0,window.setTimeout(function(){for(var c=d.getSelectedElement();null!=c&&c.nodeType!=mxConstants.NODETYPE_ELEMENT;)c=c.parentNode;if(null!=c&&(c=mxUtils.getCurrentStyle(c),null!=c&&
|
|
|
|
|
null!=n.toolbar)){var f=c.fontFamily;"'"==f.charAt(0)&&(f=f.substring(1));"'"==f.charAt(f.length-1)&&(f=f.substring(0,f.length-1));n.toolbar.setFontName(f);n.toolbar.setFontSize(parseInt(c.fontSize))}a=!1},0))};mxEvent.addListener(d.cellEditor.textarea,"input",c);mxEvent.addListener(d.cellEditor.textarea,"touchend",c);mxEvent.addListener(d.cellEditor.textarea,"mouseup",c);mxEvent.addListener(d.cellEditor.textarea,"keyup",c);c()}};var x=d.cellEditor.stopEditing;d.cellEditor.stopEditing=function(a,
|
|
|
|
|
c){x.apply(this,arguments);q()};d.container.setAttribute("tabindex","0");d.container.style.cursor="default";if(window.self===window.top&&null!=d.container.parentNode)try{d.container.focus()}catch(N){}var C=d.fireMouseEvent;d.fireMouseEvent=function(a,c,f){a==mxEvent.MOUSE_DOWN&&this.container.focus();C.apply(this,arguments)};d.popupMenuHandler.autoExpand=!0;null!=this.menus&&(d.popupMenuHandler.factoryMethod=mxUtils.bind(this,function(a,c,f){this.menus.createPopupMenu(a,c,f)}));mxEvent.addGestureListeners(document,
|
|
|
|
|
null!=n.toolbar)){var f=c.fontFamily;"'"==f.charAt(0)&&(f=f.substring(1));"'"==f.charAt(f.length-1)&&(f=f.substring(0,f.length-1));n.toolbar.setFontName(f);n.toolbar.setFontSize(parseInt(c.fontSize))}a=!1},0))};mxEvent.addListener(d.cellEditor.textarea,"input",c);mxEvent.addListener(d.cellEditor.textarea,"touchend",c);mxEvent.addListener(d.cellEditor.textarea,"mouseup",c);mxEvent.addListener(d.cellEditor.textarea,"keyup",c);c()}};var y=d.cellEditor.stopEditing;d.cellEditor.stopEditing=function(a,
|
|
|
|
|
c){y.apply(this,arguments);q()};d.container.setAttribute("tabindex","0");d.container.style.cursor="default";if(window.self===window.top&&null!=d.container.parentNode)try{d.container.focus()}catch(N){}var C=d.fireMouseEvent;d.fireMouseEvent=function(a,c,f){a==mxEvent.MOUSE_DOWN&&this.container.focus();C.apply(this,arguments)};d.popupMenuHandler.autoExpand=!0;null!=this.menus&&(d.popupMenuHandler.factoryMethod=mxUtils.bind(this,function(a,c,f){this.menus.createPopupMenu(a,c,f)}));mxEvent.addGestureListeners(document,
|
|
|
|
|
mxUtils.bind(this,function(a){d.popupMenuHandler.hideMenu()}));this.keyHandler=this.createKeyHandler(a);this.getKeyHandler=function(){return keyHandler};var t="rounded shadow glass dashed dashPattern comic labelBackgroundColor".split(" "),E="shape edgeStyle curved rounded elbow comic jumpStyle jumpSize".split(" ");this.setDefaultStyle=function(a){try{var c=d.view.getState(a);if(null!=c){var f=a.clone();f.style="";var b=d.getCellStyle(f);a=[];var f=[],g;for(g in c.style)b[g]!=c.style[g]&&(a.push(c.style[g]),
|
|
|
|
|
f.push(g));for(var e=d.getModel().getStyle(c.cell),l=null!=e?e.split(";"):[],e=0;e<l.length;e++){var u=l[e],n=u.indexOf("=");if(0<=n){g=u.substring(0,n);var A=u.substring(n+1);null!=b[g]&&"none"==A&&(a.push(A),f.push(g))}}d.getModel().isEdge(c.cell)?d.currentEdgeStyle={}:d.currentVertexStyle={};this.fireEvent(new mxEventObject("styleChanged","keys",f,"values",a,"cells",[c.cell]))}}catch(G){this.handleError(G)}};this.clearDefaultStyle=function(){d.currentEdgeStyle=mxUtils.clone(d.defaultEdgeStyle);
|
|
|
|
|
d.currentVertexStyle=mxUtils.clone(d.defaultVertexStyle);this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[]))};var y=["fontFamily","fontSize","fontColor"],F="edgeStyle startArrow startFill startSize endArrow endFill endSize".split(" "),u=["startArrow startFill startSize sourcePerimeterSpacing endArrow endFill endSize targetPerimeterSpacing".split(" "),["strokeColor","strokeWidth"],["fillColor","gradientColor"],y,["opacity"],["align"],["html"]];for(a=0;a<u.length;a++)for(b=
|
|
|
|
|
0;b<u[a].length;b++)t.push(u[a][b]);for(a=0;a<E.length;a++)0>mxUtils.indexOf(t,E[a])&&t.push(E[a]);var A=function(a,c){var f=d.getModel();f.beginUpdate();try{if(c)for(var b=f.isEdge(n),g=b?d.currentEdgeStyle:d.currentVertexStyle,b=["fontSize","fontFamily","fontColor"],e=0;e<b.length;e++){var l=g[b[e]];null!=l&&d.setCellStyles(b[e],l,a)}else for(l=0;l<a.length;l++){for(var n=a[l],A=f.getStyle(n),q=null!=A?A.split(";"):[],x=t.slice(),e=0;e<q.length;e++){var C=q[e],y=C.indexOf("=");if(0<=y){var k=C.substring(0,
|
|
|
|
|
y),ca=mxUtils.indexOf(x,k);0<=ca&&x.splice(ca,1);for(var N=0;N<u.length;N++){var m=u[N];if(0<=mxUtils.indexOf(m,k))for(var v=0;v<m.length;v++){var Y=mxUtils.indexOf(x,m[v]);0<=Y&&x.splice(Y,1)}}}}for(var g=(b=f.isEdge(n))?d.currentEdgeStyle:d.currentVertexStyle,p=f.getStyle(n),e=0;e<x.length;e++){var k=x[e],F=g[k];null==F||"shape"==k&&!b||b&&!(0>mxUtils.indexOf(E,k))||(p=mxUtils.setStyle(p,k,F))}f.setStyle(n,p)}}finally{f.endUpdate()}};d.addListener("cellsInserted",function(a,c){A(c.getProperty("cells"))});
|
|
|
|
|
d.currentVertexStyle=mxUtils.clone(d.defaultVertexStyle);this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[]))};var x=["fontFamily","fontSize","fontColor"],F="edgeStyle startArrow startFill startSize endArrow endFill endSize".split(" "),u=["startArrow startFill startSize sourcePerimeterSpacing endArrow endFill endSize targetPerimeterSpacing".split(" "),["strokeColor","strokeWidth"],["fillColor","gradientColor"],x,["opacity"],["align"],["html"]];for(a=0;a<u.length;a++)for(b=
|
|
|
|
|
0;b<u[a].length;b++)t.push(u[a][b]);for(a=0;a<E.length;a++)0>mxUtils.indexOf(t,E[a])&&t.push(E[a]);var A=function(a,c){var f=d.getModel();f.beginUpdate();try{if(c)for(var b=f.isEdge(n),g=b?d.currentEdgeStyle:d.currentVertexStyle,b=["fontSize","fontFamily","fontColor"],e=0;e<b.length;e++){var l=g[b[e]];null!=l&&d.setCellStyles(b[e],l,a)}else for(l=0;l<a.length;l++){for(var n=a[l],A=f.getStyle(n),q=null!=A?A.split(";"):[],y=t.slice(),e=0;e<q.length;e++){var C=q[e],x=C.indexOf("=");if(0<=x){var k=C.substring(0,
|
|
|
|
|
x),ca=mxUtils.indexOf(y,k);0<=ca&&y.splice(ca,1);for(var N=0;N<u.length;N++){var m=u[N];if(0<=mxUtils.indexOf(m,k))for(var v=0;v<m.length;v++){var Y=mxUtils.indexOf(y,m[v]);0<=Y&&y.splice(Y,1)}}}}for(var g=(b=f.isEdge(n))?d.currentEdgeStyle:d.currentVertexStyle,p=f.getStyle(n),e=0;e<y.length;e++){var k=y[e],F=g[k];null==F||"shape"==k&&!b||b&&!(0>mxUtils.indexOf(E,k))||(p=mxUtils.setStyle(p,k,F))}f.setStyle(n,p)}}finally{f.endUpdate()}};d.addListener("cellsInserted",function(a,c){A(c.getProperty("cells"))});
|
|
|
|
|
d.addListener("textInserted",function(a,c){A(c.getProperty("cells"),!0)});d.connectionHandler.addListener(mxEvent.CONNECT,function(a,c){var f=[c.getProperty("cell")];c.getProperty("terminalInserted")&&f.push(c.getProperty("terminal"));A(f)});this.addListener("styleChanged",mxUtils.bind(this,function(a,c){var f=c.getProperty("cells"),b=!1,g=!1;if(0<f.length)for(var e=0;e<f.length&&(b=d.getModel().isVertex(f[e])||b,!(g=d.getModel().isEdge(f[e])||g)||!b);e++);else g=b=!0;for(var f=c.getProperty("keys"),
|
|
|
|
|
l=c.getProperty("values"),e=0;e<f.length;e++){var u=0<=mxUtils.indexOf(y,f[e]);if("strokeColor"!=f[e]||null!=l[e]&&"none"!=l[e])if(0<=mxUtils.indexOf(E,f[e]))g||0<=mxUtils.indexOf(F,f[e])?null==l[e]?delete d.currentEdgeStyle[f[e]]:d.currentEdgeStyle[f[e]]=l[e]:b&&0<=mxUtils.indexOf(t,f[e])&&(null==l[e]?delete d.currentVertexStyle[f[e]]:d.currentVertexStyle[f[e]]=l[e]);else if(0<=mxUtils.indexOf(t,f[e])){if(b||u)null==l[e]?delete d.currentVertexStyle[f[e]]:d.currentVertexStyle[f[e]]=l[e];if(g||u||
|
|
|
|
|
l=c.getProperty("values"),e=0;e<f.length;e++){var u=0<=mxUtils.indexOf(x,f[e]);if("strokeColor"!=f[e]||null!=l[e]&&"none"!=l[e])if(0<=mxUtils.indexOf(E,f[e]))g||0<=mxUtils.indexOf(F,f[e])?null==l[e]?delete d.currentEdgeStyle[f[e]]:d.currentEdgeStyle[f[e]]=l[e]:b&&0<=mxUtils.indexOf(t,f[e])&&(null==l[e]?delete d.currentVertexStyle[f[e]]:d.currentVertexStyle[f[e]]=l[e]);else if(0<=mxUtils.indexOf(t,f[e])){if(b||u)null==l[e]?delete d.currentVertexStyle[f[e]]:d.currentVertexStyle[f[e]]=l[e];if(g||u||
|
|
|
|
|
0<=mxUtils.indexOf(F,f[e]))null==l[e]?delete d.currentEdgeStyle[f[e]]:d.currentEdgeStyle[f[e]]=l[e]}}null!=this.toolbar&&(this.toolbar.setFontName(d.currentVertexStyle.fontFamily||Menus.prototype.defaultFont),this.toolbar.setFontSize(d.currentVertexStyle.fontSize||Menus.prototype.defaultFontSize),null!=this.toolbar.edgeStyleMenu&&(this.toolbar.edgeStyleMenu.getElementsByTagName("div")[0].className="orthogonalEdgeStyle"==d.currentEdgeStyle.edgeStyle&&"1"==d.currentEdgeStyle.curved?"geSprite geSprite-curved":
|
|
|
|
|
"straight"==d.currentEdgeStyle.edgeStyle||"none"==d.currentEdgeStyle.edgeStyle||null==d.currentEdgeStyle.edgeStyle?"geSprite geSprite-straight":"entityRelationEdgeStyle"==d.currentEdgeStyle.edgeStyle?"geSprite geSprite-entity":"elbowEdgeStyle"==d.currentEdgeStyle.edgeStyle?"geSprite geSprite-"+("vertical"==d.currentEdgeStyle.elbow?"verticalelbow":"horizontalelbow"):"isometricEdgeStyle"==d.currentEdgeStyle.edgeStyle?"geSprite geSprite-"+("vertical"==d.currentEdgeStyle.elbow?"verticalisometric":"horizontalisometric"):
|
|
|
|
|
"geSprite geSprite-orthogonal"),null!=this.toolbar.edgeShapeMenu&&(this.toolbar.edgeShapeMenu.getElementsByTagName("div")[0].className="link"==d.currentEdgeStyle.shape?"geSprite geSprite-linkedge":"flexArrow"==d.currentEdgeStyle.shape?"geSprite geSprite-arrow":"arrow"==d.currentEdgeStyle.shape?"geSprite geSprite-simplearrow":"geSprite geSprite-connection"),null!=this.toolbar.lineStartMenu&&(this.toolbar.lineStartMenu.getElementsByTagName("div")[0].className=this.getCssClassForMarker("start",d.currentEdgeStyle.shape,
|
|
|
|
@ -2123,8 +2124,8 @@ EditorUi.prototype.initClipboard=function(){var a=this,b=mxClipboard.cut;mxClipb
|
|
|
|
|
var k=this.editor.graph.cellEditor.stopEditing;this.editor.graph.cellEditor.stopEditing=function(b,d){k.apply(this,arguments);a.updatePasteActionStates()};this.updatePasteActionStates()};EditorUi.prototype.lazyZoomDelay=20;
|
|
|
|
|
EditorUi.prototype.initCanvas=function(){var a=this.editor.graph;a.timerAutoScroll=!0;a.getPagePadding=function(){return new mxPoint(Math.max(0,Math.round((a.container.offsetWidth-34)/a.view.scale)),Math.max(0,Math.round((a.container.offsetHeight-34)/a.view.scale)))};a.view.getBackgroundPageBounds=function(){var a=this.graph.getPageLayout(),c=this.graph.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*c.width),this.scale*(this.translate.y+a.y*c.height),this.scale*a.width*c.width,
|
|
|
|
|
this.scale*a.height*c.height)};a.getPreferredPageSize=function(a,c,f){a=this.getPageLayout();c=this.getPageSize();return new mxRectangle(0,0,a.width*c.width,a.height*c.height)};var b=null,e=this;if(this.editor.isChromelessView()){this.chromelessResize=b=mxUtils.bind(this,function(c,f,b,d){if(null!=a.container&&!a.isViewer()){b=null!=b?b:0;d=null!=d?d:0;var g=a.pageVisible?a.view.getBackgroundPageBounds():a.getGraphBounds(),e=mxUtils.hasScrollbars(a.container),l=a.view.translate,u=a.view.scale,n=mxRectangle.fromRectangle(g);
|
|
|
|
|
n.x=n.x/u-l.x;n.y=n.y/u-l.y;n.width/=u;n.height/=u;var l=a.container.scrollTop,q=a.container.scrollLeft,A=mxClient.IS_QUIRKS||8<=document.documentMode?20:14;if(8==document.documentMode||9==document.documentMode)A+=3;var t=a.container.offsetWidth-A,A=a.container.offsetHeight-A;c=c?Math.max(.3,Math.min(f||1,t/n.width)):u;f=(t-c*n.width)/2/c;var x=0==this.lightboxVerticalDivider?0:(A-c*n.height)/this.lightboxVerticalDivider/c;e&&(f=Math.max(f,0),x=Math.max(x,0));if(e||g.width<t||g.height<A)a.view.scaleAndTranslate(c,
|
|
|
|
|
Math.floor(f-n.x),Math.floor(x-n.y)),a.container.scrollTop=l*c/u,a.container.scrollLeft=q*c/u;else if(0!=b||0!=d)g=a.view.translate,a.view.setTranslate(Math.floor(g.x+b/u),Math.floor(g.y+d/u))}});this.chromelessWindowResize=mxUtils.bind(this,function(){this.chromelessResize(!1)});var d=mxUtils.bind(this,function(){this.chromelessWindowResize(!1)});mxEvent.addListener(window,"resize",d);this.destroyFunctions.push(function(){mxEvent.removeListener(window,"resize",d)});this.editor.addListener("resetGraphView",
|
|
|
|
|
n.x=n.x/u-l.x;n.y=n.y/u-l.y;n.width/=u;n.height/=u;var l=a.container.scrollTop,q=a.container.scrollLeft,A=mxClient.IS_QUIRKS||8<=document.documentMode?20:14;if(8==document.documentMode||9==document.documentMode)A+=3;var t=a.container.offsetWidth-A,A=a.container.offsetHeight-A;c=c?Math.max(.3,Math.min(f||1,t/n.width)):u;f=(t-c*n.width)/2/c;var y=0==this.lightboxVerticalDivider?0:(A-c*n.height)/this.lightboxVerticalDivider/c;e&&(f=Math.max(f,0),y=Math.max(y,0));if(e||g.width<t||g.height<A)a.view.scaleAndTranslate(c,
|
|
|
|
|
Math.floor(f-n.x),Math.floor(y-n.y)),a.container.scrollTop=l*c/u,a.container.scrollLeft=q*c/u;else if(0!=b||0!=d)g=a.view.translate,a.view.setTranslate(Math.floor(g.x+b/u),Math.floor(g.y+d/u))}});this.chromelessWindowResize=mxUtils.bind(this,function(){this.chromelessResize(!1)});var d=mxUtils.bind(this,function(){this.chromelessWindowResize(!1)});mxEvent.addListener(window,"resize",d);this.destroyFunctions.push(function(){mxEvent.removeListener(window,"resize",d)});this.editor.addListener("resetGraphView",
|
|
|
|
|
mxUtils.bind(this,function(){this.chromelessResize(!0)}));this.actions.get("zoomIn").funct=mxUtils.bind(this,function(c){a.zoomIn();this.chromelessResize(!1)});this.actions.get("zoomOut").funct=mxUtils.bind(this,function(c){a.zoomOut();this.chromelessResize(!1)});if("0"!=urlParams.toolbar){var k=JSON.parse(decodeURIComponent(urlParams["toolbar-config"]||"{}"));this.chromelessToolbar=document.createElement("div");this.chromelessToolbar.style.position="fixed";this.chromelessToolbar.style.overflow="hidden";
|
|
|
|
|
this.chromelessToolbar.style.boxSizing="border-box";this.chromelessToolbar.style.whiteSpace="nowrap";this.chromelessToolbar.style.backgroundColor="#000000";this.chromelessToolbar.style.padding="10px 10px 8px 10px";this.chromelessToolbar.style.left=a.isViewer()?"0":"50%";mxClient.IS_VML||(mxUtils.setPrefixedStyle(this.chromelessToolbar.style,"borderRadius","20px"),mxUtils.setPrefixedStyle(this.chromelessToolbar.style,"transition","opacity 600ms ease-in-out"));var m=mxUtils.bind(this,function(){var c=
|
|
|
|
|
mxUtils.getCurrentStyle(a.container);a.isViewer()?this.chromelessToolbar.style.top="0":this.chromelessToolbar.style.bottom=(null!=c?parseInt(c["margin-bottom"]||0):0)+(null!=this.tabContainer?20+parseInt(this.tabContainer.style.height):20)+"px"});this.editor.addListener("resetGraphView",m);m();var p=0,m=mxUtils.bind(this,function(a,c,f){p++;var b=document.createElement("span");b.style.paddingLeft="8px";b.style.paddingRight="8px";b.style.cursor="pointer";mxEvent.addListener(b,"click",a);null!=f&&b.setAttribute("title",
|
|
|
|
@ -2133,15 +2134,15 @@ z.style.display="inline-block";z.style.verticalAlign="top";z.style.fontFamily="H
|
|
|
|
|
this.currentPage)+1+" / "+this.pages.length))});v.style.paddingLeft="0px";v.style.paddingRight="4px";B.style.paddingLeft="4px";B.style.paddingRight="0px";var f=mxUtils.bind(this,function(){null!=this.pages&&1<this.pages.length&&null!=this.currentPage?(B.style.display="",v.style.display="",z.style.display="inline-block"):(B.style.display="none",v.style.display="none",z.style.display="none");c()});this.editor.addListener("resetGraphView",f);this.editor.addListener("pageSelected",c);m(mxUtils.bind(this,
|
|
|
|
|
function(a){this.actions.get("zoomOut").funct();mxEvent.consume(a)}),Editor.zoomOutLargeImage,mxResources.get("zoomOut")+" (Alt+Mousewheel)");m(mxUtils.bind(this,function(a){this.actions.get("zoomIn").funct();mxEvent.consume(a)}),Editor.zoomInLargeImage,mxResources.get("zoomIn")+" (Alt+Mousewheel)");m(mxUtils.bind(this,function(c){a.isLightboxView()?(1==a.view.scale?this.lightboxFit():a.zoomTo(1),this.chromelessResize(!1)):this.chromelessResize(!0);mxEvent.consume(c)}),Editor.actualSizeLargeImage,
|
|
|
|
|
mxResources.get("fit"));var g=null,q=null,n=mxUtils.bind(this,function(a){null!=g&&(window.clearTimeout(g),fadeThead=null);null!=q&&(window.clearTimeout(q),fadeThead2=null);g=window.setTimeout(mxUtils.bind(this,function(){mxUtils.setOpacity(this.chromelessToolbar,0);g=null;q=window.setTimeout(mxUtils.bind(this,function(){this.chromelessToolbar.style.display="none";q=null}),600)}),a||200)}),l=mxUtils.bind(this,function(a){null!=g&&(window.clearTimeout(g),fadeThead=null);null!=q&&(window.clearTimeout(q),
|
|
|
|
|
fadeThead2=null);this.chromelessToolbar.style.display="";mxUtils.setOpacity(this.chromelessToolbar,a||30)});if("1"==urlParams.layers){this.layersDialog=null;var x=m(mxUtils.bind(this,function(c){if(null!=this.layersDialog)this.layersDialog.parentNode.removeChild(this.layersDialog),this.layersDialog=null;else{this.layersDialog=a.createLayersDialog();mxEvent.addListener(this.layersDialog,"mouseleave",mxUtils.bind(this,function(){this.layersDialog.parentNode.removeChild(this.layersDialog);this.layersDialog=
|
|
|
|
|
null}));var f=x.getBoundingClientRect();mxUtils.setPrefixedStyle(this.layersDialog.style,"borderRadius","5px");this.layersDialog.style.position="fixed";this.layersDialog.style.fontFamily="Helvetica,Arial";this.layersDialog.style.backgroundColor="#000000";this.layersDialog.style.width="160px";this.layersDialog.style.padding="4px 2px 4px 2px";this.layersDialog.style.color="#ffffff";mxUtils.setOpacity(this.layersDialog,70);this.layersDialog.style.left=f.left+"px";this.layersDialog.style.bottom=parseInt(this.chromelessToolbar.style.bottom)+
|
|
|
|
|
this.chromelessToolbar.offsetHeight+4+"px";f=mxUtils.getCurrentStyle(this.editor.graph.container);this.layersDialog.style.zIndex=f.zIndex;document.body.appendChild(this.layersDialog)}mxEvent.consume(c)}),Editor.layersLargeImage,mxResources.get("layers")),C=a.getModel();C.addListener(mxEvent.CHANGE,function(){x.style.display=1<C.getChildCount(C.root)?"":"none"})}this.addChromelessToolbarItems(m);null==this.editor.editButtonLink&&null==this.editor.editButtonFunc||m(mxUtils.bind(this,function(c){null!=
|
|
|
|
|
fadeThead2=null);this.chromelessToolbar.style.display="";mxUtils.setOpacity(this.chromelessToolbar,a||30)});if("1"==urlParams.layers){this.layersDialog=null;var y=m(mxUtils.bind(this,function(c){if(null!=this.layersDialog)this.layersDialog.parentNode.removeChild(this.layersDialog),this.layersDialog=null;else{this.layersDialog=a.createLayersDialog();mxEvent.addListener(this.layersDialog,"mouseleave",mxUtils.bind(this,function(){this.layersDialog.parentNode.removeChild(this.layersDialog);this.layersDialog=
|
|
|
|
|
null}));var f=y.getBoundingClientRect();mxUtils.setPrefixedStyle(this.layersDialog.style,"borderRadius","5px");this.layersDialog.style.position="fixed";this.layersDialog.style.fontFamily="Helvetica,Arial";this.layersDialog.style.backgroundColor="#000000";this.layersDialog.style.width="160px";this.layersDialog.style.padding="4px 2px 4px 2px";this.layersDialog.style.color="#ffffff";mxUtils.setOpacity(this.layersDialog,70);this.layersDialog.style.left=f.left+"px";this.layersDialog.style.bottom=parseInt(this.chromelessToolbar.style.bottom)+
|
|
|
|
|
this.chromelessToolbar.offsetHeight+4+"px";f=mxUtils.getCurrentStyle(this.editor.graph.container);this.layersDialog.style.zIndex=f.zIndex;document.body.appendChild(this.layersDialog)}mxEvent.consume(c)}),Editor.layersLargeImage,mxResources.get("layers")),C=a.getModel();C.addListener(mxEvent.CHANGE,function(){y.style.display=1<C.getChildCount(C.root)?"":"none"})}this.addChromelessToolbarItems(m);null==this.editor.editButtonLink&&null==this.editor.editButtonFunc||m(mxUtils.bind(this,function(c){null!=
|
|
|
|
|
this.editor.editButtonFunc?this.editor.editButtonFunc():"_blank"==this.editor.editButtonLink?this.editor.editAsNew(this.getEditBlankXml()):a.openLink(this.editor.editButtonLink,"editWindow");mxEvent.consume(c)}),Editor.editLargeImage,mxResources.get("edit"));if(null!=this.lightboxToolbarActions)for(f=0;f<this.lightboxToolbarActions.length;f++){var t=this.lightboxToolbarActions[f];m(t.fn,t.icon,t.tooltip)}null!=k.refreshBtn&&m(mxUtils.bind(this,function(a){k.refreshBtn.url?window.location.href=k.refreshBtn.url:
|
|
|
|
|
window.location.reload();mxEvent.consume(a)}),Editor.refreshLargeImage,mxResources.get("refresh",null,"Refresh"));null!=k.fullscreenBtn&&window.self!==window.top&&m(mxUtils.bind(this,function(c){k.fullscreenBtn.url?a.openLink(k.fullscreenBtn.url):a.openLink(window.location.href);mxEvent.consume(c)}),Editor.fullscreenLargeImage,mxResources.get("openInNewWindow",null,"Open in New Window"));(k.closeBtn&&window.self===window.top||a.lightbox&&("1"==urlParams.close||this.container!=document.body))&&m(mxUtils.bind(this,
|
|
|
|
|
function(a){"1"==urlParams.close||k.closeBtn?window.close():(this.destroy(),mxEvent.consume(a))}),Editor.closeLargeImage,mxResources.get("close")+" (Escape)");this.chromelessToolbar.style.display="none";a.isViewer()||mxUtils.setPrefixedStyle(this.chromelessToolbar.style,"transform","translate(-50%,0)");a.container.appendChild(this.chromelessToolbar);mxEvent.addListener(a.container,mxClient.IS_POINTER?"pointermove":"mousemove",mxUtils.bind(this,function(a){mxEvent.isTouchEvent(a)||(mxEvent.isShiftDown(a)||
|
|
|
|
|
l(30),n())}));mxEvent.addListener(this.chromelessToolbar,mxClient.IS_POINTER?"pointermove":"mousemove",function(a){mxEvent.consume(a)});mxEvent.addListener(this.chromelessToolbar,"mouseenter",mxUtils.bind(this,function(a){mxEvent.isShiftDown(a)?n():l(100)}));mxEvent.addListener(this.chromelessToolbar,"mousemove",mxUtils.bind(this,function(a){mxEvent.isShiftDown(a)?n():l(100);mxEvent.consume(a)}));mxEvent.addListener(this.chromelessToolbar,"mouseleave",mxUtils.bind(this,function(a){mxEvent.isTouchEvent(a)||
|
|
|
|
|
l(30)}));var E=a.getTolerance();a.addMouseListener({startX:0,startY:0,scrollLeft:0,scrollTop:0,mouseDown:function(c,f){this.startX=f.getGraphX();this.startY=f.getGraphY();this.scrollLeft=a.container.scrollLeft;this.scrollTop=a.container.scrollTop},mouseMove:function(a,c){},mouseUp:function(c,f){mxEvent.isTouchEvent(f.getEvent())&&Math.abs(this.scrollLeft-a.container.scrollLeft)<E&&Math.abs(this.scrollTop-a.container.scrollTop)<E&&Math.abs(this.startX-f.getGraphX())<E&&Math.abs(this.startY-f.getGraphY())<
|
|
|
|
|
E&&(0<parseFloat(e.chromelessToolbar.style.opacity||0)?n():l(30))}})}this.editor.editable||this.addChromelessClickHandler()}else if(this.editor.extendCanvas){var y=a.view.validate;a.view.validate=function(){if(null!=this.graph.container&&mxUtils.hasScrollbars(this.graph.container)){var a=this.graph.getPagePadding(),c=this.graph.getPageSize();this.translate.x=a.x-(this.x0||0)*c.width;this.translate.y=a.y-(this.y0||0)*c.height}y.apply(this,arguments)};if(!a.isViewer()){var F=a.sizeDidChange;a.sizeDidChange=
|
|
|
|
|
E&&(0<parseFloat(e.chromelessToolbar.style.opacity||0)?n():l(30))}})}this.editor.editable||this.addChromelessClickHandler()}else if(this.editor.extendCanvas){var x=a.view.validate;a.view.validate=function(){if(null!=this.graph.container&&mxUtils.hasScrollbars(this.graph.container)){var a=this.graph.getPagePadding(),c=this.graph.getPageSize();this.translate.x=a.x-(this.x0||0)*c.width;this.translate.y=a.y-(this.y0||0)*c.height}x.apply(this,arguments)};if(!a.isViewer()){var F=a.sizeDidChange;a.sizeDidChange=
|
|
|
|
|
function(){if(null!=this.container&&mxUtils.hasScrollbars(this.container)){var c=this.getPageLayout(),f=this.getPagePadding(),b=this.getPageSize(),d=Math.ceil(2*f.x+c.width*b.width),g=Math.ceil(2*f.y+c.height*b.height),e=a.minimumGraphSize;if(null==e||e.width!=d||e.height!=g)a.minimumGraphSize=new mxRectangle(0,0,d,g);d=f.x-c.x*b.width;f=f.y-c.y*b.height;this.autoTranslate||this.view.translate.x==d&&this.view.translate.y==f?F.apply(this,arguments):(this.autoTranslate=!0,this.view.x0=c.x,this.view.y0=
|
|
|
|
|
c.y,c=a.view.translate.x,b=a.view.translate.y,a.view.setTranslate(d,f),a.container.scrollLeft+=Math.round((d-c)*a.view.scale),a.container.scrollTop+=Math.round((f-b)*a.view.scale),this.autoTranslate=!1)}else this.fireEvent(new mxEventObject(mxEvent.SIZE,"bounds",this.getGraphBounds()))}}}a.updateZoomTimeout=null;a.cumulativeZoomFactor=1;var u=null;a.lazyZoom=function(c){null!=this.updateZoomTimeout&&window.clearTimeout(this.updateZoomTimeout);c?.15>this.view.scale*this.cumulativeZoomFactor?this.cumulativeZoomFactor=
|
|
|
|
|
(this.view.scale+.01)/this.view.scale:(this.cumulativeZoomFactor*=this.zoomFactor,this.cumulativeZoomFactor=Math.round(this.view.scale*this.cumulativeZoomFactor*20)/20/this.view.scale):.15>=this.view.scale*this.cumulativeZoomFactor?this.cumulativeZoomFactor=(this.view.scale-.01)/this.view.scale:(this.cumulativeZoomFactor/=this.zoomFactor,this.cumulativeZoomFactor=Math.round(this.view.scale*this.cumulativeZoomFactor*20)/20/this.view.scale);this.cumulativeZoomFactor=Math.max(.01,Math.min(this.view.scale*
|
|
|
|
@ -2215,13 +2216,13 @@ EditorUi.prototype.createKeyHandler=function(a){function b(a,c,b){p.push(functio
|
|
|
|
|
d.getSelectionCell(),g=d.model.getParent(f),e=null,1==d.getSelectionCount()&&d.model.isVertex(f)&&null!=d.layoutManager&&!d.isCellLocked(f)&&(e=d.layoutManager.getLayout(g)),null!=e&&e.constructor==mxStackLayout?(e=g.getIndex(f),37==a||38==a?d.model.add(g,f,Math.max(0,e-1)):39!=a&&40!=a||d.model.add(g,f,Math.min(d.model.getChildCount(g),e+1))):(g=f=0,37==a?f=-c:38==a?g=-c:39==a?f=c:40==a&&(g=c),d.moveCells(d.getMovableCells(d.getSelectionCells()),f,g))});null!=v&&window.clearTimeout(v);v=window.setTimeout(function(){if(0<
|
|
|
|
|
p.length){d.getModel().beginUpdate();try{for(var a=0;a<p.length;a++)p[a]();p=[]}finally{d.getModel().endUpdate()}d.scrollCellToVisible(d.getSelectionCell())}},200)}var e=this,d=this.editor.graph,k=new mxKeyHandler(d),m=k.isEventIgnored;k.isEventIgnored=function(a){return(!this.isControlDown(a)||mxEvent.isShiftDown(a)||90!=a.keyCode&&89!=a.keyCode&&188!=a.keyCode&&190!=a.keyCode&&85!=a.keyCode)&&(66!=a.keyCode&&73!=a.keyCode||!this.isControlDown(a)||this.graph.cellEditor.isContentEditing()&&!mxClient.IS_FF&&
|
|
|
|
|
!mxClient.IS_SF)&&m.apply(this,arguments)};k.isEnabledForEvent=function(a){return!mxEvent.isConsumed(a)&&this.isGraphEvent(a)&&this.isEnabled()&&(null==e.dialogs||0==e.dialogs.length)};k.isControlDown=function(a){return mxEvent.isControlDown(a)||mxClient.IS_MAC&&a.metaKey};var p=[],v=null,z={37:mxConstants.DIRECTION_WEST,38:mxConstants.DIRECTION_NORTH,39:mxConstants.DIRECTION_EAST,40:mxConstants.DIRECTION_SOUTH},B=k.getFunction;mxKeyHandler.prototype.getFunction=function(a){if(d.isEnabled()){if(mxEvent.isShiftDown(a)&&
|
|
|
|
|
mxEvent.isAltDown(a)){var c=e.actions.get(e.altShiftActions[a.keyCode]);if(null!=c)return c.funct}if(9==a.keyCode&&mxEvent.isAltDown(a))return mxEvent.isShiftDown(a)?function(){d.selectParentCell()}:function(){d.selectChildCell()};if(null!=z[a.keyCode]&&!d.isSelectionEmpty())if(mxEvent.isShiftDown(a)&&mxEvent.isAltDown(a)){if(d.model.isVertex(d.getSelectionCell()))return function(){var c=d.connectVertex(d.getSelectionCell(),z[a.keyCode],d.defaultEdgeLength,a,!0);null!=c&&0<c.length&&(1==c.length&&
|
|
|
|
|
d.model.isEdge(c[0])?d.setSelectionCell(d.model.getTerminal(c[0],!1)):d.setSelectionCell(c[c.length-1]),d.scrollCellToVisible(d.getSelectionCell()),null!=e.hoverIcons&&e.hoverIcons.update(d.view.getState(d.getSelectionCell())))}}else return this.isControlDown(a)?function(){b(a.keyCode,mxEvent.isShiftDown(a)?d.gridSize:null,!0)}:function(){b(a.keyCode,mxEvent.isShiftDown(a)?d.gridSize:null)}}return B.apply(this,arguments)};k.bindAction=mxUtils.bind(this,function(a,c,b,d){var f=this.actions.get(b);
|
|
|
|
|
null!=f&&(b=function(){f.isEnabled()&&f.funct()},c?d?k.bindControlShiftKey(a,b):k.bindControlKey(a,b):d?k.bindShiftKey(a,b):k.bindKey(a,b))});var c=k.escape;k.escape=function(a){c.apply(this,arguments)};k.enter=function(){};k.bindControlShiftKey(36,function(){d.exitGroup()});k.bindControlShiftKey(35,function(){d.enterGroup()});k.bindKey(36,function(){d.home()});k.bindKey(35,function(){d.refresh()});k.bindAction(107,!0,"zoomIn");k.bindAction(109,!0,"zoomOut");k.bindAction(80,!0,"print");k.bindAction(79,
|
|
|
|
|
!0,"outline",!0);k.bindAction(112,!1,"about");if(!this.editor.chromeless||this.editor.editable)k.bindControlKey(36,function(){d.isEnabled()&&d.foldCells(!0)}),k.bindControlKey(35,function(){d.isEnabled()&&d.foldCells(!1)}),k.bindControlKey(13,function(){d.isEnabled()&&d.setSelectionCells(d.duplicateCells(d.getSelectionCells(),!1))}),k.bindAction(8,!1,"delete"),k.bindAction(8,!0,"deleteAll"),k.bindAction(46,!1,"delete"),k.bindAction(46,!0,"deleteAll"),k.bindAction(72,!0,"resetView"),k.bindAction(72,
|
|
|
|
|
!0,"fitWindow",!0),k.bindAction(74,!0,"fitPage"),k.bindAction(74,!0,"fitTwoPages",!0),k.bindAction(48,!0,"customZoom"),k.bindAction(82,!0,"turn"),k.bindAction(82,!0,"clearDefaultStyle",!0),k.bindAction(83,!0,"save"),k.bindAction(83,!0,"saveAs",!0),k.bindAction(65,!0,"selectAll"),k.bindAction(65,!0,"selectNone",!0),k.bindAction(73,!0,"selectVertices",!0),k.bindAction(69,!0,"selectEdges",!0),k.bindAction(69,!0,"editStyle"),k.bindAction(66,!0,"bold"),k.bindAction(66,!0,"toBack",!0),k.bindAction(70,!0,
|
|
|
|
|
"toFront",!0),k.bindAction(68,!0,"duplicate"),k.bindAction(68,!0,"setAsDefaultStyle",!0),k.bindAction(90,!0,"undo"),k.bindAction(89,!0,"autosize",!0),k.bindAction(88,!0,"cut"),k.bindAction(67,!0,"copy"),k.bindAction(86,!0,"paste"),k.bindAction(71,!0,"group"),k.bindAction(77,!0,"editData"),k.bindAction(71,!0,"grid",!0),k.bindAction(73,!0,"italic"),k.bindAction(76,!0,"lockUnlock"),k.bindAction(76,!0,"layers",!0),k.bindAction(80,!0,"formatPanel",!0),k.bindAction(85,!0,"underline"),k.bindAction(85,!0,
|
|
|
|
|
"ungroup",!0),k.bindAction(190,!0,"superscript"),k.bindAction(188,!0,"subscript"),k.bindKey(13,function(){d.isEnabled()&&d.startEditingAtCell()}),k.bindKey(113,function(){d.isEnabled()&&d.startEditingAtCell()});mxClient.IS_WIN?k.bindAction(89,!0,"redo"):k.bindAction(90,!0,"redo",!0);return k};
|
|
|
|
|
mxEvent.isAltDown(a)){var c=e.actions.get(e.altShiftActions[a.keyCode]);if(null!=c)return c.funct}if(9==a.keyCode&&mxEvent.isAltDown(a))return mxEvent.isShiftDown(a)?function(){d.selectParentCell()}:function(){d.selectChildCell()};if(null!=z[a.keyCode]&&!d.isSelectionEmpty())if(!this.isControlDown(a)&&mxEvent.isShiftDown(a)&&mxEvent.isAltDown(a)){if(d.model.isVertex(d.getSelectionCell()))return function(){var c=d.connectVertex(d.getSelectionCell(),z[a.keyCode],d.defaultEdgeLength,a,!0);null!=c&&0<
|
|
|
|
|
c.length&&(1==c.length&&d.model.isEdge(c[0])?d.setSelectionCell(d.model.getTerminal(c[0],!1)):d.setSelectionCell(c[c.length-1]),d.scrollCellToVisible(d.getSelectionCell()),null!=e.hoverIcons&&e.hoverIcons.update(d.view.getState(d.getSelectionCell())))}}else return this.isControlDown(a)?function(){b(a.keyCode,mxEvent.isShiftDown(a)?d.gridSize:null,!0)}:function(){b(a.keyCode,mxEvent.isShiftDown(a)?d.gridSize:null)}}return B.apply(this,arguments)};k.bindAction=mxUtils.bind(this,function(a,c,b,d){var f=
|
|
|
|
|
this.actions.get(b);null!=f&&(b=function(){f.isEnabled()&&f.funct()},c?d?k.bindControlShiftKey(a,b):k.bindControlKey(a,b):d?k.bindShiftKey(a,b):k.bindKey(a,b))});var c=k.escape;k.escape=function(a){c.apply(this,arguments)};k.enter=function(){};k.bindControlShiftKey(36,function(){d.exitGroup()});k.bindControlShiftKey(35,function(){d.enterGroup()});k.bindKey(36,function(){d.home()});k.bindKey(35,function(){d.refresh()});k.bindAction(107,!0,"zoomIn");k.bindAction(109,!0,"zoomOut");k.bindAction(80,!0,
|
|
|
|
|
"print");k.bindAction(79,!0,"outline",!0);k.bindAction(112,!1,"about");if(!this.editor.chromeless||this.editor.editable)k.bindControlKey(36,function(){d.isEnabled()&&d.foldCells(!0)}),k.bindControlKey(35,function(){d.isEnabled()&&d.foldCells(!1)}),k.bindControlKey(13,function(){d.isEnabled()&&d.setSelectionCells(d.duplicateCells(d.getSelectionCells(),!1))}),k.bindAction(8,!1,"delete"),k.bindAction(8,!0,"deleteAll"),k.bindAction(46,!1,"delete"),k.bindAction(46,!0,"deleteAll"),k.bindAction(72,!0,"resetView"),
|
|
|
|
|
k.bindAction(72,!0,"fitWindow",!0),k.bindAction(74,!0,"fitPage"),k.bindAction(74,!0,"fitTwoPages",!0),k.bindAction(48,!0,"customZoom"),k.bindAction(82,!0,"turn"),k.bindAction(82,!0,"clearDefaultStyle",!0),k.bindAction(83,!0,"save"),k.bindAction(83,!0,"saveAs",!0),k.bindAction(65,!0,"selectAll"),k.bindAction(65,!0,"selectNone",!0),k.bindAction(73,!0,"selectVertices",!0),k.bindAction(69,!0,"selectEdges",!0),k.bindAction(69,!0,"editStyle"),k.bindAction(66,!0,"bold"),k.bindAction(66,!0,"toBack",!0),k.bindAction(70,
|
|
|
|
|
!0,"toFront",!0),k.bindAction(68,!0,"duplicate"),k.bindAction(68,!0,"setAsDefaultStyle",!0),k.bindAction(90,!0,"undo"),k.bindAction(89,!0,"autosize",!0),k.bindAction(88,!0,"cut"),k.bindAction(67,!0,"copy"),k.bindAction(86,!0,"paste"),k.bindAction(71,!0,"group"),k.bindAction(77,!0,"editData"),k.bindAction(71,!0,"grid",!0),k.bindAction(73,!0,"italic"),k.bindAction(76,!0,"lockUnlock"),k.bindAction(76,!0,"layers",!0),k.bindAction(80,!0,"formatPanel",!0),k.bindAction(85,!0,"underline"),k.bindAction(85,
|
|
|
|
|
!0,"ungroup",!0),k.bindAction(190,!0,"superscript"),k.bindAction(188,!0,"subscript"),k.bindKey(13,function(){d.isEnabled()&&d.startEditingAtCell()}),k.bindKey(113,function(){d.isEnabled()&&d.startEditingAtCell()});mxClient.IS_WIN?k.bindAction(89,!0,"redo"):k.bindAction(90,!0,"redo",!0);return k};
|
|
|
|
|
EditorUi.prototype.destroy=function(){null!=this.editor&&(this.editor.destroy(),this.editor=null);null!=this.menubar&&(this.menubar.destroy(),this.menubar=null);null!=this.toolbar&&(this.toolbar.destroy(),this.toolbar=null);null!=this.sidebar&&(this.sidebar.destroy(),this.sidebar=null);null!=this.keyHandler&&(this.keyHandler.destroy(),this.keyHandler=null);null!=this.keydownHandler&&(mxEvent.removeListener(document,"keydown",this.keydownHandler),this.keydownHandler=null);null!=this.keyupHandler&&
|
|
|
|
|
(mxEvent.removeListener(document,"keyup",this.keyupHandler),this.keyupHandler=null);null!=this.resizeHandler&&(mxEvent.removeListener(window,"resize",this.resizeHandler),this.resizeHandler=null);null!=this.gestureHandler&&(mxEvent.removeGestureListeners(document,this.gestureHandler),this.gestureHandler=null);null!=this.orientationChangeHandler&&(mxEvent.removeListener(window,"orientationchange",this.orientationChangeHandler),this.orientationChangeHandler=null);null!=this.scrollHandler&&(mxEvent.removeListener(window,
|
|
|
|
|
"scroll",this.scrollHandler),this.scrollHandler=null);if(null!=this.destroyFunctions){for(var a=0;a<this.destroyFunctions.length;a++)this.destroyFunctions[a]();this.destroyFunctions=null}for(var b=[this.menubarContainer,this.toolbarContainer,this.sidebarContainer,this.formatContainer,this.diagramContainer,this.footerContainer,this.chromelessToolbar,this.hsplit,this.sidebarFooterContainer,this.layersDialog],a=0;a<b.length;a++)null!=b[a]&&null!=b[a].parentNode&&b[a].parentNode.removeChild(b[a])};"undefined"!==typeof html4&&(html4.ATTRIBS["a::target"]=0,html4.ATTRIBS["source::src"]=0,html4.ATTRIBS["video::src"]=0);(function(){var a=[["nbsp","160"],["shy","173"]],b=mxUtils.parseXml;mxUtils.parseXml=function(e){for(var d=0;d<a.length;d++)e=e.replace(new RegExp("&"+a[d][0]+";","g"),"&#"+a[d][1]+";");return b(e)}})();
|
|
|
|
@ -2241,10 +2242,10 @@ this.setDropEnabled(!0);this.setPanning(!0);this.setTooltips(!0);this.setAllowLo
|
|
|
|
|
this.graphHandler.getGuideStates=function(){var a=f.apply(this,arguments);if(this.graph.pageVisible){for(var c=[],b=this.graph.pageFormat,d=this.graph.pageScale,g=b.width*d,b=b.height*d,d=this.graph.view.translate,e=this.graph.view.scale,l=this.graph.getPageLayout(),u=0;u<l.width;u++)c.push(new mxRectangle(((l.x+u)*g+d.x)*e,(l.y*b+d.y)*e,g*e,b*e));for(u=0;u<l.height;u++)c.push(new mxRectangle((l.x*g+d.x)*e,((l.y+u)*b+d.y)*e,g*e,b*e));a=c.concat(a)}return a};mxDragSource.prototype.dragElementZIndex=
|
|
|
|
|
mxPopupMenu.prototype.zIndex;mxGuide.prototype.getGuideColor=function(a,c){return null==a.cell?"#ffa500":mxConstants.GUIDE_COLOR};this.graphHandler.createPreviewShape=function(a){this.previewColor="#000000"==this.graph.background?"#ffffff":mxGraphHandler.prototype.previewColor;return mxGraphHandler.prototype.createPreviewShape.apply(this,arguments)};this.graphHandler.getCells=function(a){for(var c=mxGraphHandler.prototype.getCells.apply(this,arguments),b=[],f=0;f<c.length;f++){var d=this.graph.view.getState(c[f]),
|
|
|
|
|
d=null!=d?d.style:this.graph.getCellStyle(c[f]);"1"==mxUtils.getValue(d,"part","0")?(d=this.graph.model.getParent(c[f]),this.graph.model.isVertex(d)&&0>mxUtils.indexOf(c,d)&&b.push(d)):b.push(c[f])}return b};this.connectionHandler.createTargetVertex=function(a,c){var b=this.graph.view.getState(c),b=null!=b?b.style:this.graph.getCellStyle(c);mxUtils.getValue(b,"part",!1)&&(b=this.graph.model.getParent(c),this.graph.model.isVertex(b)&&(c=b));return mxConnectionHandler.prototype.createTargetVertex.apply(this,
|
|
|
|
|
arguments)};var g=new mxRubberband(this);this.getRubberband=function(){return g};var q=(new Date).getTime(),n=0,l=this.connectionHandler.mouseMove;this.connectionHandler.mouseMove=function(){var a=this.currentState;l.apply(this,arguments);a!=this.currentState?(q=(new Date).getTime(),n=0):n=(new Date).getTime()-q};var x=this.connectionHandler.isOutlineConnectEvent;this.connectionHandler.isOutlineConnectEvent=function(a){return null!=this.currentState&&a.getState()==this.currentState&&2E3<n||(null==
|
|
|
|
|
this.currentState||"0"!=mxUtils.getValue(this.currentState.style,"outlineConnect","1"))&&x.apply(this,arguments)};var C=this.isToggleEvent;this.isToggleEvent=function(a){return C.apply(this,arguments)||!mxClient.IS_CHROMEOS&&mxEvent.isShiftDown(a)};var t=g.isForceRubberbandEvent;g.isForceRubberbandEvent=function(a){return t.apply(this,arguments)||mxClient.IS_CHROMEOS&&mxEvent.isShiftDown(a.getEvent())||mxUtils.hasScrollbars(this.graph.container)&&mxClient.IS_FF&&mxClient.IS_WIN&&null==a.getState()&&
|
|
|
|
|
mxEvent.isTouchEvent(a.getEvent())};var E=null;this.panningHandler.addListener(mxEvent.PAN_START,mxUtils.bind(this,function(){this.isEnabled()&&(E=this.container.style.cursor,this.container.style.cursor="move")}));this.panningHandler.addListener(mxEvent.PAN_END,mxUtils.bind(this,function(){this.isEnabled()&&(this.container.style.cursor=E)}));this.popupMenuHandler.autoExpand=!0;this.popupMenuHandler.isSelectOnPopup=function(a){return mxEvent.isMouseEvent(a.getEvent())};var y=this.click;this.click=
|
|
|
|
|
function(a){var c=null==a.state&&null!=a.sourceState&&this.isCellLocked(a.sourceState.cell);if(this.isEnabled()&&!c||a.isConsumed())return y.apply(this,arguments);var b=c?a.sourceState.cell:a.getCell();null!=b&&(b=this.getLinkForCell(b),null!=b&&(this.isCustomLink(b)?this.customLinkClicked(b):this.openLink(b)));this.isEnabled()&&c&&this.clearSelection()};this.tooltipHandler.getStateForEvent=function(a){return a.sourceState};this.getCursorForMouseEvent=function(a){var c=null==a.state&&null!=a.sourceState&&
|
|
|
|
|
arguments)};var g=new mxRubberband(this);this.getRubberband=function(){return g};var q=(new Date).getTime(),n=0,l=this.connectionHandler.mouseMove;this.connectionHandler.mouseMove=function(){var a=this.currentState;l.apply(this,arguments);a!=this.currentState?(q=(new Date).getTime(),n=0):n=(new Date).getTime()-q};var y=this.connectionHandler.isOutlineConnectEvent;this.connectionHandler.isOutlineConnectEvent=function(a){return null!=this.currentState&&a.getState()==this.currentState&&2E3<n||(null==
|
|
|
|
|
this.currentState||"0"!=mxUtils.getValue(this.currentState.style,"outlineConnect","1"))&&y.apply(this,arguments)};var C=this.isToggleEvent;this.isToggleEvent=function(a){return C.apply(this,arguments)||!mxClient.IS_CHROMEOS&&mxEvent.isShiftDown(a)};var t=g.isForceRubberbandEvent;g.isForceRubberbandEvent=function(a){return t.apply(this,arguments)||mxClient.IS_CHROMEOS&&mxEvent.isShiftDown(a.getEvent())||mxUtils.hasScrollbars(this.graph.container)&&mxClient.IS_FF&&mxClient.IS_WIN&&null==a.getState()&&
|
|
|
|
|
mxEvent.isTouchEvent(a.getEvent())};var E=null;this.panningHandler.addListener(mxEvent.PAN_START,mxUtils.bind(this,function(){this.isEnabled()&&(E=this.container.style.cursor,this.container.style.cursor="move")}));this.panningHandler.addListener(mxEvent.PAN_END,mxUtils.bind(this,function(){this.isEnabled()&&(this.container.style.cursor=E)}));this.popupMenuHandler.autoExpand=!0;this.popupMenuHandler.isSelectOnPopup=function(a){return mxEvent.isMouseEvent(a.getEvent())};var x=this.click;this.click=
|
|
|
|
|
function(a){var c=null==a.state&&null!=a.sourceState&&this.isCellLocked(a.sourceState.cell);if(this.isEnabled()&&!c||a.isConsumed())return x.apply(this,arguments);var b=c?a.sourceState.cell:a.getCell();null!=b&&(b=this.getLinkForCell(b),null!=b&&(this.isCustomLink(b)?this.customLinkClicked(b):this.openLink(b)));this.isEnabled()&&c&&this.clearSelection()};this.tooltipHandler.getStateForEvent=function(a){return a.sourceState};this.getCursorForMouseEvent=function(a){var c=null==a.state&&null!=a.sourceState&&
|
|
|
|
|
this.isCellLocked(a.sourceState.cell);return this.getCursorForCell(c?a.sourceState.cell:a.getCell())};var F=this.getCursorForCell;this.getCursorForCell=function(a){if(!this.isEnabled()||this.isCellLocked(a)){if(null!=this.getLinkForCell(a))return"pointer";if(this.isCellLocked(a))return"default"}return F.apply(this,arguments)};this.selectRegion=function(a,c){var b=this.getAllCells(a.x,a.y,a.width,a.height);this.selectCellsForEvent(b,c);return b};this.getAllCells=function(a,c,b,f,d,g){g=null!=g?g:[];
|
|
|
|
|
if(0<b||0<f){var e=this.getModel(),l=a+b,u=c+f;null==d&&(d=this.getCurrentRoot(),null==d&&(d=e.getRoot()));if(null!=d)for(var n=e.getChildCount(d),q=0;q<n;q++){var t=e.getChildAt(d,q),A=this.view.getState(t);if(null!=A&&this.isCellVisible(t)&&"1"!=mxUtils.getValue(A.style,"locked","0")){var ca=mxUtils.getValue(A.style,mxConstants.STYLE_ROTATION)||0;0!=ca&&(A=mxUtils.getBoundingBox(A,ca));(e.isEdge(t)||e.isVertex(t))&&A.x>=a&&A.y+A.height<=u&&A.y>=c&&A.x+A.width<=l&&g.push(t);this.getAllCells(a,c,
|
|
|
|
|
b,f,t,g)}}}return g};var u=this.graphHandler.shouldRemoveCellsFromParent;this.graphHandler.shouldRemoveCellsFromParent=function(a,c,b){return this.graph.isCellSelected(a)?!1:u.apply(this,arguments)};this.isCellLocked=function(a){for(a=this.view.getState(a);null!=a;){if("1"==mxUtils.getValue(a.style,"locked","0"))return!0;a=this.view.getState(this.model.getParent(a.cell))}return!1};var A=null;this.addListener(mxEvent.FIRE_MOUSE_EVENT,mxUtils.bind(this,function(a,c){if("mouseDown"==c.getProperty("eventName")){var b=
|
|
|
|
@ -2284,8 +2285,8 @@ Graph.prototype.isLabelMovable=function(a){var b=this.view.getState(a),b=null!=b
|
|
|
|
|
Graph.prototype.getGlobalVariable=function(a){var b=null;"date"==a?b=(new Date).toLocaleDateString():"time"==a?b=(new Date).toLocaleTimeString():"timestamp"==a?b=(new Date).toLocaleString():"date{"==a.substring(0,5)&&(a=a.substring(5,a.length-1),b=this.formatDate(new Date,a));return b};
|
|
|
|
|
Graph.prototype.formatDate=function(a,b,e){null==this.dateFormatCache&&(this.dateFormatCache={i18n:{dayNames:"Sun Mon Tue Wed Thu Fri Sat Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),monthNames:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec January February March April May June July August September October November December".split(" ")},masks:{"default":"ddd mmm dd yyyy HH:MM:ss",shortDate:"m/d/yy",mediumDate:"mmm d, yyyy",longDate:"mmmm d, yyyy",fullDate:"dddd, mmmm d, yyyy",
|
|
|
|
|
shortTime:"h:MM TT",mediumTime:"h:MM:ss TT",longTime:"h:MM:ss TT Z",isoDate:"yyyy-mm-dd",isoTime:"HH:MM:ss",isoDateTime:"yyyy-mm-dd'T'HH:MM:ss",isoUtcDateTime:"UTC:yyyy-mm-dd'T'HH:MM:ss'Z'"}});var d=this.dateFormatCache,k=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,m=/[^-+\dA-Z]/g,p=function(a,c){a=String(a);for(c=c||2;a.length<c;)a="0"+a;return a};1!=arguments.length||"[object String]"!=Object.prototype.toString.call(a)||
|
|
|
|
|
/\d/.test(a)||(b=a,a=void 0);a=a?new Date(a):new Date;if(isNaN(a))throw SyntaxError("invalid date");b=String(d.masks[b]||b||d.masks["default"]);"UTC:"==b.slice(0,4)&&(b=b.slice(4),e=!0);var v=e?"getUTC":"get",z=a[v+"Date"](),B=a[v+"Day"](),c=a[v+"Month"](),f=a[v+"FullYear"](),g=a[v+"Hours"](),q=a[v+"Minutes"](),n=a[v+"Seconds"](),v=a[v+"Milliseconds"](),l=e?0:a.getTimezoneOffset(),x={d:z,dd:p(z),ddd:d.i18n.dayNames[B],dddd:d.i18n.dayNames[B+7],m:c+1,mm:p(c+1),mmm:d.i18n.monthNames[c],mmmm:d.i18n.monthNames[c+
|
|
|
|
|
12],yy:String(f).slice(2),yyyy:f,h:g%12||12,hh:p(g%12||12),H:g,HH:p(g),M:q,MM:p(q),s:n,ss:p(n),l:p(v,3),L:p(99<v?Math.round(v/10):v),t:12>g?"a":"p",tt:12>g?"am":"pm",T:12>g?"A":"P",TT:12>g?"AM":"PM",Z:e?"UTC":(String(a).match(k)||[""]).pop().replace(m,""),o:(0<l?"-":"+")+p(100*Math.floor(Math.abs(l)/60)+Math.abs(l)%60,4),S:["th","st","nd","rd"][3<z%10?0:(10!=z%100-z%10)*z%10]};return b.replace(/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,function(a){return a in x?x[a]:a.slice(1,
|
|
|
|
|
/\d/.test(a)||(b=a,a=void 0);a=a?new Date(a):new Date;if(isNaN(a))throw SyntaxError("invalid date");b=String(d.masks[b]||b||d.masks["default"]);"UTC:"==b.slice(0,4)&&(b=b.slice(4),e=!0);var v=e?"getUTC":"get",z=a[v+"Date"](),B=a[v+"Day"](),c=a[v+"Month"](),f=a[v+"FullYear"](),g=a[v+"Hours"](),q=a[v+"Minutes"](),n=a[v+"Seconds"](),v=a[v+"Milliseconds"](),l=e?0:a.getTimezoneOffset(),y={d:z,dd:p(z),ddd:d.i18n.dayNames[B],dddd:d.i18n.dayNames[B+7],m:c+1,mm:p(c+1),mmm:d.i18n.monthNames[c],mmmm:d.i18n.monthNames[c+
|
|
|
|
|
12],yy:String(f).slice(2),yyyy:f,h:g%12||12,hh:p(g%12||12),H:g,HH:p(g),M:q,MM:p(q),s:n,ss:p(n),l:p(v,3),L:p(99<v?Math.round(v/10):v),t:12>g?"a":"p",tt:12>g?"am":"pm",T:12>g?"A":"P",TT:12>g?"AM":"PM",Z:e?"UTC":(String(a).match(k)||[""]).pop().replace(m,""),o:(0<l?"-":"+")+p(100*Math.floor(Math.abs(l)/60)+Math.abs(l)%60,4),S:["th","st","nd","rd"][3<z%10?0:(10!=z%100-z%10)*z%10]};return b.replace(/d{1,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|[LloSZ]|"[^"]*"|'[^']*'/g,function(a){return a in y?y[a]:a.slice(1,
|
|
|
|
|
a.length-1)})};
|
|
|
|
|
Graph.prototype.createLayersDialog=function(){var a=document.createElement("div");a.style.position="absolute";for(var b=this.getModel(),e=b.getChildCount(b.root),d=0;d<e;d++)mxUtils.bind(this,function(d){var e=document.createElement("div");e.style.overflow="hidden";e.style.textOverflow="ellipsis";e.style.padding="2px";e.style.whiteSpace="nowrap";var k=document.createElement("input");k.style.display="inline-block";k.setAttribute("type","checkbox");b.isVisible(d)&&(k.setAttribute("checked","checked"),
|
|
|
|
|
k.defaultChecked=!0);e.appendChild(k);var v=this.convertValueToString(d)||mxResources.get("background")||"Background";e.setAttribute("title",v);mxUtils.write(e,v);a.appendChild(e);mxEvent.addListener(k,"click",function(){null!=k.getAttribute("checked")?k.removeAttribute("checked"):k.setAttribute("checked","checked");b.setVisible(d,k.checked)})})(b.getChildAt(b.root,d));return a};
|
|
|
|
@ -2350,13 +2351,13 @@ HoverIcons.prototype.setCurrentState=function(a){"eastwest"!=a.style.portConstra
|
|
|
|
|
(function(){var a=mxGraphView.prototype.resetValidationState;mxGraphView.prototype.resetValidationState=function(){a.apply(this,arguments);this.validEdges=[]};var b=mxGraphView.prototype.validateCellState;mxGraphView.prototype.validateCellState=function(a,d){d=null!=d?d:!0;var c=this.getState(a);null!=c&&d&&this.graph.model.isEdge(c.cell)&&null!=c.style&&1!=c.style[mxConstants.STYLE_CURVED]&&!c.invalid&&this.updateLineJumps(c)&&this.graph.cellRenderer.redraw(c,!1,this.isRendering());c=b.apply(this,
|
|
|
|
|
arguments);null!=c&&d&&this.graph.model.isEdge(c.cell)&&null!=c.style&&1!=c.style[mxConstants.STYLE_CURVED]&&this.validEdges.push(c);return c};var e=mxCellRenderer.prototype.isShapeInvalid;mxCellRenderer.prototype.isShapeInvalid=function(a,b){return e.apply(this,arguments)||null!=a.routedPoints&&null!=b.routedPoints&&!mxUtils.equalPoints(b.routedPoints,a.routedPoints)};var d=mxGraphView.prototype.updateCellState;mxGraphView.prototype.updateCellState=function(a){d.apply(this,arguments);this.graph.model.isEdge(a.cell)&&
|
|
|
|
|
1!=a.style[mxConstants.STYLE_CURVED]&&this.updateLineJumps(a)};mxGraphView.prototype.updateLineJumps=function(a){var b=a.absolutePoints;if(Graph.lineJumpsEnabled){var c=null!=a.routedPoints,f=null;if(null!=b&&null!=this.validEdges&&"none"!==mxUtils.getValue(a.style,"jumpStyle","none")){for(var d=function(c,b,d){var e=new mxPoint(b,d);e.type=c;f.push(e);e=null!=a.routedPoints?a.routedPoints[f.length-1]:null;return null==e||e.type!=c||e.x!=b||e.y!=d},e=.5*this.scale,c=!1,f=[],n=0;n<b.length-1;n++){for(var l=
|
|
|
|
|
b[n+1],x=b[n],C=[],t=b[n+2];n<b.length-2&&mxUtils.ptSegDistSq(x.x,x.y,t.x,t.y,l.x,l.y)<1*this.scale*this.scale;)l=t,n++,t=b[n+2];for(var c=d(0,x.x,x.y)||c,k=0;k<this.validEdges.length;k++){var y=this.validEdges[k],v=y.absolutePoints;if(null!=v&&mxUtils.intersects(a,y)&&"1"!=y.style.noJump)for(y=0;y<v.length-1;y++){for(var u=v[y+1],A=v[y],t=v[y+2];y<v.length-2&&mxUtils.ptSegDistSq(A.x,A.y,t.x,t.y,u.x,u.y)<1*this.scale*this.scale;)u=t,y++,t=v[y+2];t=mxUtils.intersection(x.x,x.y,l.x,l.y,A.x,A.y,u.x,
|
|
|
|
|
u.y);if(null!=t&&(Math.abs(t.x-x.x)>e||Math.abs(t.y-x.y)>e)&&(Math.abs(t.x-l.x)>e||Math.abs(t.y-l.y)>e)&&(Math.abs(t.x-A.x)>e||Math.abs(t.y-A.y)>e)&&(Math.abs(t.x-u.x)>e||Math.abs(t.y-u.y)>e)){u=t.x-x.x;A=t.y-x.y;t={distSq:u*u+A*A,x:t.x,y:t.y};for(u=0;u<C.length;u++)if(C[u].distSq>t.distSq){C.splice(u,0,t);t=null;break}null==t||0!=C.length&&C[C.length-1].x===t.x&&C[C.length-1].y===t.y||C.push(t)}}}for(y=0;y<C.length;y++)c=d(1,C[y].x,C[y].y)||c}t=b[b.length-1];c=d(0,t.x,t.y)||c}a.routedPoints=f;return c}return!1};
|
|
|
|
|
b[n+1],y=b[n],C=[],t=b[n+2];n<b.length-2&&mxUtils.ptSegDistSq(y.x,y.y,t.x,t.y,l.x,l.y)<1*this.scale*this.scale;)l=t,n++,t=b[n+2];for(var c=d(0,y.x,y.y)||c,k=0;k<this.validEdges.length;k++){var x=this.validEdges[k],v=x.absolutePoints;if(null!=v&&mxUtils.intersects(a,x)&&"1"!=x.style.noJump)for(x=0;x<v.length-1;x++){for(var u=v[x+1],A=v[x],t=v[x+2];x<v.length-2&&mxUtils.ptSegDistSq(A.x,A.y,t.x,t.y,u.x,u.y)<1*this.scale*this.scale;)u=t,x++,t=v[x+2];t=mxUtils.intersection(y.x,y.y,l.x,l.y,A.x,A.y,u.x,
|
|
|
|
|
u.y);if(null!=t&&(Math.abs(t.x-y.x)>e||Math.abs(t.y-y.y)>e)&&(Math.abs(t.x-l.x)>e||Math.abs(t.y-l.y)>e)&&(Math.abs(t.x-A.x)>e||Math.abs(t.y-A.y)>e)&&(Math.abs(t.x-u.x)>e||Math.abs(t.y-u.y)>e)){u=t.x-y.x;A=t.y-y.y;t={distSq:u*u+A*A,x:t.x,y:t.y};for(u=0;u<C.length;u++)if(C[u].distSq>t.distSq){C.splice(u,0,t);t=null;break}null==t||0!=C.length&&C[C.length-1].x===t.x&&C[C.length-1].y===t.y||C.push(t)}}}for(x=0;x<C.length;x++)c=d(1,C[x].x,C[x].y)||c}t=b[b.length-1];c=d(0,t.x,t.y)||c}a.routedPoints=f;return c}return!1};
|
|
|
|
|
var k=mxConnector.prototype.paintLine;mxConnector.prototype.paintLine=function(a,b,c){this.routedPoints=null!=this.state?this.state.routedPoints:null;if(this.outline||null==this.state||null==this.style||null==this.state.routedPoints||0==this.state.routedPoints.length)k.apply(this,arguments);else{var f=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,d=(parseInt(mxUtils.getValue(this.style,"jumpSize",Graph.defaultJumpSize))-2)/2+this.strokewidth,e=mxUtils.getValue(this.style,
|
|
|
|
|
"jumpStyle","none"),n,l=!0,x=null,C=null;n=[];var t=null;a.begin();for(var v=0;v<this.state.routedPoints.length;v++){var y=this.state.routedPoints[v],m=new mxPoint(y.x/this.scale,y.y/this.scale);0==v?m=b[0]:v==this.state.routedPoints.length-1&&(m=b[b.length-1]);var u=!1;if(null!=x&&1==y.type){var A=this.state.routedPoints[v+1],y=A.x/this.scale-m.x,A=A.y/this.scale-m.y,y=y*y+A*A;null==t&&(t=new mxPoint(m.x-x.x,m.y-x.y),C=Math.sqrt(t.x*t.x+t.y*t.y),0<C?(t.x=t.x*d/C,t.y=t.y*d/C):t=null);y>d*d&&0<C&&
|
|
|
|
|
(y=x.x-m.x,A=x.y-m.y,y=y*y+A*A,y>d*d&&(u=new mxPoint(m.x-t.x,m.y-t.y),y=new mxPoint(m.x+t.x,m.y+t.y),n.push(u),this.addPoints(a,n,c,f,!1,null,l),n=0>Math.round(t.x)||0==Math.round(t.x)&&0>=Math.round(t.y)?1:-1,l=!1,"sharp"==e?(a.lineTo(u.x-t.y*n,u.y+t.x*n),a.lineTo(y.x-t.y*n,y.y+t.x*n),a.lineTo(y.x,y.y)):"arc"==e?(n*=1.3,a.curveTo(u.x-t.y*n,u.y+t.x*n,y.x-t.y*n,y.y+t.x*n,y.x,y.y)):(a.moveTo(y.x,y.y),l=!0),n=[y],u=!0))}else t=null;u||(n.push(m),x=m)}this.addPoints(a,n,c,f,!1,null,l);a.stroke()}};var m=
|
|
|
|
|
mxGraphView.prototype.updateFloatingTerminalPoint;mxGraphView.prototype.updateFloatingTerminalPoint=function(a,b,c,f){if(null==b||null==a||"1"!=b.style.snapToPoint&&"1"!=a.style.snapToPoint)m.apply(this,arguments);else{b=this.getTerminalPort(a,b,f);var d=this.getNextPoint(a,c,f),e=this.graph.isOrthogonal(a),n=mxUtils.toRadians(Number(b.style[mxConstants.STYLE_ROTATION]||"0")),l=new mxPoint(b.getCenterX(),b.getCenterY());if(0!=n)var x=Math.cos(-n),C=Math.sin(-n),d=mxUtils.getRotatedPoint(d,x,C,l);
|
|
|
|
|
x=parseFloat(a.style[mxConstants.STYLE_PERIMETER_SPACING]||0);x+=parseFloat(a.style[f?mxConstants.STYLE_SOURCE_PERIMETER_SPACING:mxConstants.STYLE_TARGET_PERIMETER_SPACING]||0);d=this.getPerimeterPoint(b,d,0==n&&e,x);0!=n&&(x=Math.cos(n),C=Math.sin(n),d=mxUtils.getRotatedPoint(d,x,C,l));a.setAbsoluteTerminalPoint(this.snapToAnchorPoint(a,b,c,f,d),f)}};mxGraphView.prototype.snapToAnchorPoint=function(a,b,c,f,d){if(null!=b&&null!=a){a=this.graph.getAllConnectionConstraints(b);f=c=null;if(null!=a)for(var e=
|
|
|
|
|
"jumpStyle","none"),n,l=!0,y=null,C=null;n=[];var t=null;a.begin();for(var v=0;v<this.state.routedPoints.length;v++){var x=this.state.routedPoints[v],m=new mxPoint(x.x/this.scale,x.y/this.scale);0==v?m=b[0]:v==this.state.routedPoints.length-1&&(m=b[b.length-1]);var u=!1;if(null!=y&&1==x.type){var A=this.state.routedPoints[v+1],x=A.x/this.scale-m.x,A=A.y/this.scale-m.y,x=x*x+A*A;null==t&&(t=new mxPoint(m.x-y.x,m.y-y.y),C=Math.sqrt(t.x*t.x+t.y*t.y),0<C?(t.x=t.x*d/C,t.y=t.y*d/C):t=null);x>d*d&&0<C&&
|
|
|
|
|
(x=y.x-m.x,A=y.y-m.y,x=x*x+A*A,x>d*d&&(u=new mxPoint(m.x-t.x,m.y-t.y),x=new mxPoint(m.x+t.x,m.y+t.y),n.push(u),this.addPoints(a,n,c,f,!1,null,l),n=0>Math.round(t.x)||0==Math.round(t.x)&&0>=Math.round(t.y)?1:-1,l=!1,"sharp"==e?(a.lineTo(u.x-t.y*n,u.y+t.x*n),a.lineTo(x.x-t.y*n,x.y+t.x*n),a.lineTo(x.x,x.y)):"arc"==e?(n*=1.3,a.curveTo(u.x-t.y*n,u.y+t.x*n,x.x-t.y*n,x.y+t.x*n,x.x,x.y)):(a.moveTo(x.x,x.y),l=!0),n=[x],u=!0))}else t=null;u||(n.push(m),y=m)}this.addPoints(a,n,c,f,!1,null,l);a.stroke()}};var m=
|
|
|
|
|
mxGraphView.prototype.updateFloatingTerminalPoint;mxGraphView.prototype.updateFloatingTerminalPoint=function(a,b,c,f){if(null==b||null==a||"1"!=b.style.snapToPoint&&"1"!=a.style.snapToPoint)m.apply(this,arguments);else{b=this.getTerminalPort(a,b,f);var d=this.getNextPoint(a,c,f),e=this.graph.isOrthogonal(a),n=mxUtils.toRadians(Number(b.style[mxConstants.STYLE_ROTATION]||"0")),l=new mxPoint(b.getCenterX(),b.getCenterY());if(0!=n)var y=Math.cos(-n),C=Math.sin(-n),d=mxUtils.getRotatedPoint(d,y,C,l);
|
|
|
|
|
y=parseFloat(a.style[mxConstants.STYLE_PERIMETER_SPACING]||0);y+=parseFloat(a.style[f?mxConstants.STYLE_SOURCE_PERIMETER_SPACING:mxConstants.STYLE_TARGET_PERIMETER_SPACING]||0);d=this.getPerimeterPoint(b,d,0==n&&e,y);0!=n&&(y=Math.cos(n),C=Math.sin(n),d=mxUtils.getRotatedPoint(d,y,C,l));a.setAbsoluteTerminalPoint(this.snapToAnchorPoint(a,b,c,f,d),f)}};mxGraphView.prototype.snapToAnchorPoint=function(a,b,c,f,d){if(null!=b&&null!=a){a=this.graph.getAllConnectionConstraints(b);f=c=null;if(null!=a)for(var e=
|
|
|
|
|
0;e<a.length;e++){var g=this.graph.getConnectionPoint(b,a[e]);if(null!=g){var l=(g.x-d.x)*(g.x-d.x)+(g.y-d.y)*(g.y-d.y);if(null==f||l<f)c=g,f=l}}null!=c&&(d=c)}return d};var p=mxStencil.prototype.evaluateTextAttribute;mxStencil.prototype.evaluateTextAttribute=function(a,b,c){var f=p.apply(this,arguments);"1"==a.getAttribute("placeholders")&&null!=c.state&&(f=c.state.view.graph.replacePlaceholders(c.state.cell,f));return f};var v=mxCellRenderer.prototype.createShape;mxCellRenderer.prototype.createShape=
|
|
|
|
|
function(a){if(null!=a.style&&"undefined"!==typeof pako){var b=mxUtils.getValue(a.style,mxConstants.STYLE_SHAPE,null);if(null!=b&&"string"===typeof b&&"stencil("==b.substring(0,8))try{var c=b.substring(8,b.length-1),f=mxUtils.parseXml(Graph.decompress(c));return new mxShape(new mxStencil(f.documentElement))}catch(g){null!=window.console&&console.log("Error in shape: "+g)}}return v.apply(this,arguments)}})();mxStencilRegistry.libraries={};mxStencilRegistry.dynamicLoading=!0;
|
|
|
|
|
mxStencilRegistry.allowEval=!0;mxStencilRegistry.packages=[];
|
|
|
|
@ -2385,7 +2386,7 @@ f,d);if(null!=b)return b;if(null!=a.shape.stencil&&null!=a.shape.stencil.constra
|
|
|
|
|
c,[a]))}};Graph.prototype.isValidRoot=function(a){for(var c=this.model.getChildCount(a),b=0,f=0;f<c;f++){var d=this.model.getChildAt(a,f);this.model.isVertex(d)&&(d=this.getCellGeometry(d),null==d||d.relative||b++)}return 0<b||this.isContainer(a)};Graph.prototype.isValidDropTarget=function(a){var c=this.view.getState(a),c=null!=c?c.style:this.getCellStyle(a);return"1"!=mxUtils.getValue(c,"part","0")&&(this.isContainer(a)||mxGraph.prototype.isValidDropTarget.apply(this,arguments)&&"0"!=mxUtils.getValue(c,
|
|
|
|
|
"dropTarget","1"))};Graph.prototype.createGroupCell=function(){var a=mxGraph.prototype.createGroupCell.apply(this,arguments);a.setStyle("group");return a};Graph.prototype.isExtendParentsOnAdd=function(a){var c=mxGraph.prototype.isExtendParentsOnAdd.apply(this,arguments);if(c&&null!=a&&null!=this.layoutManager){var b=this.model.getParent(a);null!=b&&(b=this.layoutManager.getLayout(b),null!=b&&b.constructor==mxStackLayout&&(c=!1))}return c};Graph.prototype.getPreferredSizeForCell=function(a){var c=
|
|
|
|
|
mxGraph.prototype.getPreferredSizeForCell.apply(this,arguments);null!=c&&(c.width+=10,c.height+=4,this.gridEnabled&&(c.width=this.snap(c.width),c.height=this.snap(c.height)));return c};Graph.prototype.turnShapes=function(a){var c=this.getModel(),b=[];c.beginUpdate();try{for(var f=0;f<a.length;f++){var d=a[f];if(c.isEdge(d)){var e=c.getTerminal(d,!0),g=c.getTerminal(d,!1);c.setTerminal(d,g,!0);c.setTerminal(d,e,!1);var l=c.getGeometry(d);if(null!=l){l=l.clone();null!=l.points&&l.points.reverse();var u=
|
|
|
|
|
l.getTerminalPoint(!0),n=l.getTerminalPoint(!1);l.setTerminalPoint(u,!1);l.setTerminalPoint(n,!0);c.setGeometry(d,l);var q=this.view.getState(d),A=this.view.getState(e),t=this.view.getState(g);if(null!=q){var x=null!=A?this.getConnectionConstraint(q,A,!0):null,y=null!=t?this.getConnectionConstraint(q,t,!1):null;this.setConnectionConstraint(d,e,!0,y);this.setConnectionConstraint(d,g,!1,x)}b.push(d)}}else if(c.isVertex(d)&&(l=this.getCellGeometry(d),null!=l)){l=l.clone();l.x+=l.width/2-l.height/2;l.y+=
|
|
|
|
|
l.getTerminalPoint(!0),n=l.getTerminalPoint(!1);l.setTerminalPoint(u,!1);l.setTerminalPoint(n,!0);c.setGeometry(d,l);var q=this.view.getState(d),A=this.view.getState(e),t=this.view.getState(g);if(null!=q){var y=null!=A?this.getConnectionConstraint(q,A,!0):null,x=null!=t?this.getConnectionConstraint(q,t,!1):null;this.setConnectionConstraint(d,e,!0,x);this.setConnectionConstraint(d,g,!1,y)}b.push(d)}}else if(c.isVertex(d)&&(l=this.getCellGeometry(d),null!=l)){l=l.clone();l.x+=l.width/2-l.height/2;l.y+=
|
|
|
|
|
l.height/2-l.width/2;var C=l.width;l.width=l.height;l.height=C;c.setGeometry(d,l);var k=this.view.getState(d);if(null!=k){var D=k.style[mxConstants.STYLE_DIRECTION]||"east";"east"==D?D="south":"south"==D?D="west":"west"==D?D="north":"north"==D&&(D="east");this.setCellStyles(mxConstants.STYLE_DIRECTION,D,[d])}b.push(d)}}}finally{c.endUpdate()}return b};Graph.prototype.stencilHasPlaceholders=function(a){if(null!=a&&null!=a.fgNode)for(a=a.fgNode.firstChild;null!=a;){if("text"==a.nodeName&&"1"==a.getAttribute("placeholders"))return!0;
|
|
|
|
|
a=a.nextSibling}return!1};Graph.prototype.processChange=function(a){mxGraph.prototype.processChange.apply(this,arguments);if(a instanceof mxValueChange&&null!=a.cell&&null!=a.cell.value&&"object"==typeof a.cell.value){var c=this.model.getDescendants(a.cell);if(0<c.length)for(var b=0;b<c.length;b++){var f=this.view.getState(c[b]);null!=f&&null!=f.shape&&null!=f.shape.stencil&&this.stencilHasPlaceholders(f.shape.stencil)?this.removeStateForCell(c[b]):this.isReplacePlaceholders(c[b])&&this.view.invalidate(c[b],
|
|
|
|
|
!1,!1)}}};Graph.prototype.replaceElement=function(a,c){for(var b=a.ownerDocument.createElement(null!=c?c:"span"),f=Array.prototype.slice.call(a.attributes);attr=f.pop();)b.setAttribute(attr.nodeName,attr.nodeValue);b.innerHTML=a.innerHTML;a.parentNode.replaceChild(b,a)};Graph.prototype.processElements=function(a,c){for(var b=a.getElementsByTagName("*"),f=0;f<b.length;f++)c(b[f])};Graph.prototype.updateLabelElements=function(a,c,b){a=null!=a?a:this.getSelectionCells();for(var f=document.createElement("div"),
|
|
|
|
@ -2412,12 +2413,12 @@ this.cellEditor.textarea.getElementsByTagName("a"),b=[],f=0;f<c.length;f++)b.pus
|
|
|
|
|
function(a){var c=mxGraph.prototype.isCellResizable.apply(this,arguments),b=this.view.getState(a),b=null!=b?b.style:this.getCellStyle(a);return c||"0"!=mxUtils.getValue(b,mxConstants.STYLE_RESIZABLE,"1")&&"wrap"==b[mxConstants.STYLE_WHITE_SPACE]};Graph.prototype.distributeCells=function(a,c){null==c&&(c=this.getSelectionCells());if(null!=c&&1<c.length){for(var b=[],f=null,d=null,e=0;e<c.length;e++)if(this.getModel().isVertex(c[e])){var g=this.view.getState(c[e]);if(null!=g){var l=a?g.getCenterX():
|
|
|
|
|
g.getCenterY(),f=null!=f?Math.max(f,l):l,d=null!=d?Math.min(d,l):l;b.push(g)}}if(2<b.length){b.sort(function(c,b){return a?c.x-b.x:c.y-b.y});g=this.view.translate;l=this.view.scale;d=d/l-(a?g.x:g.y);f=f/l-(a?g.x:g.y);this.getModel().beginUpdate();try{for(var u=(f-d)/(b.length-1),f=d,e=1;e<b.length-1;e++){var n=this.view.getState(this.model.getParent(b[e].cell)),q=this.getCellGeometry(b[e].cell),f=f+u;null!=q&&null!=n&&(q=q.clone(),a?q.x=Math.round(f-q.width/2)-n.origin.x:q.y=Math.round(f-q.height/
|
|
|
|
|
2)-n.origin.y,this.getModel().setGeometry(b[e].cell,q))}}finally{this.getModel().endUpdate()}}}return c};Graph.prototype.isCloneEvent=function(a){return mxClient.IS_MAC&&mxEvent.isMetaDown(a)||mxEvent.isControlDown(a)};Graph.prototype.createSvgImageExport=function(){var a=new mxImageExport;a.getLinkForCellState=mxUtils.bind(this,function(a,c){return this.getLinkForCell(a.cell)});return a};Graph.prototype.getSvg=function(a,c,b,f,d,e,g,l,u,n){var q=this.useCssTransforms;q&&(this.useCssTransforms=!1,
|
|
|
|
|
this.view.revalidate(),this.sizeDidChange());try{c=null!=c?c:1;b=null!=b?b:0;d=null!=d?d:!0;e=null!=e?e:!0;g=null!=g?g:!0;var A=e||f?this.getGraphBounds():this.getBoundingBox(this.getSelectionCells());if(null==A)throw Error(mxResources.get("drawingEmpty"));var t=this.view.scale,x=mxUtils.createXmlDocument(),y=null!=x.createElementNS?x.createElementNS(mxConstants.NS_SVG,"svg"):x.createElement("svg");null!=a&&(null!=y.style?y.style.backgroundColor=a:y.setAttribute("style","background-color:"+a));null==
|
|
|
|
|
x.createElementNS?(y.setAttribute("xmlns",mxConstants.NS_SVG),y.setAttribute("xmlns:xlink",mxConstants.NS_XLINK)):y.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",mxConstants.NS_XLINK);a=c/t;var C=Math.max(1,Math.ceil(A.width*a)+2*b)+(n?5:0),k=Math.max(1,Math.ceil(A.height*a)+2*b)+(n?5:0);y.setAttribute("version","1.1");y.setAttribute("width",C+"px");y.setAttribute("height",k+"px");y.setAttribute("viewBox",(d?"-0.5 -0.5":"0 0")+" "+C+" "+k);x.appendChild(y);var D=null!=x.createElementNS?
|
|
|
|
|
x.createElementNS(mxConstants.NS_SVG,"g"):x.createElement("g");y.appendChild(D);var v=this.createSvgCanvas(D);v.foOffset=d?-.5:0;v.textOffset=d?-.5:0;v.imageOffset=d?-.5:0;v.translate(Math.floor((b/c-A.x)/t),Math.floor((b/c-A.y)/t));var m=document.createElement("textarea"),N=v.createAlternateContent;v.createAlternateContent=function(a,c,b,f,d,e,g,l,u,n,q,A,t){var x=this.state;if(null!=this.foAltText&&(0==f||0!=x.fontSize&&e.length<5*f/x.fontSize)){var y=this.createElement("text");y.setAttribute("x",
|
|
|
|
|
Math.round(f/2));y.setAttribute("y",Math.round((d+x.fontSize)/2));y.setAttribute("fill",x.fontColor||"black");y.setAttribute("text-anchor","middle");y.setAttribute("font-size",Math.round(x.fontSize)+"px");y.setAttribute("font-family",x.fontFamily);(x.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&y.setAttribute("font-weight","bold");(x.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&y.setAttribute("font-style","italic");(x.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&
|
|
|
|
|
y.setAttribute("text-decoration","underline");try{return m.innerHTML=e,y.textContent=m.value,y}catch(ra){return N.apply(this,arguments)}}else return N.apply(this,arguments)};var H=this.backgroundImage;if(null!=H){c=t/c;var p=this.view.translate,F=new mxRectangle(p.x*c,p.y*c,H.width*c,H.height*c);mxUtils.intersects(A,F)&&v.image(p.x,p.y,H.width,H.height,H.src,!0)}v.scale(a);v.textEnabled=g;l=null!=l?l:this.createSvgImageExport();var E=l.drawCellState,Q=l.getLinkForCellState;l.getLinkForCellState=function(a,
|
|
|
|
|
c){var b=Q.apply(this,arguments);return null==b||a.view.graph.isCustomLink(b)?null:b};l.drawCellState=function(a,c){for(var b=a.view.graph,f=b.isCellSelected(a.cell),d=b.model.getParent(a.cell);!e&&!f&&null!=d;)f=b.isCellSelected(d),d=b.model.getParent(d);(e||f)&&E.apply(this,arguments)};l.drawState(this.getView().getState(this.model.root),v);this.updateSvgLinks(y,u,!0);return y}finally{q&&(this.useCssTransforms=!0,this.view.revalidate(),this.sizeDidChange())}};Graph.prototype.updateSvgLinks=function(a,
|
|
|
|
|
this.view.revalidate(),this.sizeDidChange());try{c=null!=c?c:1;b=null!=b?b:0;d=null!=d?d:!0;e=null!=e?e:!0;g=null!=g?g:!0;var A=e||f?this.getGraphBounds():this.getBoundingBox(this.getSelectionCells());if(null==A)throw Error(mxResources.get("drawingEmpty"));var t=this.view.scale,y=mxUtils.createXmlDocument(),x=null!=y.createElementNS?y.createElementNS(mxConstants.NS_SVG,"svg"):y.createElement("svg");null!=a&&(null!=x.style?x.style.backgroundColor=a:x.setAttribute("style","background-color:"+a));null==
|
|
|
|
|
y.createElementNS?(x.setAttribute("xmlns",mxConstants.NS_SVG),x.setAttribute("xmlns:xlink",mxConstants.NS_XLINK)):x.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink",mxConstants.NS_XLINK);a=c/t;var C=Math.max(1,Math.ceil(A.width*a)+2*b)+(n?5:0),k=Math.max(1,Math.ceil(A.height*a)+2*b)+(n?5:0);x.setAttribute("version","1.1");x.setAttribute("width",C+"px");x.setAttribute("height",k+"px");x.setAttribute("viewBox",(d?"-0.5 -0.5":"0 0")+" "+C+" "+k);y.appendChild(x);var D=null!=y.createElementNS?
|
|
|
|
|
y.createElementNS(mxConstants.NS_SVG,"g"):y.createElement("g");x.appendChild(D);var v=this.createSvgCanvas(D);v.foOffset=d?-.5:0;v.textOffset=d?-.5:0;v.imageOffset=d?-.5:0;v.translate(Math.floor((b/c-A.x)/t),Math.floor((b/c-A.y)/t));var m=document.createElement("textarea"),N=v.createAlternateContent;v.createAlternateContent=function(a,c,b,f,d,e,g,l,u,n,q,A,t){var y=this.state;if(null!=this.foAltText&&(0==f||0!=y.fontSize&&e.length<5*f/y.fontSize)){var x=this.createElement("text");x.setAttribute("x",
|
|
|
|
|
Math.round(f/2));x.setAttribute("y",Math.round((d+y.fontSize)/2));x.setAttribute("fill",y.fontColor||"black");x.setAttribute("text-anchor","middle");x.setAttribute("font-size",Math.round(y.fontSize)+"px");x.setAttribute("font-family",y.fontFamily);(y.fontStyle&mxConstants.FONT_BOLD)==mxConstants.FONT_BOLD&&x.setAttribute("font-weight","bold");(y.fontStyle&mxConstants.FONT_ITALIC)==mxConstants.FONT_ITALIC&&x.setAttribute("font-style","italic");(y.fontStyle&mxConstants.FONT_UNDERLINE)==mxConstants.FONT_UNDERLINE&&
|
|
|
|
|
x.setAttribute("text-decoration","underline");try{return m.innerHTML=e,x.textContent=m.value,x}catch(ra){return N.apply(this,arguments)}}else return N.apply(this,arguments)};var H=this.backgroundImage;if(null!=H){c=t/c;var p=this.view.translate,F=new mxRectangle(p.x*c,p.y*c,H.width*c,H.height*c);mxUtils.intersects(A,F)&&v.image(p.x,p.y,H.width,H.height,H.src,!0)}v.scale(a);v.textEnabled=g;l=null!=l?l:this.createSvgImageExport();var E=l.drawCellState,Q=l.getLinkForCellState;l.getLinkForCellState=function(a,
|
|
|
|
|
c){var b=Q.apply(this,arguments);return null==b||a.view.graph.isCustomLink(b)?null:b};l.drawCellState=function(a,c){for(var b=a.view.graph,f=b.isCellSelected(a.cell),d=b.model.getParent(a.cell);!e&&!f&&null!=d;)f=b.isCellSelected(d),d=b.model.getParent(d);(e||f)&&E.apply(this,arguments)};l.drawState(this.getView().getState(this.model.root),v);this.updateSvgLinks(x,u,!0);return x}finally{q&&(this.useCssTransforms=!0,this.view.revalidate(),this.sizeDidChange())}};Graph.prototype.updateSvgLinks=function(a,
|
|
|
|
|
c,b){a=a.getElementsByTagName("a");for(var f=0;f<a.length;f++){var d=a[f].getAttribute("href");null==d&&(d=a[f].getAttribute("xlink:href"));null!=d&&(null!=c&&/^https?:\/\//.test(d)?a[f].setAttribute("target",c):b&&this.isCustomLink(d)&&a[f].setAttribute("href","javascript:void(0);"))}};Graph.prototype.createSvgCanvas=function(a){return new mxSvgCanvas2D(a)};Graph.prototype.getSelectedElement=function(){var a=null;if(window.getSelection){var c=window.getSelection();c.getRangeAt&&c.rangeCount&&(a=
|
|
|
|
|
c.getRangeAt(0).commonAncestorContainer)}else document.selection&&(a=document.selection.createRange().parentElement());return a};Graph.prototype.getParentByName=function(a,c,b){for(;null!=a&&a.nodeName!=c;){if(a==b)return null;a=a.parentNode}return a};Graph.prototype.getParentByNames=function(a,c,b){for(;null!=a&&!(0<=mxUtils.indexOf(c,a.nodeName));){if(a==b)return null;a=a.parentNode}return a};Graph.prototype.selectNode=function(a){var c=null;if(window.getSelection){if(c=window.getSelection(),c.getRangeAt&&
|
|
|
|
|
c.rangeCount){var b=document.createRange();b.selectNode(a);c.removeAllRanges();c.addRange(b)}}else(c=document.selection)&&"Control"!=c.type&&(a=c.createRange(),a.collapse(!0),b=c.createRange(),b.setEndPoint("StartToStart",a),b.select())};Graph.prototype.insertRow=function(a,c){for(var b=a.tBodies[0],f=b.rows[0].cells,d=0,e=0;e<f.length;e++)var g=f[e].getAttribute("colspan"),d=d+(null!=g?parseInt(g):1);b=b.insertRow(c);for(e=0;e<d;e++)mxUtils.br(b.insertCell(-1));return b.cells[0]};Graph.prototype.deleteRow=
|
|
|
|
@ -2453,7 +2454,7 @@ this.currentDy)/d-f.y);d=this.graph.view.unit;this.hint.innerHTML=b(c,d)+", "+b(
|
|
|
|
|
var n=mxVertexHandler.prototype.getHandlePadding;mxVertexHandler.prototype.getHandlePadding=function(){var a=new mxPoint(0,0),c=this.tolerance;this.graph.cellEditor.getEditingCell()==this.state.cell&&null!=this.sizers&&0<this.sizers.length&&null!=this.sizers[0]?(c/=2,a.x=this.sizers[0].bounds.width+c,a.y=this.sizers[0].bounds.height+c):a=n.apply(this,arguments);return a};mxVertexHandler.prototype.updateHint=function(c){if(this.index!=mxEvent.LABEL_HANDLE){null==this.hint&&(this.hint=a(),this.state.view.graph.container.appendChild(this.hint));
|
|
|
|
|
if(this.index==mxEvent.ROTATION_HANDLE)this.hint.innerHTML=this.currentAlpha+"°";else{c=this.state.view.scale;var f=this.state.view.unit;this.hint.innerHTML=b(this.roundLength(this.bounds.width/c),f)+" x "+b(this.roundLength(this.bounds.height/c),f)}c=mxUtils.getBoundingBox(this.bounds,null!=this.currentAlpha?this.currentAlpha:this.state.style[mxConstants.STYLE_ROTATION]||"0");null==c&&(c=this.bounds);this.hint.style.left=c.x+Math.round((c.width-this.hint.clientWidth)/2)+"px";this.hint.style.top=
|
|
|
|
|
c.y+c.height+12+"px";null!=this.linkHint&&(this.linkHint.style.display="none")}};mxVertexHandler.prototype.removeHint=function(){mxGraphHandler.prototype.removeHint.apply(this,arguments);null!=this.linkHint&&(this.linkHint.style.display="")};var l=mxEdgeHandler.prototype.mouseMove;mxEdgeHandler.prototype.mouseMove=function(a,c){l.apply(this,arguments);null!=this.graph.graphHandler&&null!=this.graph.graphHandler.first&&null!=this.linkHint&&"none"!=this.linkHint.style.display&&(this.linkHint.style.display=
|
|
|
|
|
"none")};var x=mxEdgeHandler.prototype.mouseUp;mxEdgeHandler.prototype.mouseUp=function(a,c){x.apply(this,arguments);null!=this.linkHint&&"none"==this.linkHint.style.display&&(this.linkHint.style.display="")};mxEdgeHandler.prototype.updateHint=function(c,f){null==this.hint&&(this.hint=a(),this.state.view.graph.container.appendChild(this.hint));var d=this.graph.view.translate,e=this.graph.view.scale,g=this.roundLength(f.x/e-d.x),d=this.roundLength(f.y/e-d.y),e=this.graph.view.unit;this.hint.innerHTML=
|
|
|
|
|
"none")};var y=mxEdgeHandler.prototype.mouseUp;mxEdgeHandler.prototype.mouseUp=function(a,c){y.apply(this,arguments);null!=this.linkHint&&"none"==this.linkHint.style.display&&(this.linkHint.style.display="")};mxEdgeHandler.prototype.updateHint=function(c,f){null==this.hint&&(this.hint=a(),this.state.view.graph.container.appendChild(this.hint));var d=this.graph.view.translate,e=this.graph.view.scale,g=this.roundLength(f.x/e-d.x),d=this.roundLength(f.y/e-d.y),e=this.graph.view.unit;this.hint.innerHTML=
|
|
|
|
|
b(g,e)+", "+b(d,e);this.hint.style.visibility="visible";if(this.isSource||this.isTarget)null!=this.constraintHandler.currentConstraint&&null!=this.constraintHandler.currentFocus?(g=this.constraintHandler.currentConstraint.point,this.hint.innerHTML="["+Math.round(100*g.x)+"%, "+Math.round(100*g.y)+"%]"):this.marker.hasValidState()&&(this.hint.style.visibility="hidden");this.hint.style.left=Math.round(c.getGraphX()-this.hint.clientWidth/2)+"px";this.hint.style.top=Math.max(c.getGraphY(),f.y)+this.state.view.graph.gridSize+
|
|
|
|
|
"px";null!=this.linkHint&&(this.linkHint.style.display="none")};mxEdgeHandler.prototype.removeHint=mxVertexHandler.prototype.removeHint;HoverIcons.prototype.mainHandle=mxClient.IS_SVG?Graph.createSvgImage(18,18,'<circle cx="9" cy="9" r="5" stroke="#fff" fill="'+HoverIcons.prototype.arrowFill+'" stroke-width="1"/>'):new mxImage(IMAGE_PATH+"/handle-main.png",17,17);HoverIcons.prototype.secondaryHandle=mxClient.IS_SVG?Graph.createSvgImage(16,16,'<path d="m 8 3 L 13 8 L 8 13 L 3 8 z" stroke="#fff" fill="#fca000"/>'):
|
|
|
|
|
new mxImage(IMAGE_PATH+"/handle-secondary.png",17,17);HoverIcons.prototype.fixedHandle=mxClient.IS_SVG?Graph.createSvgImage(18,18,'<circle cx="9" cy="9" r="5" stroke="#fff" fill="'+HoverIcons.prototype.arrowFill+'" stroke-width="1"/><path d="m 7 7 L 11 11 M 7 11 L 11 7" stroke="#fff"/>'):new mxImage(IMAGE_PATH+"/handle-fixed.png",17,17);HoverIcons.prototype.terminalHandle=mxClient.IS_SVG?Graph.createSvgImage(18,18,'<circle cx="9" cy="9" r="5" stroke="#fff" fill="'+HoverIcons.prototype.arrowFill+'" stroke-width="1"/><circle cx="9" cy="9" r="2" stroke="#fff" fill="transparent"/>'):
|
|
|
|
@ -2472,8 +2473,8 @@ new mxRectangle(this.x,this.y,this.width,this.height),this.graph.selectRegion(e,
|
|
|
|
|
this.update(f,b),this.isSpaceEvent(c)?(f=this.x+this.width,b=this.y+this.height,d=this.graph.view.scale,mxEvent.isAltDown(c.getEvent())||(this.width=this.graph.snap(this.width/d)*d,this.height=this.graph.snap(this.height/d)*d,this.graph.isGridEnabled()||(this.width<this.graph.tolerance&&(this.width=0),this.height<this.graph.tolerance&&(this.height=0)),this.x<this.first.x&&(this.x=f-this.width),this.y<this.first.y&&(this.y=b-this.height)),this.div.style.borderStyle="dashed",this.div.style.backgroundColor=
|
|
|
|
|
"white",this.div.style.left=this.x+"px",this.div.style.top=this.y+"px",this.div.style.width=Math.max(0,this.width)+"px",this.div.style.height=this.graph.container.clientHeight+"px",this.div.style.borderWidth=0>=this.width?"0px 1px 0px 0px":"0px 1px 0px 1px",null==this.secondDiv&&(this.secondDiv=this.div.cloneNode(!0),this.div.parentNode.appendChild(this.secondDiv)),this.secondDiv.style.left=this.x+"px",this.secondDiv.style.top=this.y+"px",this.secondDiv.style.width=this.graph.container.clientWidth+
|
|
|
|
|
"px",this.secondDiv.style.height=Math.max(0,this.height)+"px",this.secondDiv.style.borderWidth=0>=this.height?"1px 0px 0px 0px":"1px 0px 1px 0px"):(this.div.style.backgroundColor="",this.div.style.borderWidth="",this.div.style.borderStyle="",null!=this.secondDiv&&(this.secondDiv.parentNode.removeChild(this.secondDiv),this.secondDiv=null)),c.consume()}};var t=mxRubberband.prototype.reset;mxRubberband.prototype.reset=function(){null!=this.secondDiv&&(this.secondDiv.parentNode.removeChild(this.secondDiv),
|
|
|
|
|
this.secondDiv=null);t.apply(this,arguments)};var E=(new Date).getTime(),y=0,F=mxEdgeHandler.prototype.updatePreviewState;mxEdgeHandler.prototype.updatePreviewState=function(a,c,b,f){F.apply(this,arguments);b!=this.currentTerminalState?(E=(new Date).getTime(),y=0):y=(new Date).getTime()-E;this.currentTerminalState=b};var u=mxEdgeHandler.prototype.isOutlineConnectEvent;mxEdgeHandler.prototype.isOutlineConnectEvent=function(a){return null!=this.currentTerminalState&&a.getState()==this.currentTerminalState&&
|
|
|
|
|
2E3<y||(null==this.currentTerminalState||"0"!=mxUtils.getValue(this.currentTerminalState.style,"outlineConnect","1"))&&u.apply(this,arguments)};mxVertexHandler.prototype.isCustomHandleEvent=function(a){return!mxEvent.isShiftDown(a.getEvent())};mxEdgeHandler.prototype.createHandleShape=function(a,c){var b=null!=a&&0==a,f=this.state.getVisibleTerminalState(b),d=null!=a&&(0==a||a>=this.state.absolutePoints.length-1||this.constructor==mxElbowEdgeHandler&&2==a)?this.graph.getConnectionConstraint(this.state,
|
|
|
|
|
this.secondDiv=null);t.apply(this,arguments)};var E=(new Date).getTime(),x=0,F=mxEdgeHandler.prototype.updatePreviewState;mxEdgeHandler.prototype.updatePreviewState=function(a,c,b,f){F.apply(this,arguments);b!=this.currentTerminalState?(E=(new Date).getTime(),x=0):x=(new Date).getTime()-E;this.currentTerminalState=b};var u=mxEdgeHandler.prototype.isOutlineConnectEvent;mxEdgeHandler.prototype.isOutlineConnectEvent=function(a){return null!=this.currentTerminalState&&a.getState()==this.currentTerminalState&&
|
|
|
|
|
2E3<x||(null==this.currentTerminalState||"0"!=mxUtils.getValue(this.currentTerminalState.style,"outlineConnect","1"))&&u.apply(this,arguments)};mxVertexHandler.prototype.isCustomHandleEvent=function(a){return!mxEvent.isShiftDown(a.getEvent())};mxEdgeHandler.prototype.createHandleShape=function(a,c){var b=null!=a&&0==a,f=this.state.getVisibleTerminalState(b),d=null!=a&&(0==a||a>=this.state.absolutePoints.length-1||this.constructor==mxElbowEdgeHandler&&2==a)?this.graph.getConnectionConstraint(this.state,
|
|
|
|
|
f,b):null,b=null!=(null!=d?this.graph.getConnectionPoint(this.state.getVisibleTerminalState(b),d):null)?this.fixedHandleImage:null!=d&&null!=f?this.terminalHandleImage:this.handleImage;if(null!=b)return b=new mxImageShape(new mxRectangle(0,0,b.width,b.height),b.src),b.preserveImageAspect=!1,b;b=mxConstants.HANDLE_SIZE;this.preferHtml&&--b;return new mxRectangleShape(new mxRectangle(0,0,b,b),mxConstants.HANDLE_FILLCOLOR,mxConstants.HANDLE_STROKECOLOR)};var A=mxVertexHandler.prototype.createSizerShape;
|
|
|
|
|
mxVertexHandler.prototype.createSizerShape=function(a,c,b){this.handleImage=c==mxEvent.ROTATION_HANDLE?HoverIcons.prototype.rotationHandle:c==mxEvent.LABEL_HANDLE?this.secondaryHandleImage:this.handleImage;return A.apply(this,arguments)};var N=mxGraphHandler.prototype.getBoundingBox;mxGraphHandler.prototype.getBoundingBox=function(a){if(null!=a&&1==a.length){var c=this.graph.getModel(),b=c.getParent(a[0]),f=this.graph.getCellGeometry(a[0]);if(c.isEdge(b)&&null!=f&&f.relative&&(c=this.graph.view.getState(a[0]),
|
|
|
|
|
null!=c&&2>c.width&&2>c.height&&null!=c.text&&null!=c.text.boundingBox))return mxRectangle.fromRectangle(c.text.boundingBox)}return N.apply(this,arguments)};var Y=mxGraphHandler.prototype.getGuideStates;mxGraphHandler.prototype.getGuideStates=function(){for(var a=Y.apply(this,arguments),c=[],b=0;b<a.length;b++)"1"!=mxUtils.getValue(a[b].style,"part","0")&&c.push(a[b]);return c};var H=mxVertexHandler.prototype.getSelectionBounds;mxVertexHandler.prototype.getSelectionBounds=function(a){var c=this.graph.getModel(),
|
|
|
|
@ -2495,7 +2496,7 @@ this.graph.getModel().removeListener(this.changeHandler),this.changeHandler=null
|
|
|
|
|
Math.max(0,Math.round(a.x+(a.width-this.linkHint.clientWidth)/2))+"px";this.linkHint.style.top=Math.round(a.y+a.height+6+this.state.view.graph.tolerance)+"px"}};var na=mxEdgeHandler.prototype.reset;mxEdgeHandler.prototype.reset=function(){na.apply(this,arguments);null!=this.linkHint&&(this.linkHint.style.visibility="")};var ja=mxEdgeHandler.prototype.destroy;mxEdgeHandler.prototype.destroy=function(){ja.apply(this,arguments);null!=this.linkHint&&(this.linkHint.parentNode.removeChild(this.linkHint),
|
|
|
|
|
this.linkHint=null);null!=this.changeHandler&&(this.graph.getModel().removeListener(this.changeHandler),this.graph.getSelectionModel().removeListener(this.changeHandler),this.changeHandler=null)}}();(function(){function a(){mxCylinder.call(this)}function b(){mxActor.call(this)}function e(){mxCylinder.call(this)}function d(){mxCylinder.call(this)}function k(){mxCylinder.call(this)}function m(){mxActor.call(this)}function p(){mxCylinder.call(this)}function v(){mxActor.call(this)}function z(){mxActor.call(this)}function B(){mxActor.call(this)}function c(){mxActor.call(this)}function f(){mxActor.call(this)}function g(){mxActor.call(this)}function q(){mxActor.call(this)}function n(a,c){this.canvas=
|
|
|
|
|
a;this.canvas.setLineJoin("round");this.canvas.setLineCap("round");this.defaultVariation=c;this.originalLineTo=this.canvas.lineTo;this.canvas.lineTo=mxUtils.bind(this,n.prototype.lineTo);this.originalMoveTo=this.canvas.moveTo;this.canvas.moveTo=mxUtils.bind(this,n.prototype.moveTo);this.originalClose=this.canvas.close;this.canvas.close=mxUtils.bind(this,n.prototype.close);this.originalQuadTo=this.canvas.quadTo;this.canvas.quadTo=mxUtils.bind(this,n.prototype.quadTo);this.originalCurveTo=this.canvas.curveTo;
|
|
|
|
|
this.canvas.curveTo=mxUtils.bind(this,n.prototype.curveTo);this.originalArcTo=this.canvas.arcTo;this.canvas.arcTo=mxUtils.bind(this,n.prototype.arcTo)}function l(){mxRectangleShape.call(this)}function x(){mxRectangleShape.call(this)}function C(){mxActor.call(this)}function t(){mxActor.call(this)}function E(){mxActor.call(this)}function y(){mxRectangleShape.call(this)}function F(){mxRectangleShape.call(this)}function u(){mxCylinder.call(this)}function A(){mxShape.call(this)}function N(){mxShape.call(this)}
|
|
|
|
|
this.canvas.curveTo=mxUtils.bind(this,n.prototype.curveTo);this.originalArcTo=this.canvas.arcTo;this.canvas.arcTo=mxUtils.bind(this,n.prototype.arcTo)}function l(){mxRectangleShape.call(this)}function y(){mxRectangleShape.call(this)}function C(){mxActor.call(this)}function t(){mxActor.call(this)}function E(){mxActor.call(this)}function x(){mxRectangleShape.call(this)}function F(){mxRectangleShape.call(this)}function u(){mxCylinder.call(this)}function A(){mxShape.call(this)}function N(){mxShape.call(this)}
|
|
|
|
|
function Y(){mxEllipse.call(this)}function H(){mxShape.call(this)}function P(){mxShape.call(this)}function D(){mxRectangleShape.call(this)}function K(){mxShape.call(this)}function O(){mxShape.call(this)}function Q(){mxShape.call(this)}function ba(){mxShape.call(this)}function W(){mxShape.call(this)}function G(){mxCylinder.call(this)}function Z(){mxDoubleEllipse.call(this)}function na(){mxDoubleEllipse.call(this)}function ja(){mxArrowConnector.call(this);this.spacing=0}function ca(){mxArrowConnector.call(this);
|
|
|
|
|
this.spacing=0}function ka(){mxActor.call(this)}function S(){mxRectangleShape.call(this)}function V(){mxActor.call(this)}function pa(){mxActor.call(this)}function ga(){mxActor.call(this)}function R(){mxActor.call(this)}function la(){mxActor.call(this)}function L(){mxActor.call(this)}function I(){mxActor.call(this)}function ea(){mxActor.call(this)}function M(){mxActor.call(this)}function T(){mxActor.call(this)}function ha(){mxEllipse.call(this)}function ia(){mxEllipse.call(this)}function J(){mxEllipse.call(this)}
|
|
|
|
|
function qa(){mxRhombus.call(this)}function aa(){mxEllipse.call(this)}function da(){mxEllipse.call(this)}function Aa(){mxEllipse.call(this)}function wa(){mxEllipse.call(this)}function za(){mxActor.call(this)}function ma(){mxActor.call(this)}function fa(){mxActor.call(this)}function sa(){mxConnector.call(this)}function Ea(a,c,b,f,d,e,g,l,u,n){g+=u;var X=f.clone();f.x-=d*(2*g+u);f.y-=e*(2*g+u);d*=g+u;e*=g+u;return function(){a.ellipse(X.x-d-g,X.y-e-g,2*g,2*g);n?a.fillAndStroke():a.stroke()}}mxUtils.extend(a,
|
|
|
|
@ -2524,17 +2525,17 @@ this.style||"0"==mxUtils.getValue(this.style,"comic","0"))&&La.apply(this,argume
|
|
|
|
|
(a.pointerEvents=!1),a.begin(),this.isRounded?("1"==mxUtils.getValue(this.style,mxConstants.STYLE_ABSOLUTE_ARCSIZE,0)?e=Math.min(f/2,Math.min(d/2,mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2)):(e=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100,e=Math.min(f*e,d*e)),a.moveTo(c+e,b),a.lineTo(c+f-e,b),a.quadTo(c+f,b,c+f,b+e),a.lineTo(c+f,b+d-e),a.quadTo(c+f,b+d,c+f-e,b+d),a.lineTo(c+e,b+d),a.quadTo(c,b+d,c,b+d-e),
|
|
|
|
|
a.lineTo(c,b+e),a.quadTo(c,b,c+e,b)):(a.moveTo(c,b),a.lineTo(c+f,b),a.lineTo(c+f,b+d),a.lineTo(c,b+d),a.lineTo(c,b)),a.close(),a.end(),a.fillAndStroke()}};var xa=mxRectangleShape.prototype.paintForeground;mxRectangleShape.prototype.paintForeground=function(a,c,b,f,d){null==a.handJiggle&&xa.apply(this,arguments)};mxUtils.extend(l,mxRectangleShape);l.prototype.size=.1;l.prototype.isHtmlAllowed=function(){return!1};l.prototype.getLabelBounds=function(a){if(mxUtils.getValue(this.state.style,mxConstants.STYLE_HORIZONTAL,
|
|
|
|
|
!0)==(null==this.direction||this.direction==mxConstants.DIRECTION_EAST||this.direction==mxConstants.DIRECTION_WEST)){var c=a.width,b=a.height;a=new mxRectangle(a.x,a.y,c,b);var f=c*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"size",this.size))));if(this.isRounded)var d=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100,f=Math.max(f,Math.min(c*d,b*d));a.x+=Math.round(f);a.width-=Math.round(2*f)}return a};l.prototype.paintForeground=
|
|
|
|
|
function(a,c,b,f,d){var e=f*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"size",this.size))));if(this.isRounded)var g=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100,e=Math.max(e,Math.min(f*g,d*g));e=Math.round(e);a.begin();a.moveTo(c+e,b);a.lineTo(c+e,b+d);a.moveTo(c+f-e,b);a.lineTo(c+f-e,b+d);a.end();a.stroke();mxRectangleShape.prototype.paintForeground.apply(this,arguments)};mxCellRenderer.registerShape("process",l);mxUtils.extend(x,
|
|
|
|
|
mxRectangleShape);x.prototype.paintBackground=function(a,c,b,f,d){a.setFillColor(mxConstants.NONE);a.rect(c,b,f,d);a.fill()};x.prototype.paintForeground=function(a,c,b,f,d){};mxCellRenderer.registerShape("transparent",x);mxUtils.extend(C,mxHexagon);C.prototype.size=30;C.prototype.position=.5;C.prototype.position2=.5;C.prototype.base=20;C.prototype.getLabelMargins=function(){return new mxRectangle(0,0,0,parseFloat(mxUtils.getValue(this.style,"size",this.size))*this.scale)};C.prototype.isRoundable=
|
|
|
|
|
function(a,c,b,f,d){var e=f*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"size",this.size))));if(this.isRounded)var g=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,100*mxConstants.RECTANGLE_ROUNDING_FACTOR)/100,e=Math.max(e,Math.min(f*g,d*g));e=Math.round(e);a.begin();a.moveTo(c+e,b);a.lineTo(c+e,b+d);a.moveTo(c+f-e,b);a.lineTo(c+f-e,b+d);a.end();a.stroke();mxRectangleShape.prototype.paintForeground.apply(this,arguments)};mxCellRenderer.registerShape("process",l);mxUtils.extend(y,
|
|
|
|
|
mxRectangleShape);y.prototype.paintBackground=function(a,c,b,f,d){a.setFillColor(mxConstants.NONE);a.rect(c,b,f,d);a.fill()};y.prototype.paintForeground=function(a,c,b,f,d){};mxCellRenderer.registerShape("transparent",y);mxUtils.extend(C,mxHexagon);C.prototype.size=30;C.prototype.position=.5;C.prototype.position2=.5;C.prototype.base=20;C.prototype.getLabelMargins=function(){return new mxRectangle(0,0,0,parseFloat(mxUtils.getValue(this.style,"size",this.size))*this.scale)};C.prototype.isRoundable=
|
|
|
|
|
function(){return!0};C.prototype.redrawPath=function(a,c,b,f,d){c=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;b=Math.max(0,Math.min(d,parseFloat(mxUtils.getValue(this.style,"size",this.size))));var e=f*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"position",this.position)))),g=f*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"position2",this.position2)))),l=Math.max(0,Math.min(f,parseFloat(mxUtils.getValue(this.style,"base",this.base))));
|
|
|
|
|
this.addPoints(a,[new mxPoint(0,0),new mxPoint(f,0),new mxPoint(f,d-b),new mxPoint(Math.min(f,e+l),d-b),new mxPoint(g,d),new mxPoint(Math.max(0,e),d-b),new mxPoint(0,d-b)],this.isRounded,c,!0,[4])};mxCellRenderer.registerShape("callout",C);mxUtils.extend(t,mxActor);t.prototype.size=.2;t.prototype.fixedSize=20;t.prototype.isRoundable=function(){return!0};t.prototype.redrawPath=function(a,c,b,f,d){c="0"!=mxUtils.getValue(this.style,"fixedSize","0")?Math.max(0,Math.min(f,parseFloat(mxUtils.getValue(this.style,
|
|
|
|
|
"size",this.fixedSize)))):f*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"size",this.size))));b=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;this.addPoints(a,[new mxPoint(0,0),new mxPoint(f-c,0),new mxPoint(f,d/2),new mxPoint(f-c,d),new mxPoint(0,d),new mxPoint(c,d/2)],this.isRounded,b,!0);a.end()};mxCellRenderer.registerShape("step",t);mxUtils.extend(E,mxHexagon);E.prototype.size=.25;E.prototype.isRoundable=function(){return!0};E.prototype.redrawPath=
|
|
|
|
|
function(a,c,b,f,d){c=f*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"size",this.size))));b=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;this.addPoints(a,[new mxPoint(c,0),new mxPoint(f-c,0),new mxPoint(f,.5*d),new mxPoint(f-c,d),new mxPoint(c,d),new mxPoint(0,.5*d)],this.isRounded,b,!0)};mxCellRenderer.registerShape("hexagon",E);mxUtils.extend(y,mxRectangleShape);y.prototype.isHtmlAllowed=function(){return!1};y.prototype.paintForeground=function(a,
|
|
|
|
|
c,b,f,d){var e=Math.min(f/5,d/5)+1;a.begin();a.moveTo(c+f/2,b+e);a.lineTo(c+f/2,b+d-e);a.moveTo(c+e,b+d/2);a.lineTo(c+f-e,b+d/2);a.end();a.stroke();mxRectangleShape.prototype.paintForeground.apply(this,arguments)};mxCellRenderer.registerShape("plus",y);var ua=mxRhombus.prototype.paintVertexShape;mxRhombus.prototype.getLabelBounds=function(a){if(1==this.style["double"]){var c=(2*Math.max(2,this.strokewidth+1)+parseFloat(this.style[mxConstants.STYLE_MARGIN]||0))*this.scale;return new mxRectangle(a.x+
|
|
|
|
|
function(a,c,b,f,d){c=f*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"size",this.size))));b=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2;this.addPoints(a,[new mxPoint(c,0),new mxPoint(f-c,0),new mxPoint(f,.5*d),new mxPoint(f-c,d),new mxPoint(c,d),new mxPoint(0,.5*d)],this.isRounded,b,!0)};mxCellRenderer.registerShape("hexagon",E);mxUtils.extend(x,mxRectangleShape);x.prototype.isHtmlAllowed=function(){return!1};x.prototype.paintForeground=function(a,
|
|
|
|
|
c,b,f,d){var e=Math.min(f/5,d/5)+1;a.begin();a.moveTo(c+f/2,b+e);a.lineTo(c+f/2,b+d-e);a.moveTo(c+e,b+d/2);a.lineTo(c+f-e,b+d/2);a.end();a.stroke();mxRectangleShape.prototype.paintForeground.apply(this,arguments)};mxCellRenderer.registerShape("plus",x);var ua=mxRhombus.prototype.paintVertexShape;mxRhombus.prototype.getLabelBounds=function(a){if(1==this.style["double"]){var c=(2*Math.max(2,this.strokewidth+1)+parseFloat(this.style[mxConstants.STYLE_MARGIN]||0))*this.scale;return new mxRectangle(a.x+
|
|
|
|
|
c,a.y+c,a.width-2*c,a.height-2*c)}return a};mxRhombus.prototype.paintVertexShape=function(a,c,b,f,d){ua.apply(this,arguments);if(!this.outline&&1==this.style["double"]){var e=2*Math.max(2,this.strokewidth+1)+parseFloat(this.style[mxConstants.STYLE_MARGIN]||0);c+=e;b+=e;f-=2*e;d-=2*e;0<f&&0<d&&(a.setShadow(!1),ua.apply(this,[a,c,b,f,d]))}};mxUtils.extend(F,mxRectangleShape);F.prototype.isHtmlAllowed=function(){return!1};F.prototype.getLabelBounds=function(a){if(1==this.style["double"]){var c=(Math.max(2,
|
|
|
|
|
this.strokewidth+1)+parseFloat(this.style[mxConstants.STYLE_MARGIN]||0))*this.scale;return new mxRectangle(a.x+c,a.y+c,a.width-2*c,a.height-2*c)}return a};F.prototype.paintForeground=function(a,c,b,f,d){if(null!=this.style){if(!this.outline&&1==this.style["double"]){var e=Math.max(2,this.strokewidth+1)+parseFloat(this.style[mxConstants.STYLE_MARGIN]||0);c+=e;b+=e;f-=2*e;d-=2*e;0<f&&0<d&&mxRectangleShape.prototype.paintBackground.apply(this,arguments)}a.setDashed(!1);var e=0,g;do{g=mxCellRenderer.defaultShapes[this.style["symbol"+
|
|
|
|
|
e]];if(null!=g){var l=this.style["symbol"+e+"Align"],X=this.style["symbol"+e+"VerticalAlign"],u=this.style["symbol"+e+"Width"],n=this.style["symbol"+e+"Height"],q=this.style["symbol"+e+"Spacing"]||0,A=this.style["symbol"+e+"VSpacing"]||q,t=this.style["symbol"+e+"ArcSpacing"];null!=t&&(t*=this.getArcSize(f+this.strokewidth,d+this.strokewidth),q+=t,A+=t);var t=c,x=b,t=l==mxConstants.ALIGN_CENTER?t+(f-u)/2:l==mxConstants.ALIGN_RIGHT?t+(f-u-q):t+q,x=X==mxConstants.ALIGN_MIDDLE?x+(d-n)/2:X==mxConstants.ALIGN_BOTTOM?
|
|
|
|
|
x+(d-n-A):x+A;a.save();l=new g;l.style=this.style;g.prototype.paintVertexShape.call(l,a,t,x,u,n);a.restore()}e++}while(null!=g)}mxRectangleShape.prototype.paintForeground.apply(this,arguments)};mxCellRenderer.registerShape("ext",F);mxUtils.extend(u,mxCylinder);u.prototype.redrawPath=function(a,c,b,f,d,e){e?(a.moveTo(0,0),a.lineTo(f/2,d/2),a.lineTo(f,0),a.end()):(a.moveTo(0,0),a.lineTo(f,0),a.lineTo(f,d),a.lineTo(0,d),a.close())};mxCellRenderer.registerShape("message",u);mxUtils.extend(A,mxShape);
|
|
|
|
|
e]];if(null!=g){var l=this.style["symbol"+e+"Align"],X=this.style["symbol"+e+"VerticalAlign"],u=this.style["symbol"+e+"Width"],n=this.style["symbol"+e+"Height"],q=this.style["symbol"+e+"Spacing"]||0,A=this.style["symbol"+e+"VSpacing"]||q,t=this.style["symbol"+e+"ArcSpacing"];null!=t&&(t*=this.getArcSize(f+this.strokewidth,d+this.strokewidth),q+=t,A+=t);var t=c,y=b,t=l==mxConstants.ALIGN_CENTER?t+(f-u)/2:l==mxConstants.ALIGN_RIGHT?t+(f-u-q):t+q,y=X==mxConstants.ALIGN_MIDDLE?y+(d-n)/2:X==mxConstants.ALIGN_BOTTOM?
|
|
|
|
|
y+(d-n-A):y+A;a.save();l=new g;l.style=this.style;g.prototype.paintVertexShape.call(l,a,t,y,u,n);a.restore()}e++}while(null!=g)}mxRectangleShape.prototype.paintForeground.apply(this,arguments)};mxCellRenderer.registerShape("ext",F);mxUtils.extend(u,mxCylinder);u.prototype.redrawPath=function(a,c,b,f,d,e){e?(a.moveTo(0,0),a.lineTo(f/2,d/2),a.lineTo(f,0),a.end()):(a.moveTo(0,0),a.lineTo(f,0),a.lineTo(f,d),a.lineTo(0,d),a.close())};mxCellRenderer.registerShape("message",u);mxUtils.extend(A,mxShape);
|
|
|
|
|
A.prototype.paintBackground=function(a,c,b,f,d){a.translate(c,b);a.ellipse(f/4,0,f/2,d/4);a.fillAndStroke();a.begin();a.moveTo(f/2,d/4);a.lineTo(f/2,2*d/3);a.moveTo(f/2,d/3);a.lineTo(0,d/3);a.moveTo(f/2,d/3);a.lineTo(f,d/3);a.moveTo(f/2,2*d/3);a.lineTo(0,d);a.moveTo(f/2,2*d/3);a.lineTo(f,d);a.end();a.stroke()};mxCellRenderer.registerShape("umlActor",A);mxUtils.extend(N,mxShape);N.prototype.getLabelMargins=function(a){return new mxRectangle(a.width/6,0,0,0)};N.prototype.paintBackground=function(a,
|
|
|
|
|
c,b,f,d){a.translate(c,b);a.begin();a.moveTo(0,d/4);a.lineTo(0,3*d/4);a.end();a.stroke();a.begin();a.moveTo(0,d/2);a.lineTo(f/6,d/2);a.end();a.stroke();a.ellipse(f/6,0,5*f/6,d);a.fillAndStroke()};mxCellRenderer.registerShape("umlBoundary",N);mxUtils.extend(Y,mxEllipse);Y.prototype.paintVertexShape=function(a,c,b,f,d){mxEllipse.prototype.paintVertexShape.apply(this,arguments);a.begin();a.moveTo(c+f/8,b+d);a.lineTo(c+7*f/8,b+d);a.end();a.stroke()};mxCellRenderer.registerShape("umlEntity",Y);mxUtils.extend(H,
|
|
|
|
|
mxShape);H.prototype.paintVertexShape=function(a,c,b,f,d){a.translate(c,b);a.begin();a.moveTo(f,0);a.lineTo(0,d);a.moveTo(0,0);a.lineTo(f,d);a.end();a.stroke()};mxCellRenderer.registerShape("umlDestroy",H);mxUtils.extend(P,mxShape);P.prototype.getLabelBounds=function(a){return new mxRectangle(a.x,a.y+a.height/8,a.width,7*a.height/8)};P.prototype.paintBackground=function(a,c,b,f,d){a.translate(c,b);a.begin();a.moveTo(3*f/8,d/8*1.1);a.lineTo(5*f/8,0);a.end();a.stroke();a.ellipse(0,d/8,f,7*d/8);a.fillAndStroke()};
|
|
|
|
@ -2583,7 +2584,7 @@ wa);mxUtils.extend(za,mxActor);za.prototype.redrawPath=function(a,c,b,f,d){c=Mat
|
|
|
|
|
mxCellRenderer.registerShape("display",fa);mxUtils.extend(sa,mxConnector);sa.prototype.origPaintEdgeShape=sa.prototype.paintEdgeShape;sa.prototype.paintEdgeShape=function(a,c,b){for(var f=[],d=0;d<c.length;d++)f.push(mxUtils.clone(c[d]));var d=a.state.dashed,e=a.state.fixDash;sa.prototype.origPaintEdgeShape.apply(this,[a,f,b]);3<=a.state.strokeWidth&&(f=mxUtils.getValue(this.style,"fillColor",null),null!=f&&(a.setStrokeColor(f),a.setStrokeWidth(a.state.strokeWidth-2),a.setDashed(d,e),sa.prototype.origPaintEdgeShape.apply(this,
|
|
|
|
|
[a,c,b])))};mxCellRenderer.registerShape("filledEdge",sa);"undefined"!==typeof StyleFormatPanel&&function(){var a=StyleFormatPanel.prototype.getCustomColors;StyleFormatPanel.prototype.getCustomColors=function(){var c=this.format.getSelectionState(),b=a.apply(this,arguments);"umlFrame"==c.style.shape&&b.push({title:mxResources.get("laneColor"),key:"swimlaneFillColor",defaultValue:"#ffffff"});return b}}();mxMarker.addMarker("dash",function(a,c,b,f,d,e,g,l,u,n){var q=d*(g+u+1),A=e*(g+u+1);return function(){a.begin();
|
|
|
|
|
a.moveTo(f.x-q/2-A/2,f.y-A/2+q/2);a.lineTo(f.x+A/2-3*q/2,f.y-3*A/2-q/2);a.stroke()}});mxMarker.addMarker("cross",function(a,c,b,f,d,e,g,l,u,n){var q=d*(g+u+1),A=e*(g+u+1);return function(){a.begin();a.moveTo(f.x-q/2-A/2,f.y-A/2+q/2);a.lineTo(f.x+A/2-3*q/2,f.y-3*A/2-q/2);a.moveTo(f.x-q/2+A/2,f.y-A/2-q/2);a.lineTo(f.x-A/2-3*q/2,f.y-3*A/2+q/2);a.stroke()}});mxMarker.addMarker("circle",Ea);mxMarker.addMarker("circlePlus",function(a,c,b,f,d,e,g,l,u,n){var q=f.clone(),A=Ea.apply(this,arguments),t=d*(g+
|
|
|
|
|
2*u),x=e*(g+2*u);return function(){A.apply(this,arguments);a.begin();a.moveTo(q.x-d*u,q.y-e*u);a.lineTo(q.x-2*t+d*u,q.y-2*x+e*u);a.moveTo(q.x-t-x+e*u,q.y-x+t-d*u);a.lineTo(q.x+x-t-e*u,q.y-x-t+d*u);a.stroke()}});mxMarker.addMarker("halfCircle",function(a,c,b,f,d,e,g,l,u,n){var q=d*(g+u+1),A=e*(g+u+1),t=f.clone();f.x-=q;f.y-=A;return function(){a.begin();a.moveTo(t.x-A,t.y+q);a.quadTo(f.x-A,f.y+q,f.x,f.y);a.quadTo(f.x+A,f.y-q,t.x+A,t.y-q);a.stroke()}});mxMarker.addMarker("async",function(a,c,b,f,d,
|
|
|
|
|
2*u),y=e*(g+2*u);return function(){A.apply(this,arguments);a.begin();a.moveTo(q.x-d*u,q.y-e*u);a.lineTo(q.x-2*t+d*u,q.y-2*y+e*u);a.moveTo(q.x-t-y+e*u,q.y-y+t-d*u);a.lineTo(q.x+y-t-e*u,q.y-y-t+d*u);a.stroke()}});mxMarker.addMarker("halfCircle",function(a,c,b,f,d,e,g,l,u,n){var q=d*(g+u+1),A=e*(g+u+1),t=f.clone();f.x-=q;f.y-=A;return function(){a.begin();a.moveTo(t.x-A,t.y+q);a.quadTo(f.x-A,f.y+q,f.x,f.y);a.quadTo(f.x+A,f.y-q,t.x+A,t.y-q);a.stroke()}});mxMarker.addMarker("async",function(a,c,b,f,d,
|
|
|
|
|
e,g,l,u,n){c=d*u*1.118;b=e*u*1.118;d*=g+u;e*=g+u;var q=f.clone();q.x-=c;q.y-=b;f.x+=1*-d-c;f.y+=1*-e-b;return function(){a.begin();a.moveTo(q.x,q.y);l?a.lineTo(q.x-d-e/2,q.y-e+d/2):a.lineTo(q.x+e/2-d,q.y-e-d/2);a.lineTo(q.x-d,q.y-e);a.close();n?a.fillAndStroke():a.stroke()}});mxMarker.addMarker("openAsync",function(a){a=null!=a?a:2;return function(c,b,f,d,e,g,l,u,n,q){e*=l+n;g*=l+n;var A=d.clone();return function(){c.begin();c.moveTo(A.x,A.y);u?c.lineTo(A.x-e-g/a,A.y-g+e/a):c.lineTo(A.x+g/a-e,A.y-
|
|
|
|
|
g-e/a);c.stroke()}}}(2));if("undefined"!==typeof mxVertexHandler){var Fa=function(a,c,b){return ya(a,["width"],c,function(c,f,d,e,g){g=a.shape.getEdgeWidth()*a.view.scale+b;return new mxPoint(e.x+f*c/4+d*g/2,e.y+d*c/4-f*g/2)},function(c,f,d,e,g,l){c=Math.sqrt(mxUtils.ptSegDistSq(e.x,e.y,g.x,g.y,l.x,l.y));a.style.width=Math.round(2*c)/a.view.scale-b})},ya=function(a,c,b,f,d){return U(a,c,function(c){var d=a.absolutePoints,e=d.length-1;c=a.view.translate;var g=a.view.scale,l=b?d[0]:d[e],d=b?d[1]:d[e-
|
|
|
|
|
1],e=d.x-l.x,u=d.y-l.y,n=Math.sqrt(e*e+u*u),l=f.call(this,n,e/n,u/n,l,d);return new mxPoint(l.x/g-c.x,l.y/g-c.y)},function(c,f,e){var g=a.absolutePoints,l=g.length-1;c=a.view.translate;var u=a.view.scale,n=b?g[0]:g[l],g=b?g[1]:g[l-1],l=g.x-n.x,q=g.y-n.y,A=Math.sqrt(l*l+q*q);f.x=(f.x+c.x)*u;f.y=(f.y+c.y)*u;d.call(this,A,l/A,q/A,n,g,f,e)})},va=function(a){return function(c){return[U(c,["arrowWidth","arrowSize"],function(c){var b=Math.max(0,Math.min(1,mxUtils.getValue(this.state.style,"arrowWidth",R.prototype.arrowWidth))),
|
|
|
|
@ -2621,14 +2622,14 @@ Math.min(1,parseFloat(mxUtils.getValue(this.state.style,"size",z.prototype.size)
|
|
|
|
|
a.height-c.y)/a.height))})]},step:Ga(t.prototype.size,!0,null,!0,t.prototype.fixedSize),hexagon:Ga(E.prototype.size,!0,.5,!0),curlyBracket:Ga(g.prototype.size,!1),display:Ga(fa.prototype.size,!1),cube:Ma(1,a.prototype.size,!1),card:Ma(.5,v.prototype.size,!0),loopLimit:Ma(.5,M.prototype.size,!0),trapezoid:Na(.5),parallelogram:Na(1)};Graph.createHandle=U;Graph.handleFactory=Ha;mxVertexHandler.prototype.createCustomHandles=function(){if(1==this.state.view.graph.getSelectionCount()&&this.graph.isCellRotatable(this.state.cell)){var a=
|
|
|
|
|
this.state.style.shape;null==mxCellRenderer.defaultShapes[a]&&null==mxStencilRegistry.getStencil(a)&&(a=mxConstants.SHAPE_RECTANGLE);a=Ha[a];null==a&&null!=this.state.shape&&this.state.shape.isRoundable()&&(a=Ha[mxConstants.SHAPE_RECTANGLE]);if(null!=a)return a(this.state)}return null};mxEdgeHandler.prototype.createCustomHandles=function(){if(1==this.state.view.graph.getSelectionCount()){var a=this.state.style.shape;null==mxCellRenderer.defaultShapes[a]&&null==mxStencilRegistry.getStencil(a)&&(a=
|
|
|
|
|
mxConstants.SHAPE_CONNECTOR);a=Ha[a];if(null!=a)return a(this.state)}return null}}else Graph.createHandle=function(){},Graph.handleFactory={};var Ia=new mxPoint(1,0),Ja=new mxPoint(1,0),va=mxUtils.toRadians(-30),Ia=mxUtils.getRotatedPoint(Ia,Math.cos(va),Math.sin(va)),va=mxUtils.toRadians(-150),Ja=mxUtils.getRotatedPoint(Ja,Math.cos(va),Math.sin(va));mxEdgeStyle.IsometricConnector=function(a,c,b,f,d){var e=a.view;f=null!=f&&0<f.length?f[0]:null;var g=a.absolutePoints,l=g[0],g=g[g.length-1];null!=
|
|
|
|
|
f&&(f=e.transformControlPoint(a,f));null==l&&null!=c&&(l=new mxPoint(c.getCenterX(),c.getCenterY()));null==g&&null!=b&&(g=new mxPoint(b.getCenterX(),b.getCenterY()));var u=Ia.x,n=Ia.y,q=Ja.x,A=Ja.y,t="horizontal"==mxUtils.getValue(a.style,"elbow","horizontal");if(null!=g&&null!=l){a=function(a,c,b){a-=x.x;var f=c-x.y;c=(A*a-q*f)/(u*A-n*q);a=(n*a-u*f)/(n*q-u*A);t?(b&&(x=new mxPoint(x.x+u*c,x.y+n*c),d.push(x)),x=new mxPoint(x.x+q*a,x.y+A*a)):(b&&(x=new mxPoint(x.x+q*a,x.y+A*a),d.push(x)),x=new mxPoint(x.x+
|
|
|
|
|
u*c,x.y+n*c));d.push(x)};var x=l;null==f&&(f=new mxPoint(l.x+(g.x-l.x)/2,l.y+(g.y-l.y)/2));a(f.x,f.y,!0);a(g.x,g.y,!1)}};mxStyleRegistry.putValue("isometricEdgeStyle",mxEdgeStyle.IsometricConnector);var Oa=Graph.prototype.createEdgeHandler;Graph.prototype.createEdgeHandler=function(a,c){if(c==mxEdgeStyle.IsometricConnector){var b=new mxElbowEdgeHandler(a);b.snapToTerminals=!1;return b}return Oa.apply(this,arguments)};b.prototype.constraints=[];e.prototype.getConstraints=function(a,c,b){a=[];var f=
|
|
|
|
|
f&&(f=e.transformControlPoint(a,f));null==l&&null!=c&&(l=new mxPoint(c.getCenterX(),c.getCenterY()));null==g&&null!=b&&(g=new mxPoint(b.getCenterX(),b.getCenterY()));var u=Ia.x,n=Ia.y,q=Ja.x,A=Ja.y,t="horizontal"==mxUtils.getValue(a.style,"elbow","horizontal");if(null!=g&&null!=l){a=function(a,c,b){a-=y.x;var f=c-y.y;c=(A*a-q*f)/(u*A-n*q);a=(n*a-u*f)/(n*q-u*A);t?(b&&(y=new mxPoint(y.x+u*c,y.y+n*c),d.push(y)),y=new mxPoint(y.x+q*a,y.y+A*a)):(b&&(y=new mxPoint(y.x+q*a,y.y+A*a),d.push(y)),y=new mxPoint(y.x+
|
|
|
|
|
u*c,y.y+n*c));d.push(y)};var y=l;null==f&&(f=new mxPoint(l.x+(g.x-l.x)/2,l.y+(g.y-l.y)/2));a(f.x,f.y,!0);a(g.x,g.y,!1)}};mxStyleRegistry.putValue("isometricEdgeStyle",mxEdgeStyle.IsometricConnector);var Oa=Graph.prototype.createEdgeHandler;Graph.prototype.createEdgeHandler=function(a,c){if(c==mxEdgeStyle.IsometricConnector){var b=new mxElbowEdgeHandler(a);b.snapToTerminals=!1;return b}return Oa.apply(this,arguments)};b.prototype.constraints=[];e.prototype.getConstraints=function(a,c,b){a=[];var f=
|
|
|
|
|
Math.tan(mxUtils.toRadians(30)),d=(.5-f)/2,f=Math.min(c,b/(.5+f));c=(c-f)/2;b=(b-f)/2;a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c,b+.25*f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c+.5*f,b+f*d));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c+f,b+.25*f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c+f,b+.75*f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c+.5*f,b+(1-d)*f));a.push(new mxConnectionConstraint(new mxPoint(0,
|
|
|
|
|
0),!1,null,c,b+.75*f));return a};C.prototype.getConstraints=function(a,c,b){a=[];mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE);var f=Math.max(0,Math.min(b,parseFloat(mxUtils.getValue(this.style,"size",this.size))));parseFloat(mxUtils.getValue(this.style,"position",this.position));var d=c*Math.max(0,Math.min(1,parseFloat(mxUtils.getValue(this.style,"position2",this.position2))));parseFloat(mxUtils.getValue(this.style,"base",this.base));a.push(new mxConnectionConstraint(new mxPoint(0,
|
|
|
|
|
0),!1));a.push(new mxConnectionConstraint(new mxPoint(.25,0),!1));a.push(new mxConnectionConstraint(new mxPoint(.5,0),!1));a.push(new mxConnectionConstraint(new mxPoint(.75,0),!1));a.push(new mxConnectionConstraint(new mxPoint(1,0),!1));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c,.5*(b-f)));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c,b-f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,d,b));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,
|
|
|
|
|
b-f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,.5*(b-f)));c>=2*f&&a.push(new mxConnectionConstraint(new mxPoint(.5,0),!1));return a};mxRectangleShape.prototype.constraints=[new mxConnectionConstraint(new mxPoint(.25,0),!0),new mxConnectionConstraint(new mxPoint(.5,0),!0),new mxConnectionConstraint(new mxPoint(.75,0),!0),new mxConnectionConstraint(new mxPoint(0,.25),!0),new mxConnectionConstraint(new mxPoint(0,.5),!0),new mxConnectionConstraint(new mxPoint(0,.75),!0),new mxConnectionConstraint(new mxPoint(1,
|
|
|
|
|
.25),!0),new mxConnectionConstraint(new mxPoint(1,.5),!0),new mxConnectionConstraint(new mxPoint(1,.75),!0),new mxConnectionConstraint(new mxPoint(.25,1),!0),new mxConnectionConstraint(new mxPoint(.5,1),!0),new mxConnectionConstraint(new mxPoint(.75,1),!0)];mxEllipse.prototype.constraints=[new mxConnectionConstraint(new mxPoint(0,0),!0),new mxConnectionConstraint(new mxPoint(1,0),!0),new mxConnectionConstraint(new mxPoint(0,1),!0),new mxConnectionConstraint(new mxPoint(1,1),!0),new mxConnectionConstraint(new mxPoint(.5,
|
|
|
|
|
0),!0),new mxConnectionConstraint(new mxPoint(.5,1),!0),new mxConnectionConstraint(new mxPoint(0,.5),!0),new mxConnectionConstraint(new mxPoint(1,.5))];mxLabel.prototype.constraints=mxRectangleShape.prototype.constraints;mxImageShape.prototype.constraints=mxRectangleShape.prototype.constraints;mxSwimlane.prototype.constraints=mxRectangleShape.prototype.constraints;y.prototype.constraints=mxRectangleShape.prototype.constraints;k.prototype.getConstraints=function(a,c,b){a=[];var f=Math.max(0,Math.min(c,
|
|
|
|
|
0),!0),new mxConnectionConstraint(new mxPoint(.5,1),!0),new mxConnectionConstraint(new mxPoint(0,.5),!0),new mxConnectionConstraint(new mxPoint(1,.5))];mxLabel.prototype.constraints=mxRectangleShape.prototype.constraints;mxImageShape.prototype.constraints=mxRectangleShape.prototype.constraints;mxSwimlane.prototype.constraints=mxRectangleShape.prototype.constraints;x.prototype.constraints=mxRectangleShape.prototype.constraints;k.prototype.getConstraints=function(a,c,b){a=[];var f=Math.max(0,Math.min(c,
|
|
|
|
|
Math.min(b,parseFloat(mxUtils.getValue(this.style,"size",this.size)))));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*(c-f),0));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c-f,0));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c-.5*f,.5*f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c,f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,c,.5*(b+f)));a.push(new mxConnectionConstraint(new mxPoint(1,
|
|
|
|
|
1),!1));a.push(new mxConnectionConstraint(new mxPoint(.5,1),!1));a.push(new mxConnectionConstraint(new mxPoint(0,1),!1));a.push(new mxConnectionConstraint(new mxPoint(0,.5),!1));c>=2*f&&a.push(new mxConnectionConstraint(new mxPoint(.5,0),!1));return a};v.prototype.getConstraints=function(a,c,b){a=[];var f=Math.max(0,Math.min(c,Math.min(b,parseFloat(mxUtils.getValue(this.style,"size",this.size)))));a.push(new mxConnectionConstraint(new mxPoint(1,0),!1));a.push(new mxConnectionConstraint(new mxPoint(0,
|
|
|
|
|
0),!1,null,.5*(c+f),0));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,f,0));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,.5*f,.5*f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,f));a.push(new mxConnectionConstraint(new mxPoint(0,0),!1,null,0,.5*(b+f)));a.push(new mxConnectionConstraint(new mxPoint(0,1),!1));a.push(new mxConnectionConstraint(new mxPoint(.5,1),!1));a.push(new mxConnectionConstraint(new mxPoint(1,1),!1));a.push(new mxConnectionConstraint(new mxPoint(1,
|
|
|
|
@ -2671,7 +2672,7 @@ function(){d.openLink(b.getUrl())});this.addAction("open...",function(){window.o
|
|
|
|
|
": "+c.message)}}));b.showDialog((new OpenDialog(this)).container,320,220,!0,!0,function(){window.openFile=null})}).isEnabled=k;this.addAction("save",function(){b.saveFile(!1)},null,null,Editor.ctrlKey+"+S").isEnabled=k;this.addAction("saveAs...",function(){b.saveFile(!0)},null,null,Editor.ctrlKey+"+Shift+S").isEnabled=k;this.addAction("export...",function(){b.showDialog((new ExportDialog(b)).container,300,296,!0,!0)});this.addAction("editDiagram...",function(){var a=new EditDiagramDialog(b);b.showDialog(a.container,
|
|
|
|
|
620,420,!0,!1);a.init()});this.addAction("pageSetup...",function(){b.showDialog((new PageSetupDialog(b)).container,320,220,!0,!0)}).isEnabled=k;this.addAction("print...",function(){b.showDialog((new PrintDialog(b)).container,300,180,!0,!0)},null,"sprite-print",Editor.ctrlKey+"+P");this.addAction("preview",function(){mxUtils.show(d,null,10,10)});this.addAction("undo",function(){b.undo()},null,"sprite-undo",Editor.ctrlKey+"+Z");this.addAction("redo",function(){b.redo()},null,"sprite-redo",mxClient.IS_WIN?
|
|
|
|
|
Editor.ctrlKey+"+Y":Editor.ctrlKey+"+Shift+Z");this.addAction("cut",function(){mxClipboard.cut(d)},null,"sprite-cut",Editor.ctrlKey+"+X");this.addAction("copy",function(){mxClipboard.copy(d)},null,"sprite-copy",Editor.ctrlKey+"+C");this.addAction("paste",function(){d.isEnabled()&&!d.isCellLocked(d.getDefaultParent())&&mxClipboard.paste(d)},!1,"sprite-paste",Editor.ctrlKey+"+V");this.addAction("pasteHere",function(a){if(d.isEnabled()&&!d.isCellLocked(d.getDefaultParent())){d.getModel().beginUpdate();
|
|
|
|
|
try{var b=mxClipboard.paste(d);if(null!=b){a=!0;for(var e=0;e<b.length&&a;e++)a=a&&d.model.isEdge(b[e]);var c=d.view.translate,f=d.view.scale,g=c.x,q=c.y,c=null;if(1==b.length&&a){var n=d.getCellGeometry(b[0]);null!=n&&(c=n.getTerminalPoint(!0))}c=null!=c?c:d.getBoundingBoxFromGeometry(b,a);if(null!=c){var l=Math.round(d.snap(d.popupMenuHandler.triggerX/f-g)),x=Math.round(d.snap(d.popupMenuHandler.triggerY/f-q));d.cellsMoved(b,l-c.x,x-c.y)}}}finally{d.getModel().endUpdate()}}});this.addAction("copySize",
|
|
|
|
|
try{var b=mxClipboard.paste(d);if(null!=b){a=!0;for(var e=0;e<b.length&&a;e++)a=a&&d.model.isEdge(b[e]);var c=d.view.translate,f=d.view.scale,g=c.x,q=c.y,c=null;if(1==b.length&&a){var n=d.getCellGeometry(b[0]);null!=n&&(c=n.getTerminalPoint(!0))}c=null!=c?c:d.getBoundingBoxFromGeometry(b,a);if(null!=c){var l=Math.round(d.snap(d.popupMenuHandler.triggerX/f-g)),y=Math.round(d.snap(d.popupMenuHandler.triggerY/f-q));d.cellsMoved(b,l-c.x,y-c.y)}}}finally{d.getModel().endUpdate()}}});this.addAction("copySize",
|
|
|
|
|
function(a){a=d.getSelectionCell();d.isEnabled()&&null!=a&&d.getModel().isVertex(a)&&(a=d.getCellGeometry(a),null!=a&&(b.copiedSize=new mxRectangle(a.x,a.y,a.width,a.height)))},null,null,"Alt+Shit+X");this.addAction("pasteSize",function(a){if(d.isEnabled()&&!d.isSelectionEmpty()&&null!=b.copiedSize){d.getModel().beginUpdate();try{var e=d.getSelectionCells();for(a=0;a<e.length;a++)if(d.getModel().isVertex(e[a])){var k=d.getCellGeometry(e[a]);null!=k&&(k=k.clone(),k.width=b.copiedSize.width,k.height=
|
|
|
|
|
b.copiedSize.height,d.getModel().setGeometry(e[a],k))}}finally{d.getModel().endUpdate()}}},null,null,"Alt+Shit+V");this.addAction("delete",function(b){a(null!=b&&mxEvent.isShiftDown(b))},null,null,"Delete");this.addAction("deleteAll",function(){a(!0)},null,null,Editor.ctrlKey+"+Delete");this.addAction("duplicate",function(){d.setSelectionCells(d.duplicateCells())},null,null,Editor.ctrlKey+"+D");this.put("turn",new Action(mxResources.get("turn")+" / "+mxResources.get("reverse"),function(){d.turnShapes(d.getSelectionCells())},
|
|
|
|
|
null,null,Editor.ctrlKey+"+R"));this.addAction("selectVertices",function(){d.selectVertices()},null,null,Editor.ctrlKey+"+Shift+I");this.addAction("selectEdges",function(){d.selectEdges()},null,null,Editor.ctrlKey+"+Shift+E");this.addAction("selectAll",function(){d.selectAll(null,!0)},null,null,Editor.ctrlKey+"+A");this.addAction("selectNone",function(){d.clearSelection()},null,null,Editor.ctrlKey+"+Shift+A");this.addAction("lockUnlock",function(){if(!d.isSelectionEmpty()){d.getModel().beginUpdate();
|
|
|
|
@ -2713,8 +2714,8 @@ if(null!=a&&d.getModel().isEdge(a)){var b=e.graph.selectionCellsHandler.getHandl
|
|
|
|
|
b.actions.get("removeWaypoint");null!=a.handler&&a.handler.removePoint(a.handler.state,a.index)});this.addAction("clearWaypoints",function(){var a=d.getSelectionCells();if(null!=a){a=d.addAllEdges(a);d.getModel().beginUpdate();try{for(var b=0;b<a.length;b++){var e=a[b];if(d.getModel().isEdge(e)){var c=d.getCellGeometry(e);null!=c&&(c=c.clone(),c.points=null,d.getModel().setGeometry(e,c))}}}finally{d.getModel().endUpdate()}}},null,null,"Alt+Shift+C");m=this.addAction("subscript",mxUtils.bind(this,
|
|
|
|
|
function(){d.cellEditor.isContentEditing()&&document.execCommand("subscript",!1,null)}),null,null,Editor.ctrlKey+"+,");m=this.addAction("superscript",mxUtils.bind(this,function(){d.cellEditor.isContentEditing()&&document.execCommand("superscript",!1,null)}),null,null,Editor.ctrlKey+"+.");this.addAction("image...",function(){if(d.isEnabled()&&!d.isCellLocked(d.getDefaultParent())){var a=mxResources.get("image")+" ("+mxResources.get("url")+"):",e=d.getView().getState(d.getSelectionCell()),k="";null!=
|
|
|
|
|
e&&(k=e.style[mxConstants.STYLE_IMAGE]||k);var c=d.cellEditor.saveSelection();b.showImageDialog(a,k,function(a,b,e){if(d.cellEditor.isContentEditing())d.cellEditor.restoreSelection(c),d.insertImage(a,b,e);else{var f=d.getSelectionCells();if(null!=a&&(0<a.length||0<f.length)){var g=null;d.getModel().beginUpdate();try{if(0==f.length){var q=d.getFreeInsertPoint(),g=f=[d.insertVertex(d.getDefaultParent(),null,"",q.x,q.y,b,e,"shape=image;imageAspect=0;aspect=fixed;verticalLabelPosition=bottom;verticalAlign=top;")];
|
|
|
|
|
d.fireEvent(new mxEventObject("cellsInserted","cells",g))}d.setCellStyles(mxConstants.STYLE_IMAGE,0<a.length?a:null,f);var k=d.view.getState(f[0]),t=null!=k?k.style:d.getCellStyle(f[0]);"image"!=t[mxConstants.STYLE_SHAPE]&&"label"!=t[mxConstants.STYLE_SHAPE]?d.setCellStyles(mxConstants.STYLE_SHAPE,"image",f):0==a.length&&d.setCellStyles(mxConstants.STYLE_SHAPE,null,f);if(1==d.getSelectionCount()&&null!=b&&null!=e){var m=f[0],y=d.getModel().getGeometry(m);null!=y&&(y=y.clone(),y.width=b,y.height=e,
|
|
|
|
|
d.getModel().setGeometry(m,y))}}finally{d.getModel().endUpdate()}null!=g&&(d.setSelectionCells(g),d.scrollCellToVisible(g[0]))}}},d.cellEditor.isContentEditing(),!d.cellEditor.isContentEditing())}}).isEnabled=k;m=this.addAction("layers",mxUtils.bind(this,function(){null==this.layersWindow?(this.layersWindow=new LayersWindow(b,document.body.offsetWidth-280,120,220,180),this.layersWindow.window.addListener("show",function(){b.fireEvent(new mxEventObject("layers"))}),this.layersWindow.window.addListener("hide",
|
|
|
|
|
d.fireEvent(new mxEventObject("cellsInserted","cells",g))}d.setCellStyles(mxConstants.STYLE_IMAGE,0<a.length?a:null,f);var k=d.view.getState(f[0]),t=null!=k?k.style:d.getCellStyle(f[0]);"image"!=t[mxConstants.STYLE_SHAPE]&&"label"!=t[mxConstants.STYLE_SHAPE]?d.setCellStyles(mxConstants.STYLE_SHAPE,"image",f):0==a.length&&d.setCellStyles(mxConstants.STYLE_SHAPE,null,f);if(1==d.getSelectionCount()&&null!=b&&null!=e){var m=f[0],x=d.getModel().getGeometry(m);null!=x&&(x=x.clone(),x.width=b,x.height=e,
|
|
|
|
|
d.getModel().setGeometry(m,x))}}finally{d.getModel().endUpdate()}null!=g&&(d.setSelectionCells(g),d.scrollCellToVisible(g[0]))}}},d.cellEditor.isContentEditing(),!d.cellEditor.isContentEditing())}}).isEnabled=k;m=this.addAction("layers",mxUtils.bind(this,function(){null==this.layersWindow?(this.layersWindow=new LayersWindow(b,document.body.offsetWidth-280,120,220,180),this.layersWindow.window.addListener("show",function(){b.fireEvent(new mxEventObject("layers"))}),this.layersWindow.window.addListener("hide",
|
|
|
|
|
function(){b.fireEvent(new mxEventObject("layers"))}),this.layersWindow.window.setVisible(!0),b.fireEvent(new mxEventObject("layers"))):this.layersWindow.window.setVisible(!this.layersWindow.window.isVisible())}),null,null,Editor.ctrlKey+"+Shift+L");m.setToggleAction(!0);m.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.layersWindow&&this.layersWindow.window.isVisible()}));m=this.addAction("formatPanel",mxUtils.bind(this,function(){b.toggleFormatPanel()}),null,null,Editor.ctrlKey+
|
|
|
|
|
"+Shift+P");m.setToggleAction(!0);m.setSelectedCallback(mxUtils.bind(this,function(){return 0<b.formatWidth}));m=this.addAction("outline",mxUtils.bind(this,function(){null==this.outlineWindow?(this.outlineWindow=new OutlineWindow(b,document.body.offsetWidth-260,100,180,180),this.outlineWindow.window.addListener("show",function(){b.fireEvent(new mxEventObject("outline"))}),this.outlineWindow.window.addListener("hide",function(){b.fireEvent(new mxEventObject("outline"))}),this.outlineWindow.window.setVisible(!0),
|
|
|
|
|
b.fireEvent(new mxEventObject("outline"))):this.outlineWindow.window.setVisible(!this.outlineWindow.window.isVisible())}),null,null,Editor.ctrlKey+"+Shift+O");m.setToggleAction(!0);m.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.outlineWindow&&this.outlineWindow.window.isVisible()}))};
|
|
|
|
@ -2727,7 +2728,7 @@ DrawioFile.prototype.updateFile=function(a,b,e,d){null!=e&&e()||(this.ui.getCurr
|
|
|
|
|
DrawioFile.prototype.mergeFile=function(a,b,e,d){var k=!0;try{this.stats.fileMerged++;var m=null!=this.shadowPages?this.shadowPages:this.ui.getPagesForNode(mxUtils.parseXml(this.shadowData).documentElement),p=this.ui.getPagesForNode(mxUtils.parseXml(a.data).documentElement);if(null!=p&&0<p.length){this.shadowPages=p;this.backupPatch=this.isModified()?this.ui.diffPages(m,this.ui.pages):null;var v=[this.ui.diffPages(null!=d?d:m,this.shadowPages)];if(!this.ignorePatches(v)){var z=this.ui.patchPages(m,
|
|
|
|
|
v[0]);d={};var B=this.ui.getHashValueForPages(z,d),m={},c=this.ui.getHashValueForPages(this.shadowPages,m);"1"==urlParams.test&&EditorUi.debug("File.mergeFile",[this],"backup",this.backupPatch,"patches",v,"checksum",c==B,B);if(null!=B&&B!=c){var f=this.compressReportData(this.getAnonymizedXmlForPages(p)),g=this.compressReportData(this.getAnonymizedXmlForPages(z)),q=this.ui.hashValue(a.getCurrentEtag()),n=this.ui.hashValue(this.getCurrentEtag());this.checksumError(e,v,"Shadow Details: "+JSON.stringify(d)+
|
|
|
|
|
"\nChecksum: "+B+"\nCurrent: "+c+"\nCurrent Details: "+JSON.stringify(m)+"\nFrom: "+q+"\nTo: "+n+"\n\nFile Data:\n"+f+"\nPatched Shadow:\n"+g,null,"mergeFile");return}this.patch(v,DrawioFile.LAST_WRITE_WINS?this.backupPatch:null)}}else throw k=!1,Error(mxResources.get("notADiagramFile"));this.inConflictState=this.invalidChecksum=!1;this.setDescriptor(a.getDescriptor());this.descriptorChanged();this.backupPatch=null;null!=b&&b()}catch(C){this.invalidChecksum=this.inConflictState=!0;this.descriptorChanged();
|
|
|
|
|
null!=e&&e(C);try{if(k)if(this.errorReportsEnabled)this.sendErrorReport("Error in mergeFile",null,C);else{var l=this.getCurrentUser(),x=null!=l?l.id:"unknown";EditorUi.logError("Error in mergeFile",null,this.getMode()+"."+this.getId(),x,C)}}catch(t){}}};
|
|
|
|
|
null!=e&&e(C);try{if(k)if(this.errorReportsEnabled)this.sendErrorReport("Error in mergeFile",null,C);else{var l=this.getCurrentUser(),y=null!=l?l.id:"unknown";EditorUi.logError("Error in mergeFile",null,this.getMode()+"."+this.getId(),y,C)}}catch(t){}}};
|
|
|
|
|
DrawioFile.prototype.getAnonymizedXmlForPages=function(a){var b=new mxCodec(mxUtils.createXmlDocument()),e=b.document.createElement("mxfile");if(null!=a)for(var d=0;d<a.length;d++){var k=b.encode(new mxGraphModel(a[d].root));"1"!=urlParams.dev&&(k=this.ui.anonymizeNode(k,!0));k.setAttribute("id",a[d].getId());a[d].viewState&&this.ui.editor.graph.saveViewState(a[d].viewState,k,!0);e.appendChild(k)}return mxUtils.getPrettyXml(e)};
|
|
|
|
|
DrawioFile.prototype.compressReportData=function(a,b,e){b=null!=b?b:1E4;null!=e&&null!=a&&a.length>e?a=a.substring(0,e)+"[...]":null!=a&&a.length>b&&(a=Graph.compress(a)+"\n");return a};
|
|
|
|
|
DrawioFile.prototype.checksumError=function(a,b,e,d,k){this.stats.checksumErrors++;this.invalidChecksum=this.inConflictState=!0;this.descriptorChanged();null!=this.sync&&this.sync.updateOnlineState();null!=a&&a();try{if(this.errorReportsEnabled){if(null!=b)for(a=0;a<b.length;a++)this.ui.anonymizePatch(b[a]);var m=mxUtils.bind(this,function(a){var d=this.compressReportData(JSON.stringify(b,null,2));a=null!=a?this.compressReportData(this.getAnonymizedXmlForPages(this.ui.getPagesForNode(mxUtils.parseXml(a.data).documentElement)),
|
|
|
|
@ -2798,7 +2799,7 @@ IMAGE_PATH+"/img-hi-res.png";Editor.loResImage=mxClient.IS_SVG?"data:image/png;b
|
|
|
|
|
IMAGE_PATH+"/img-lo-res.png";Editor.cameraLargeImage="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAVlpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IlhNUCBDb3JlIDUuNC4wIj4KICAgPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4KICAgICAgPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIKICAgICAgICAgICAgeG1sbnM6dGlmZj0iaHR0cDovL25zLmFkb2JlLmNvbS90aWZmLzEuMC8iPgogICAgICAgICA8dGlmZjpPcmllbnRhdGlvbj4xPC90aWZmOk9yaWVudGF0aW9uPgogICAgICA8L3JkZjpEZXNjcmlwdGlvbj4KICAgPC9yZGY6UkRGPgo8L3g6eG1wbWV0YT4KTMInWQAAA/BJREFUWAnFl0uIjWEYx885buPSuGwmSYwtwsY1ikKSNYNclmQnadgrZSPlsnBLSlaGBdNYKY0Vdi4L4zYzIqxGxmXG//d+7//0+uY7nWMiT/2/53mf+3v7vnNKpf9M5UbrDw8Pj4m+wzmeT1FBUS6Xf+YNox6reMONukijMXUTM3NmI75PyXcJPwRWg5kS7xysDLNmfEUxpx2rceNE50IlYjyRklcLf0prY+x4BTqfmx3ZUHQaO9ISGngYq38V/1EH+ECPa+QaK1u1kVBQirDMChiS3CTeIkwWvghtwhKBpZ8g1CO2B99FynVU/KowSRgQ3mlrBsVZ1awmQlS0SGbfXglfBPbdRGMm5O8RXg2P835pDCvzWjghTHETcLpZLHwS8kTCtBEK1SN83Egam8YxyVZqc+Do5qkwS+gT9grNwkUBG6cbsG/gs3BTuC/0ChCxq4QtwgzBMdwUZBPyN4Ftfi4sYPZHktbOSRlIuutRP5jYj0ueZp88xyYcS/zZoiLyQT1IA/cTj7eSlwnrhI+JnkQbCwo2Sx/2M7VJt17wdhVtgxvrpoFnAuSAbJQ97biZAlKxBfD9wgOhV+BgIR/AZtJ4kwD5PGSj7OmmekjWEy0oAQHAS3+KpBpzXqYK3UItopHpSRMno2N+cm7gDYnfRCcr3QBqriMHLJDkeyhFfiG5aVbK+8rhtP9M6QcIEJHX5Fp9NMAyQlYiu+OOJNlODCIXyka/P23bncTdiC7OydC1+v1Bsb+5r84DK8S3Rdmf5cRUFW3bXtWUSt1Rdk6G4SyJV2o1YId+vNUxr+x5yCJiapFtcxQzLjrxboGcMxvFJwEOKnLwjIbkx/sdSmeSaUY++SwTAxV+4DJT7RVwkbk46gNCsifIItuy0e9PF33Cb4homhN5YRyzL5q5V2VNkv98kqgoGTo3YF9CnMM5Y5rItFfvBSi9JulVXOgI+VwIntkt+SaZ6weQfcovJf7zpTfl86P/wAF7Fz18NeKwmvAWCaX0Z/uMHQr42ZxvR/Rxcw5xM+9J/CJq8w2gduDhmDgso/QrBH47dEXQ1IqczyHpIOfIRtnTtV7SwO1oKXKkU3fbToFGSDHtMWcaH1WBuVYnDbRFi99iqSMySdzxXckrazUh23KBVYGIcfNBkTxca0e4ATJ0KukGYVBgr/MnlhPOtQq/ksUfCbzh+EFCjtnCUoHfjhA/OsiTv2HcEvJMELp0VakZDliTmriTdPivxU4VmEhtPrGV+KJhO7ZKt0doFZh1fgZSBWIW2AGEHwg3BUWOnKtH+suqdw07tYMfglCrWPD5mw9qVYuniaXkT0OtWaSuo5LJTY1RBf+roF9X5+y/5qU+DAAAAABJRU5ErkJggg==";
|
|
|
|
|
Editor.defaultCustomLibraries=[];Editor.enableCustomLibraries=!0;Editor.enableCustomProperties=!0;Editor.compressXml=!0;Editor.globalVars=null;Editor.shadowOptionEnabled=!0;Editor.config=null;Editor.configVersion=null;Editor.commonEdgeProperties=[{type:"separator"},{name:"arcSize",dispName:"Arc Size",type:"float",min:0,defVal:mxConstants.LINE_ARCSIZE},{name:"sourcePortConstraint",dispName:"Source Constraint",type:"enum",defVal:"none",enumList:[{val:"none",dispName:"None"},{val:"north",dispName:"North"},
|
|
|
|
|
{val:"east",dispName:"East"},{val:"south",dispName:"South"},{val:"west",dispName:"West"}]},{name:"targetPortConstraint",dispName:"Target Constraint",type:"enum",defVal:"none",enumList:[{val:"none",dispName:"None"},{val:"north",dispName:"North"},{val:"east",dispName:"East"},{val:"south",dispName:"South"},{val:"west",dispName:"West"}]},{name:"jettySize",dispName:"Jetty Size",type:"int",min:0,defVal:"auto",allowAuto:!0,isVisible:function(a){return"orthogonalEdgeStyle"==mxUtils.getValue(a.style,mxConstants.STYLE_EDGE,
|
|
|
|
|
null)}},{name:"fillOpacity",dispName:"Fill Opacity",type:"int",min:0,max:100,defVal:100},{name:"strokeOpacity",dispName:"Stroke Opacity",type:"int",min:0,max:100,defVal:100},{name:"startFill",dispName:"Start Fill",type:"bool",defVal:!0},{name:"endFill",dispName:"End Fill",type:"bool",defVal:!0},{name:"perimeterSpacing",dispName:"Terminal Spacing",type:"float",defVal:0},{name:"anchorPointDirection",dispName:"Anchor Direction",type:"bool",defVal:!0},{name:"snapToPoint",dispName:"Snap to Anchor",type:"bool",
|
|
|
|
|
null)}},{name:"fillOpacity",dispName:"Fill Opacity",type:"int",min:0,max:100,defVal:100},{name:"strokeOpacity",dispName:"Stroke Opacity",type:"int",min:0,max:100,defVal:100},{name:"startFill",dispName:"Start Fill",type:"bool",defVal:!0},{name:"endFill",dispName:"End Fill",type:"bool",defVal:!0},{name:"perimeterSpacing",dispName:"Terminal Spacing",type:"float",defVal:0},{name:"anchorPointDirection",dispName:"Anchor Direction",type:"bool",defVal:!0},{name:"snapToPoint",dispName:"Snap to Point",type:"bool",
|
|
|
|
|
defVal:!1},{name:"fixDash",dispName:"Fixed Dash",type:"bool",defVal:!1},{name:"jiggle",dispName:"Jiggle",type:"float",min:0,defVal:1.5,isVisible:function(a){return"1"==mxUtils.getValue(a.style,"comic","0")}},{name:"editable",dispName:"Editable",type:"bool",defVal:!0},{name:"backgroundOutline",dispName:"Background Outline",type:"bool",defVal:!1},{name:"bendable",dispName:"Bendable",type:"bool",defVal:!0},{name:"movable",dispName:"Movable",type:"bool",defVal:!0},{name:"cloneable",dispName:"Cloneable",
|
|
|
|
|
type:"bool",defVal:!0},{name:"deletable",dispName:"Deletable",type:"bool",defVal:!0},{name:"orthogonalLoop",dispName:"Loop Routing",type:"bool",defVal:!1},{name:"noJump",dispName:"No Jumps",type:"bool",defVal:!1}];Editor.commonVertexProperties=[{type:"separator"},{name:"fillOpacity",dispName:"Fill Opacity",type:"int",min:0,max:100,defVal:100},{name:"strokeOpacity",dispName:"Stroke Opacity",type:"int",min:0,max:100,defVal:100},{name:"overflow",dispName:"Text Overflow",defVal:"visible",type:"enum",
|
|
|
|
|
enumList:[{val:"visible",dispName:"Visible"},{val:"hidden",dispName:"Hidden"},{val:"fill",dispName:"Fill"},{val:"width",dispName:"Width"}]},{name:"noLabel",dispName:"Hide Label",type:"bool",defVal:!1},{name:"labelPadding",dispName:"Label Padding",type:"float",defVal:0},{name:"direction",dispName:"Direction",type:"enum",defVal:"east",enumList:[{val:"north",dispName:"North"},{val:"east",dispName:"East"},{val:"south",dispName:"South"},{val:"west",dispName:"West"}]},{name:"portConstraint",dispName:"Constraint",
|
|
|
|
@ -2841,9 +2842,9 @@ b&&b({code:App.ERROR_UNKNOWN},a)}),function(){null!=b&&b({code:App.ERROR_UNKNOWN
|
|
|
|
|
b[g].indexOf(")");e.push('url("');e.push(d[c(b[g].substring(0,l))]);e.push('"'+b[g].substring(l))}this.resolvedFontCss=e.join("");a()}});if(0<b.length)for(var g=1;g<b.length;g++){var l=b[g].indexOf(")"),n=null,u=b[g].indexOf("format(",l);0<u&&(n=c(b[g].substring(u+7,b[g].indexOf(")",u))));mxUtils.bind(this,function(a){if(null==d[a]){d[a]=a;f++;var c="application/x-font-ttf";if("svg"==n||/(\.svg)($|\?)/i.test(a))c="image/svg+xml";else if("otf"==n||"embedded-opentype"==n||/(\.otf)($|\?)/i.test(a))c=
|
|
|
|
|
"application/x-font-opentype";else if("woff"==n||/(\.woff)($|\?)/i.test(a))c="application/font-woff";else if("woff2"==n||/(\.woff2)($|\?)/i.test(a))c="application/font-woff2";else if("eot"==n||/(\.eot)($|\?)/i.test(a))c="application/vnd.ms-fontobject";else if("sfnt"==n||/(\.sfnt)($|\?)/i.test(a))c="application/font-sfnt";var b=a;/^https?:\/\//.test(b)&&!this.isCorsEnabledForUrl(b)&&(b=PROXY_URL+"?url="+encodeURIComponent(a));this.loadUrl(b,mxUtils.bind(this,function(c){d[a]=c;f--;e()}),mxUtils.bind(this,
|
|
|
|
|
function(a){f--;e()}),!0,null,"data:"+c+";charset=utf-8;base64,")}})(c(b[g].substring(0,l)),n)}}else a()};Editor.prototype.convertMath=function(a,c,b,f){a.mathEnabled&&"undefined"!==typeof MathJax&&"undefined"!==typeof MathJax.Hub?(Editor.MathJaxRender(c),window.setTimeout(mxUtils.bind(this,function(){MathJax.Hub.Queue(mxUtils.bind(this,function(){f()}))}),0)):f()};Editor.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||!this.graph.mathEnabled&&this.useCanvasForExport};Editor.prototype.exportToCanvas=
|
|
|
|
|
function(a,c,b,f,d,e,g,l,n,q,t,x,y,k){e=null!=e?e:!0;x=null!=x?x:this.graph;y=null!=y?y:0;var u=n?null:x.background;u==mxConstants.NONE&&(u=null);null==u&&(u=f);null==u&&0==n&&(u=this.graph.defaultPageBackgroundColor);this.convertImages(x.getSvg(u,null,null,k,null,null!=g?g:!0,null,null,null,q),mxUtils.bind(this,function(b){var f=new Image;f.onload=mxUtils.bind(this,function(){try{var g=document.createElement("canvas"),n=parseInt(b.getAttribute("width")),q=parseInt(b.getAttribute("height"));l=null!=
|
|
|
|
|
l?l:1;null!=c&&(l=e?Math.min(1,Math.min(3*c/(4*q),c/n)):c/n);n=Math.ceil(l*n)+2*y;q=Math.ceil(l*q)+2*y;g.setAttribute("width",n);g.setAttribute("height",q);var t=g.getContext("2d");null!=u&&(t.beginPath(),t.rect(0,0,n,q),t.fillStyle=u,t.fill());t.scale(l,l);mxClient.IS_SF?window.setTimeout(function(){t.drawImage(f,y/l,y/l);a(g)},0):(t.drawImage(f,y/l,y/l),a(g))}catch(R){null!=d&&d(R)}});f.onerror=function(a){null!=d&&d(a)};try{q&&this.graph.addSvgShadow(b);var g=mxUtils.bind(this,function(){if(null!=
|
|
|
|
|
this.resolvedFontCss){var a=document.createElement("style");a.setAttribute("type","text/css");a.innerHTML=this.resolvedFontCss;b.getElementsByTagName("defs")[0].appendChild(a)}this.convertMath(x,b,!0,mxUtils.bind(this,function(){f.src=this.createSvgDataUri(mxUtils.getXml(b))}))});this.loadFonts(g)}catch(S){null!=d&&d(S)}}),b,t)};Editor.prototype.writeGraphModelToPng=function(a,c,b,f,d){function e(a,c){var b=n;n+=c;return a.substring(b,n)}function g(a){a=e(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<
|
|
|
|
|
function(a,c,b,f,d,e,g,l,n,q,t,y,x,k){e=null!=e?e:!0;y=null!=y?y:this.graph;x=null!=x?x:0;var u=n?null:y.background;u==mxConstants.NONE&&(u=null);null==u&&(u=f);null==u&&0==n&&(u=this.graph.defaultPageBackgroundColor);this.convertImages(y.getSvg(u,null,null,k,null,null!=g?g:!0,null,null,null,q),mxUtils.bind(this,function(b){var f=new Image;f.onload=mxUtils.bind(this,function(){try{var g=document.createElement("canvas"),n=parseInt(b.getAttribute("width")),q=parseInt(b.getAttribute("height"));l=null!=
|
|
|
|
|
l?l:1;null!=c&&(l=e?Math.min(1,Math.min(3*c/(4*q),c/n)):c/n);n=Math.ceil(l*n)+2*x;q=Math.ceil(l*q)+2*x;g.setAttribute("width",n);g.setAttribute("height",q);var t=g.getContext("2d");null!=u&&(t.beginPath(),t.rect(0,0,n,q),t.fillStyle=u,t.fill());t.scale(l,l);mxClient.IS_SF?window.setTimeout(function(){t.drawImage(f,x/l,x/l);a(g)},0):(t.drawImage(f,x/l,x/l),a(g))}catch(R){null!=d&&d(R)}});f.onerror=function(a){null!=d&&d(a)};try{q&&this.graph.addSvgShadow(b);var g=mxUtils.bind(this,function(){if(null!=
|
|
|
|
|
this.resolvedFontCss){var a=document.createElement("style");a.setAttribute("type","text/css");a.innerHTML=this.resolvedFontCss;b.getElementsByTagName("defs")[0].appendChild(a)}this.convertMath(y,b,!0,mxUtils.bind(this,function(){f.src=this.createSvgDataUri(mxUtils.getXml(b))}))});this.loadFonts(g)}catch(S){null!=d&&d(S)}}),b,t)};Editor.prototype.writeGraphModelToPng=function(a,c,b,f,d){function e(a,c){var b=n;n+=c;return a.substring(b,n)}function g(a){a=e(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<
|
|
|
|
|
8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function l(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+1);a=window.atob?atob(a):Base64.decode(a,!0);var n=0;if(e(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=d&&d();else if(e(a,4),"IHDR"!=e(a,4))null!=d&&d();else{e(a,17);d=a.substring(0,n);do{var u=g(a);if("IDAT"==e(a,4)){d=a.substring(0,n-8);b=b+String.fromCharCode(0)+("zTXt"==c?String.fromCharCode(0):"")+f;f=4294967295;
|
|
|
|
|
f=EditorUi.prototype.updateCRC(f,c,0,4);f=EditorUi.prototype.updateCRC(f,b,0,b.length);d+=l(b.length)+c+b+l(f^4294967295);d+=a.substring(n-8,a.length);break}d+=a.substring(n-8,n-4+u);e(a,u);e(a,4)}while(u);return"data:image/png;base64,"+(window.btoa?btoa(d):Base64.encode(d,!0))}};if(window.ColorDialog){FilenameDialog.filenameHelpLink="https://desk.draw.io/support/solutions/articles/16000091426";var k=ColorDialog.addRecentColor;ColorDialog.addRecentColor=function(a,c){k.apply(this,arguments);mxSettings.setRecentColors(ColorDialog.recentColors);
|
|
|
|
|
mxSettings.save()};var m=ColorDialog.resetRecentColors;ColorDialog.resetRecentColors=function(){m.apply(this,arguments);mxSettings.setRecentColors(ColorDialog.recentColors);mxSettings.save()}}window.EditDataDialog&&(EditDataDialog.getDisplayIdForCell=function(a,c){var b=null;null!=a.editor.graph.getModel().getParent(c)?b=c.getId():null!=a.currentPage&&(b=a.currentPage.getId());return b});if(null!=window.StyleFormatPanel){var p=Format.prototype.init;Format.prototype.init=function(){p.apply(this,arguments);
|
|
|
|
@ -2878,19 +2879,19 @@ this.format.createSelectionState();"image"==a.style.shape||a.containsLabel||this
|
|
|
|
|
b,a))}};var f=StyleFormatPanel.prototype.addStyleOps;StyleFormatPanel.prototype.addStyleOps=function(a){var c=mxUtils.button(mxResources.get("copyStyle"),mxUtils.bind(this,function(a){this.editorUi.actions.get("copyStyle").funct()}));c.setAttribute("title",mxResources.get("copyStyle")+" ("+this.editorUi.actions.get("copyStyle").shortcut+")");c.style.marginBottom="2px";c.style.width="100px";c.style.marginRight="2px";a.appendChild(c);c=mxUtils.button(mxResources.get("pasteStyle"),mxUtils.bind(this,
|
|
|
|
|
function(a){this.editorUi.actions.get("pasteStyle").funct()}));c.setAttribute("title",mxResources.get("pasteStyle")+" ("+this.editorUi.actions.get("pasteStyle").shortcut+")");c.style.marginBottom="2px";c.style.width="100px";a.appendChild(c);mxUtils.br(a);return f.apply(this,arguments)};EditorUi.prototype.propertiesCollapsed=!0;StyleFormatPanel.prototype.addProperties=function(a,c,b){function f(a,c,b,f){t.getModel().beginUpdate();try{var d=[],e=[];if(null!=b.index){for(var g=[],l=b.parentRow.nextSibling;l&&
|
|
|
|
|
l.getAttribute("data-pName")==a;)g.push(l.getAttribute("data-pValue")),l=l.nextSibling;b.index<g.length?null!=f?g.splice(f,1):g[b.index]=c:g.push(c);null!=b.size&&g.length>b.size&&(g=g.slice(0,b.size));c=g.join(",");null!=b.countProperty&&(t.setCellStyles(b.countProperty,g.length,t.getSelectionCells()),d.push(b.countProperty),e.push(g.length))}t.setCellStyles(a,c,t.getSelectionCells());d.push(a);e.push(c);if(null!=b.dependentProps)for(a=0;a<b.dependentProps.length;a++){var n=b.dependentPropsDefVal[a],
|
|
|
|
|
q=b.dependentPropsVals[a];if(q.length>c)q=q.slice(0,c);else for(var x=q.length;x<c;x++)q.push(n);q=q.join(",");t.setCellStyles(b.dependentProps[a],q,t.getSelectionCells());d.push(b.dependentProps[a]);e.push(q)}if("function"==typeof b.onChange)b.onChange(t,c);u.editorUi.fireEvent(new mxEventObject("styleChanged","keys",d,"values",e,"cells",t.getSelectionCells()))}finally{t.getModel().endUpdate()}}function d(c,b,f){var d=mxUtils.getOffset(a,!0),e=mxUtils.getOffset(c,!0);b.style.position="absolute";
|
|
|
|
|
q=b.dependentPropsVals[a];if(q.length>c)q=q.slice(0,c);else for(var y=q.length;y<c;y++)q.push(n);q=q.join(",");t.setCellStyles(b.dependentProps[a],q,t.getSelectionCells());d.push(b.dependentProps[a]);e.push(q)}if("function"==typeof b.onChange)b.onChange(t,c);u.editorUi.fireEvent(new mxEventObject("styleChanged","keys",d,"values",e,"cells",t.getSelectionCells()))}finally{t.getModel().endUpdate()}}function d(c,b,f){var d=mxUtils.getOffset(a,!0),e=mxUtils.getOffset(c,!0);b.style.position="absolute";
|
|
|
|
|
b.style.left=e.x-d.x+"px";b.style.top=e.y-d.y+"px";b.style.width=c.offsetWidth+"px";b.style.height=c.offsetHeight-(f?4:0)+"px";b.style.zIndex=5}function e(a,c,b){var d=document.createElement("div");d.style.width="32px";d.style.height="4px";d.style.margin="2px";d.style.border="1px solid black";d.style.background=c&&"none"!=c?c:"url('"+Dialog.prototype.noColorImage+"')";btn=mxUtils.button("",mxUtils.bind(u,function(e){this.editorUi.pickColor(c,function(c){d.style.background="none"==c?"url('"+Dialog.prototype.noColorImage+
|
|
|
|
|
"')":c;f(a,c,b)});mxEvent.consume(e)}));btn.style.height="12px";btn.style.width="40px";btn.className="geColorBtn";btn.appendChild(d);return btn}function g(a,c,b,d,e,g,l){null!=c&&(c=c.split(","),x.push({name:a,values:c,type:b,defVal:d,countProperty:e,parentRow:g,isDeletable:!0,flipBkg:l}));btn=mxUtils.button("+",mxUtils.bind(u,function(c){for(var n=g,u=0;null!=n.nextSibling;)if(n.nextSibling.getAttribute("data-pName")==a)n=n.nextSibling,u++;else break;var t={type:b,parentRow:g,index:u,isDeletable:!0,
|
|
|
|
|
defVal:d,countProperty:e},u=q(a,"",t,0==u%2,l);f(a,d,t);n.parentNode.insertBefore(u,n.nextSibling);mxEvent.consume(c)}));btn.style.height="16px";btn.style.width="25px";btn.className="geColorBtn";return btn}function l(a,c,b,f,d,e,g){if(0<d){var l=Array(d);c=null!=c?c.split(","):[];for(var n=0;n<d;n++)l[n]=null!=c[n]?c[n]:null!=f?f:"";x.push({name:a,values:l,type:b,defVal:f,parentRow:e,flipBkg:g,size:d})}return document.createElement("div")}function n(a,c,b){var d=document.createElement("input");d.type=
|
|
|
|
|
"checkbox";d.checked="1"==c;mxEvent.addListener(d,"change",function(){f(a,d.checked?"1":"0",b)});return d}function q(c,b,q,t,x){var k=q.dispName,y=q.type,C=document.createElement("tr");C.className="gePropRow"+(x?"Dark":"")+(t?"Alt":"")+" gePropNonHeaderRow";C.setAttribute("data-pName",c);C.setAttribute("data-pValue",b);t=!1;null!=q.index&&(C.setAttribute("data-index",q.index),k=(null!=k?k:"")+"["+q.index+"]",t=!0);var A=document.createElement("td");A.className="gePropRowCell";A.innerHTML=mxUtils.htmlEntities(mxResources.get(k,
|
|
|
|
|
null,k));t&&(A.style.textAlign="right");C.appendChild(A);A=document.createElement("td");A.className="gePropRowCell";if("color"==y)A.appendChild(e(c,b,q));else if("bool"==y||"boolean"==y)A.appendChild(n(c,b,q));else if("enum"==y){var D=q.enumList;for(x=0;x<D.length;x++)if(k=D[x],k.val==b){A.innerHTML=mxUtils.htmlEntities(mxResources.get(k.dispName,null,k.dispName));break}mxEvent.addListener(A,"click",mxUtils.bind(u,function(){var e=document.createElement("select");d(A,e);for(var g=0;g<D.length;g++){var l=
|
|
|
|
|
D[g],n=document.createElement("option");n.value=mxUtils.htmlEntities(l.val);n.innerHTML=mxUtils.htmlEntities(mxResources.get(l.dispName,null,l.dispName));e.appendChild(n)}e.value=b;a.appendChild(e);mxEvent.addListener(e,"change",function(){var a=mxUtils.htmlEntities(e.value);f(c,a,q)});e.focus();mxEvent.addListener(e,"blur",function(){a.removeChild(e)})}))}else"dynamicArr"==y?A.appendChild(g(c,b,q.subType,q.subDefVal,q.countProperty,C,x)):"staticArr"==y?A.appendChild(l(c,b,q.subType,q.subDefVal,q.size,
|
|
|
|
|
C,x)):(A.innerHTML=b,mxEvent.addListener(A,"click",mxUtils.bind(u,function(){function e(){var a=g.value,a=0==a.length&&"string"!=y?0:a;q.allowAuto&&("auto"==a.trim().toLowerCase()?(a="auto",y="string"):(a=parseFloat(a),a=isNaN(a)?0:a));null!=q.min&&a<q.min?a=q.min:null!=q.max&&a>q.max&&(a=q.max);a=mxUtils.htmlEntities(("int"==y?parseInt(a):a)+"");f(c,a,q)}var g=document.createElement("input");d(A,g,!0);g.value=b;g.className="gePropEditor";"int"!=y&&"float"!=y||q.allowAuto||(g.type="number",g.step=
|
|
|
|
|
"int"==y?"1":"any",null!=q.min&&(g.min=parseFloat(q.min)),null!=q.max&&(g.max=parseFloat(q.max)));a.appendChild(g);mxEvent.addListener(g,"keypress",function(a){13==a.keyCode&&e()});g.focus();mxEvent.addListener(g,"blur",function(){e()})})));q.isDeletable&&(x=mxUtils.button("-",mxUtils.bind(u,function(a){f(c,"",q,q.index);mxEvent.consume(a)})),x.style.height="16px",x.style.width="25px",x.style["float"]="right",x.className="geColorBtn",A.appendChild(x));C.appendChild(A);return C}var u=this,t=this.editorUi.editor.graph,
|
|
|
|
|
x=[];a.style.position="relative";a.style.padding="0";var y=document.createElement("table");y.style.whiteSpace="nowrap";y.style.width="100%";var k=document.createElement("tr");k.className="gePropHeader";var C=document.createElement("th");C.className="gePropHeaderCell";var A=document.createElement("img");A.src=Sidebar.prototype.expandedImage;C.appendChild(A);mxUtils.write(C,mxResources.get("property"));k.style.cursor="pointer";var m=function(){var c=y.querySelectorAll(".gePropNonHeaderRow"),b;if(u.editorUi.propertiesCollapsed){A.src=
|
|
|
|
|
"')":c;f(a,c,b)});mxEvent.consume(e)}));btn.style.height="12px";btn.style.width="40px";btn.className="geColorBtn";btn.appendChild(d);return btn}function g(a,c,b,d,e,g,l){null!=c&&(c=c.split(","),y.push({name:a,values:c,type:b,defVal:d,countProperty:e,parentRow:g,isDeletable:!0,flipBkg:l}));btn=mxUtils.button("+",mxUtils.bind(u,function(c){for(var n=g,u=0;null!=n.nextSibling;)if(n.nextSibling.getAttribute("data-pName")==a)n=n.nextSibling,u++;else break;var t={type:b,parentRow:g,index:u,isDeletable:!0,
|
|
|
|
|
defVal:d,countProperty:e},u=q(a,"",t,0==u%2,l);f(a,d,t);n.parentNode.insertBefore(u,n.nextSibling);mxEvent.consume(c)}));btn.style.height="16px";btn.style.width="25px";btn.className="geColorBtn";return btn}function l(a,c,b,f,d,e,g){if(0<d){var l=Array(d);c=null!=c?c.split(","):[];for(var n=0;n<d;n++)l[n]=null!=c[n]?c[n]:null!=f?f:"";y.push({name:a,values:l,type:b,defVal:f,parentRow:e,flipBkg:g,size:d})}return document.createElement("div")}function n(a,c,b){var d=document.createElement("input");d.type=
|
|
|
|
|
"checkbox";d.checked="1"==c;mxEvent.addListener(d,"change",function(){f(a,d.checked?"1":"0",b)});return d}function q(c,b,q,t,y){var k=q.dispName,x=q.type,C=document.createElement("tr");C.className="gePropRow"+(y?"Dark":"")+(t?"Alt":"")+" gePropNonHeaderRow";C.setAttribute("data-pName",c);C.setAttribute("data-pValue",b);t=!1;null!=q.index&&(C.setAttribute("data-index",q.index),k=(null!=k?k:"")+"["+q.index+"]",t=!0);var A=document.createElement("td");A.className="gePropRowCell";A.innerHTML=mxUtils.htmlEntities(mxResources.get(k,
|
|
|
|
|
null,k));t&&(A.style.textAlign="right");C.appendChild(A);A=document.createElement("td");A.className="gePropRowCell";if("color"==x)A.appendChild(e(c,b,q));else if("bool"==x||"boolean"==x)A.appendChild(n(c,b,q));else if("enum"==x){var D=q.enumList;for(y=0;y<D.length;y++)if(k=D[y],k.val==b){A.innerHTML=mxUtils.htmlEntities(mxResources.get(k.dispName,null,k.dispName));break}mxEvent.addListener(A,"click",mxUtils.bind(u,function(){var e=document.createElement("select");d(A,e);for(var g=0;g<D.length;g++){var l=
|
|
|
|
|
D[g],n=document.createElement("option");n.value=mxUtils.htmlEntities(l.val);n.innerHTML=mxUtils.htmlEntities(mxResources.get(l.dispName,null,l.dispName));e.appendChild(n)}e.value=b;a.appendChild(e);mxEvent.addListener(e,"change",function(){var a=mxUtils.htmlEntities(e.value);f(c,a,q)});e.focus();mxEvent.addListener(e,"blur",function(){a.removeChild(e)})}))}else"dynamicArr"==x?A.appendChild(g(c,b,q.subType,q.subDefVal,q.countProperty,C,y)):"staticArr"==x?A.appendChild(l(c,b,q.subType,q.subDefVal,q.size,
|
|
|
|
|
C,y)):(A.innerHTML=b,mxEvent.addListener(A,"click",mxUtils.bind(u,function(){function e(){var a=g.value,a=0==a.length&&"string"!=x?0:a;q.allowAuto&&("auto"==a.trim().toLowerCase()?(a="auto",x="string"):(a=parseFloat(a),a=isNaN(a)?0:a));null!=q.min&&a<q.min?a=q.min:null!=q.max&&a>q.max&&(a=q.max);a=mxUtils.htmlEntities(("int"==x?parseInt(a):a)+"");f(c,a,q)}var g=document.createElement("input");d(A,g,!0);g.value=b;g.className="gePropEditor";"int"!=x&&"float"!=x||q.allowAuto||(g.type="number",g.step=
|
|
|
|
|
"int"==x?"1":"any",null!=q.min&&(g.min=parseFloat(q.min)),null!=q.max&&(g.max=parseFloat(q.max)));a.appendChild(g);mxEvent.addListener(g,"keypress",function(a){13==a.keyCode&&e()});g.focus();mxEvent.addListener(g,"blur",function(){e()})})));q.isDeletable&&(y=mxUtils.button("-",mxUtils.bind(u,function(a){f(c,"",q,q.index);mxEvent.consume(a)})),y.style.height="16px",y.style.width="25px",y.style["float"]="right",y.className="geColorBtn",A.appendChild(y));C.appendChild(A);return C}var u=this,t=this.editorUi.editor.graph,
|
|
|
|
|
y=[];a.style.position="relative";a.style.padding="0";var x=document.createElement("table");x.style.whiteSpace="nowrap";x.style.width="100%";var k=document.createElement("tr");k.className="gePropHeader";var C=document.createElement("th");C.className="gePropHeaderCell";var A=document.createElement("img");A.src=Sidebar.prototype.expandedImage;C.appendChild(A);mxUtils.write(C,mxResources.get("property"));k.style.cursor="pointer";var m=function(){var c=x.querySelectorAll(".gePropNonHeaderRow"),b;if(u.editorUi.propertiesCollapsed){A.src=
|
|
|
|
|
Sidebar.prototype.collapsedImage;b="none";for(var f=a.childNodes.length-1;0<=f;f--)try{var d=a.childNodes[f],e=d.nodeName.toUpperCase();"INPUT"!=e&&"SELECT"!=e||a.removeChild(d)}catch(J){}}else A.src=Sidebar.prototype.expandedImage,b="";for(f=0;f<c.length;f++)c[f].style.display=b};mxEvent.addListener(k,"click",function(){u.editorUi.propertiesCollapsed=!u.editorUi.propertiesCollapsed;m()});k.appendChild(C);C=document.createElement("th");C.className="gePropHeaderCell";C.innerHTML=mxResources.get("value");
|
|
|
|
|
k.appendChild(C);y.appendChild(k);var F=!1,p=!1,E;for(E in c)if(k=c[E],"function"!=typeof k.isVisible||k.isVisible(b,this)){var v=null!=b.style[E]?mxUtils.htmlEntities(b.style[E]+""):k.defVal;if("separator"==k.type)p=!p;else{if("staticArr"==k.type)k.size=parseInt(b.style[k.sizeProperty]||c[k.sizeProperty].defVal)||0;else if(null!=k.dependentProps){for(var N=k.dependentProps,z=[],B=[],C=0;C<N.length;C++){var I=b.style[N[C]];B.push(c[N[C]].subDefVal);z.push(null!=I?I.split(","):[])}k.dependentPropsDefVal=
|
|
|
|
|
B;k.dependentPropsVals=z}y.appendChild(q(E,v,k,F,p));F=!F}}for(C=0;C<x.length;C++)for(k=x[C],c=k.parentRow,b=0;b<k.values.length;b++)E=q(k.name,k.values[b],{type:k.type,parentRow:k.parentRow,isDeletable:k.isDeletable,index:b,defVal:k.defVal,countProperty:k.countProperty,size:k.size},0==b%2,k.flipBkg),c.parentNode.insertBefore(E,c.nextSibling),c=E;a.appendChild(y);m();return a};StyleFormatPanel.prototype.addStyles=function(a){function c(a){function c(a){var c=mxUtils.button("",function(c){f.getModel().beginUpdate();
|
|
|
|
|
k.appendChild(C);x.appendChild(k);var F=!1,p=!1,E;for(E in c)if(k=c[E],"function"!=typeof k.isVisible||k.isVisible(b,this)){var v=null!=b.style[E]?mxUtils.htmlEntities(b.style[E]+""):k.defVal;if("separator"==k.type)p=!p;else{if("staticArr"==k.type)k.size=parseInt(b.style[k.sizeProperty]||c[k.sizeProperty].defVal)||0;else if(null!=k.dependentProps){for(var N=k.dependentProps,z=[],B=[],C=0;C<N.length;C++){var I=b.style[N[C]];B.push(c[N[C]].subDefVal);z.push(null!=I?I.split(","):[])}k.dependentPropsDefVal=
|
|
|
|
|
B;k.dependentPropsVals=z}x.appendChild(q(E,v,k,F,p));F=!F}}for(C=0;C<y.length;C++)for(k=y[C],c=k.parentRow,b=0;b<k.values.length;b++)E=q(k.name,k.values[b],{type:k.type,parentRow:k.parentRow,isDeletable:k.isDeletable,index:b,defVal:k.defVal,countProperty:k.countProperty,size:k.size},0==b%2,k.flipBkg),c.parentNode.insertBefore(E,c.nextSibling),c=E;a.appendChild(x);m();return a};StyleFormatPanel.prototype.addStyles=function(a){function c(a){function c(a){var c=mxUtils.button("",function(c){f.getModel().beginUpdate();
|
|
|
|
|
try{var b=f.getSelectionCells();for(c=0;c<b.length;c++){for(var d=f.getModel().getStyle(b[c]),g=0;g<e.length;g++)d=mxUtils.removeStylename(d,e[g]);var l=f.getModel().isVertex(b[c])?f.defaultVertexStyle:f.defaultEdgeStyle;null!=a?(d=mxUtils.setStyle(d,mxConstants.STYLE_GRADIENTCOLOR,a.gradient||mxUtils.getValue(l,mxConstants.STYLE_GRADIENTCOLOR,null)),d=""==a.fill?mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,null):mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,a.fill||mxUtils.getValue(l,mxConstants.STYLE_FILLCOLOR,
|
|
|
|
|
null)),d=""==a.stroke?mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,null):mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,a.stroke||mxUtils.getValue(l,mxConstants.STYLE_STROKECOLOR,null)),f.getModel().isVertex(b[c])&&(d=mxUtils.setStyle(d,mxConstants.STYLE_FONTCOLOR,a.font||mxUtils.getValue(l,mxConstants.STYLE_FONTCOLOR,null)))):(d=mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,mxUtils.getValue(l,mxConstants.STYLE_FILLCOLOR,"#ffffff")),d=mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,mxUtils.getValue(l,
|
|
|
|
|
mxConstants.STYLE_STROKECOLOR,"#000000")),d=mxUtils.setStyle(d,mxConstants.STYLE_GRADIENTCOLOR,mxUtils.getValue(l,mxConstants.STYLE_GRADIENTCOLOR,null)),f.getModel().isVertex(b[c])&&(d=mxUtils.setStyle(d,mxConstants.STYLE_FONTCOLOR,mxUtils.getValue(l,mxConstants.STYLE_FONTCOLOR,null))));f.getModel().setStyle(b[c],d)}}finally{f.getModel().endUpdate()}});c.className="geStyleButton";c.style.width="36px";c.style.height="30px";c.style.margin="0px 6px 6px 0px";if(null!=a)null!=a.gradient?mxClient.IS_IE&&
|
|
|
|
@ -2910,7 +2911,7 @@ c.childLayout)return b=new mxTableLayout(this.graph),b.rows=c.tableRows||2,b.col
|
|
|
|
|
0,b.marginBottom=c.marginBottom||0,b.autoAddCol="1"==mxUtils.getValue(c,"autoAddCol","0"),b.autoAddRow="1"==mxUtils.getValue(c,"autoAddRow",b.autoAddCol?"0":"1"),b.colWidths=c.colWidths||"100",b.rowHeights=c.rowHeights||"50",b}return f.apply(this,arguments)};this.updateGlobalUrlVariables()};Graph.prototype.updateGlobalUrlVariables=function(){this.globalVars=Editor.globalVars;if(null!=urlParams.vars)try{this.globalVars=null!=this.globalVars?mxUtils.clone(this.globalVars):{};var a=JSON.parse(decodeURIComponent(urlParams.vars));
|
|
|
|
|
if(null!=a)for(var c in a)this.globalVars[c]=a[c]}catch(N){null!=window.console&&console.log("Error in vars URL parameter: "+N)}};Graph.prototype.getExportVariables=function(){return null!=this.globalVars?mxUtils.clone(this.globalVars):{}};var q=Graph.prototype.getGlobalVariable;Graph.prototype.getGlobalVariable=function(a){var c=q.apply(this,arguments);null==c&&null!=this.globalVars&&(c=this.globalVars[a]);return c};Graph.prototype.getDefaultStylesheet=function(){if(null==this.defaultStylesheet){var a=
|
|
|
|
|
this.themes["default-style2"];this.defaultStylesheet=(new mxCodec(a.ownerDocument)).decode(a)}return this.defaultStylesheet};Graph.prototype.isViewer=function(){return urlParams.viewer};var n=Graph.prototype.getSvg;Graph.prototype.getSvg=function(){var a=null;null!=this.themes&&"darkTheme"==this.defaultThemeName&&(a=this.stylesheet,this.stylesheet=this.getDefaultStylesheet(),this.refresh());var c=n.apply(this,arguments);null!=a&&(this.stylesheet=a,this.refresh());return c};var l=Graph.prototype.isCssTransformsSupported;
|
|
|
|
|
Graph.prototype.isCssTransformsSupported=function(){return l.apply(this,arguments)&&!mxClient.IS_SF};var x=mxGraphView.prototype.validateBackgroundPage;mxGraphView.prototype.validateBackgroundPage=function(){x.apply(this,arguments);if(mxClient.IS_GC&&null!=this.getDrawPane()){var a=this.getDrawPane().parentNode;!this.graph.mathEnabled||mxClient.NO_FO||null!=this.webKitForceRepaintNode&&null!=this.webKitForceRepaintNode.parentNode||"svg"!=this.graph.container.firstChild.nodeName?null==this.webKitForceRepaintNode||
|
|
|
|
|
Graph.prototype.isCssTransformsSupported=function(){return l.apply(this,arguments)&&!mxClient.IS_SF};var y=mxGraphView.prototype.validateBackgroundPage;mxGraphView.prototype.validateBackgroundPage=function(){y.apply(this,arguments);if(mxClient.IS_GC&&null!=this.getDrawPane()){var a=this.getDrawPane().parentNode;!this.graph.mathEnabled||mxClient.NO_FO||null!=this.webKitForceRepaintNode&&null!=this.webKitForceRepaintNode.parentNode||"svg"!=this.graph.container.firstChild.nodeName?null==this.webKitForceRepaintNode||
|
|
|
|
|
this.graph.mathEnabled&&("svg"==this.graph.container.firstChild.nodeName||this.graph.container.firstChild==this.webKitForceRepaintNode)||(null!=this.webKitForceRepaintNode.parentNode&&this.webKitForceRepaintNode.parentNode.removeChild(this.webKitForceRepaintNode),this.webKitForceRepaintNode=null):(this.webKitForceRepaintNode=document.createElement("div"),this.webKitForceRepaintNode.style.cssText="position:absolute;",a.ownerSVGElement.parentNode.insertBefore(this.webKitForceRepaintNode,a.ownerSVGElement))}};
|
|
|
|
|
var C=Graph.prototype.loadStylesheet;Graph.prototype.loadStylesheet=function(){C.apply(this,arguments);this.currentStyle="default-style2"};Graph.prototype.handleCustomLink=function(a){if("data:action/json,"==a.substring(0,17)&&(a=JSON.parse(a.substring(17)),null!=a.actions)){for(var c=0;c<a.actions.length;c++){var b=a.actions[c];if(null!=b.open)if(this.isCustomLink(b.open)){if(!this.customLinkClicked(b.open))return}else this.openLink(b.open)}this.model.beginUpdate();try{for(c=0;c<a.actions.length;c++)b=
|
|
|
|
|
a.actions[c],null!=b.toggle&&this.toggleCells(this.getCellsForAction(b.toggle,!0)),null!=b.show&&this.setCellsVisible(this.getCellsForAction(b.show,!0),!0),null!=b.hide&&this.setCellsVisible(this.getCellsForAction(b.hide,!0),!1)}finally{this.model.endUpdate()}for(c=0;c<a.actions.length;c++){var b=a.actions[c],f=[];null!=b.select&&this.isEnabled()&&(f=this.getCellsForAction(b.select),this.setSelectionCells(f));null!=b.highlight&&(f=this.getCellsForAction(b.highlight),this.highlightCells(f,b.highlight.color,
|
|
|
|
@ -2934,18 +2935,18 @@ a)?this.view.getDrawPane().setAttribute("filter","url(#"+this.shadowId+")"):this
|
|
|
|
|
[SHAPES_PATH+"/mockup/mxMockupText.js"];mxStencilRegistry.libraries.floorplan=[SHAPES_PATH+"/mxFloorplan.js",STENCIL_PATH+"/floorplan.xml"];mxStencilRegistry.libraries.bootstrap=[SHAPES_PATH+"/mxBootstrap.js",STENCIL_PATH+"/bootstrap.xml"];mxStencilRegistry.libraries.gmdl=[SHAPES_PATH+"/mxGmdl.js",STENCIL_PATH+"/gmdl.xml"];mxStencilRegistry.libraries.gcp2=[SHAPES_PATH+"/mxGCP2.js",STENCIL_PATH+"/gcp2.xml"];mxStencilRegistry.libraries.cabinets=[SHAPES_PATH+"/mxCabinets.js",STENCIL_PATH+"/cabinets.xml"];
|
|
|
|
|
mxStencilRegistry.libraries.archimate=[SHAPES_PATH+"/mxArchiMate.js"];mxStencilRegistry.libraries.archimate3=[SHAPES_PATH+"/mxArchiMate3.js"];mxStencilRegistry.libraries.sysml=[SHAPES_PATH+"/mxSysML.js"];mxStencilRegistry.libraries.eip=[SHAPES_PATH+"/mxEip.js",STENCIL_PATH+"/eip.xml"];mxStencilRegistry.libraries.networks=[SHAPES_PATH+"/mxNetworks.js",STENCIL_PATH+"/networks.xml"];mxStencilRegistry.libraries.aws3d=[SHAPES_PATH+"/mxAWS3D.js",STENCIL_PATH+"/aws3d.xml"];mxStencilRegistry.libraries.aws4=
|
|
|
|
|
[SHAPES_PATH+"/mxAWS4.js",STENCIL_PATH+"/aws4.xml"];mxStencilRegistry.libraries.aws4b=[SHAPES_PATH+"/mxAWS4.js",STENCIL_PATH+"/aws4.xml"];mxStencilRegistry.libraries.veeam=[STENCIL_PATH+"/veeam/2d.xml",STENCIL_PATH+"/veeam/3d.xml",STENCIL_PATH+"/veeam/veeam.xml"];mxStencilRegistry.libraries.pid2inst=[SHAPES_PATH+"/pid2/mxPidInstruments.js"];mxStencilRegistry.libraries.pid2misc=[SHAPES_PATH+"/pid2/mxPidMisc.js",STENCIL_PATH+"/pid/misc.xml"];mxStencilRegistry.libraries.pid2valves=[SHAPES_PATH+"/pid2/mxPidValves.js"];
|
|
|
|
|
mxStencilRegistry.libraries.pidFlowSensors=[STENCIL_PATH+"/pid/flow_sensors.xml"];mxMarker.getPackageForType=function(a){var c=null;null!=a&&0<a.length&&("ER"==a.substring(0,2)?c="mxgraph.er":"sysML"==a.substring(0,5)&&(c="mxgraph.sysml"));return c};var t=mxMarker.createMarker;mxMarker.createMarker=function(a,c,b,f,d,e,g,l,n,q){if(null!=b&&null==mxMarker.markers[b]){var x=this.getPackageForType(b);null!=x&&mxStencilRegistry.getStencil(x)}return t.apply(this,arguments)};PrintDialog.prototype.create=
|
|
|
|
|
function(a,c){function b(){y.value=Math.max(1,Math.min(l,Math.max(parseInt(y.value),parseInt(k.value))));k.value=Math.max(1,Math.min(l,Math.min(parseInt(y.value),parseInt(k.value))))}function f(c){function b(c,b,e){var g=c.getGraphBounds(),l=0,n=0,q=ha.get(),t=1/c.pageScale,x=F.checked;if(x)var t=parseInt(M.value),k=parseInt(T.value),t=Math.min(q.height*k/(g.height/c.view.scale),q.width*t/(g.width/c.view.scale));else t=parseInt(m.value)/(100*c.pageScale),isNaN(t)&&(f=1/c.pageScale,m.value="100 %");
|
|
|
|
|
q=mxRectangle.fromRectangle(q);q.width=Math.ceil(q.width*f);q.height=Math.ceil(q.height*f);t*=f;!x&&c.pageVisible?(g=c.getPageLayout(),l-=g.x*q.width,n-=g.y*q.height):x=!0;if(null==b){b=PrintDialog.createPrintPreview(c,t,q,0,l,n,x);b.pageSelector=!1;b.mathEnabled=!1;c=a.getCurrentFile();null!=c&&(b.title=c.getTitle());var u=b.writeHead;b.writeHead=function(c){u.apply(this,arguments);null!=a.editor.fontCss&&(c.writeln('<style type="text/css">'),c.writeln(a.editor.fontCss),c.writeln("</style>"))};if("undefined"!==
|
|
|
|
|
typeof MathJax){var y=b.renderPage;b.renderPage=function(a,c,b,f,d,e){var g=mxClient.NO_FO;mxClient.NO_FO=this.graph.mathEnabled&&!this.useForeignObjectForMath?!0:this.originalNoForeignObject;var l=y.apply(this,arguments);mxClient.NO_FO=g;this.graph.mathEnabled?this.mathEnabled=this.mathEnabled||!0:l.className="geDisableMathJax";return l}}c=null;null!=d.themes&&"darkTheme"==d.defaultThemeName&&(c=d.stylesheet,d.stylesheet=d.getDefaultStylesheet(),d.refresh());b.open(null,null,e,!0);null!=c&&(d.stylesheet=
|
|
|
|
|
c,d.refresh())}else{q=c.background;if(null==q||""==q||q==mxConstants.NONE)q="#ffffff";b.backgroundColor=q;b.autoOrigin=x;b.appendGraph(c,t,l,n,e,!0)}return b}var f=parseInt(ia.value)/100;isNaN(f)&&(f=1,ia.value="100 %");var f=.75*f,e=k.value,g=y.value,l=!t.checked,q=null;l&&(l=e==n&&g==n);if(!l&&null!=a.pages&&a.pages.length){var x=0,l=a.pages.length-1;t.checked||(x=parseInt(e)-1,l=parseInt(g)-1);for(var u=x;u<=l;u++){var C=a.pages[u],e=C==a.currentPage?d:null;if(null==e){var e=a.createTemporaryGraph(d.getStylesheet()),
|
|
|
|
|
g=!0,x=!1,p=null,E=null;null==C.viewState&&null==C.root&&a.updatePageRoot(C);null!=C.viewState&&(g=C.viewState.pageVisible,x=C.viewState.mathEnabled,p=C.viewState.background,E=C.viewState.backgroundImage);e.background=p;e.backgroundImage=null!=E?new mxImage(E.src,E.width,E.height):null;e.pageVisible=g;e.mathEnabled=x;var A=e.getGlobalVariable;e.getGlobalVariable=function(c){return"page"==c?C.getName():"pagenumber"==c?u+1:"pagecount"==c?null!=a.pages?a.pages.length:1:A.apply(this,arguments)};document.body.appendChild(e.container);
|
|
|
|
|
mxStencilRegistry.libraries.pidFlowSensors=[STENCIL_PATH+"/pid/flow_sensors.xml"];mxMarker.getPackageForType=function(a){var c=null;null!=a&&0<a.length&&("ER"==a.substring(0,2)?c="mxgraph.er":"sysML"==a.substring(0,5)&&(c="mxgraph.sysml"));return c};var t=mxMarker.createMarker;mxMarker.createMarker=function(a,c,b,f,d,e,g,l,n,q){if(null!=b&&null==mxMarker.markers[b]){var y=this.getPackageForType(b);null!=y&&mxStencilRegistry.getStencil(y)}return t.apply(this,arguments)};PrintDialog.prototype.create=
|
|
|
|
|
function(a,c){function b(){x.value=Math.max(1,Math.min(l,Math.max(parseInt(x.value),parseInt(k.value))));k.value=Math.max(1,Math.min(l,Math.min(parseInt(x.value),parseInt(k.value))))}function f(c){function b(c,b,e){var g=c.getGraphBounds(),l=0,n=0,q=ha.get(),t=1/c.pageScale,y=F.checked;if(y)var t=parseInt(M.value),k=parseInt(T.value),t=Math.min(q.height*k/(g.height/c.view.scale),q.width*t/(g.width/c.view.scale));else t=parseInt(m.value)/(100*c.pageScale),isNaN(t)&&(f=1/c.pageScale,m.value="100 %");
|
|
|
|
|
q=mxRectangle.fromRectangle(q);q.width=Math.ceil(q.width*f);q.height=Math.ceil(q.height*f);t*=f;!y&&c.pageVisible?(g=c.getPageLayout(),l-=g.x*q.width,n-=g.y*q.height):y=!0;if(null==b){b=PrintDialog.createPrintPreview(c,t,q,0,l,n,y);b.pageSelector=!1;b.mathEnabled=!1;c=a.getCurrentFile();null!=c&&(b.title=c.getTitle());var u=b.writeHead;b.writeHead=function(c){u.apply(this,arguments);null!=a.editor.fontCss&&(c.writeln('<style type="text/css">'),c.writeln(a.editor.fontCss),c.writeln("</style>"))};if("undefined"!==
|
|
|
|
|
typeof MathJax){var x=b.renderPage;b.renderPage=function(a,c,b,f,d,e){var g=mxClient.NO_FO;mxClient.NO_FO=this.graph.mathEnabled&&!this.useForeignObjectForMath?!0:this.originalNoForeignObject;var l=x.apply(this,arguments);mxClient.NO_FO=g;this.graph.mathEnabled?this.mathEnabled=this.mathEnabled||!0:l.className="geDisableMathJax";return l}}c=null;null!=d.themes&&"darkTheme"==d.defaultThemeName&&(c=d.stylesheet,d.stylesheet=d.getDefaultStylesheet(),d.refresh());b.open(null,null,e,!0);null!=c&&(d.stylesheet=
|
|
|
|
|
c,d.refresh())}else{q=c.background;if(null==q||""==q||q==mxConstants.NONE)q="#ffffff";b.backgroundColor=q;b.autoOrigin=y;b.appendGraph(c,t,l,n,e,!0)}return b}var f=parseInt(ia.value)/100;isNaN(f)&&(f=1,ia.value="100 %");var f=.75*f,e=k.value,g=x.value,l=!t.checked,q=null;l&&(l=e==n&&g==n);if(!l&&null!=a.pages&&a.pages.length){var y=0,l=a.pages.length-1;t.checked||(y=parseInt(e)-1,l=parseInt(g)-1);for(var u=y;u<=l;u++){var C=a.pages[u],e=C==a.currentPage?d:null;if(null==e){var e=a.createTemporaryGraph(d.getStylesheet()),
|
|
|
|
|
g=!0,y=!1,p=null,E=null;null==C.viewState&&null==C.root&&a.updatePageRoot(C);null!=C.viewState&&(g=C.viewState.pageVisible,y=C.viewState.mathEnabled,p=C.viewState.background,E=C.viewState.backgroundImage);e.background=p;e.backgroundImage=null!=E?new mxImage(E.src,E.width,E.height):null;e.pageVisible=g;e.mathEnabled=y;var A=e.getGlobalVariable;e.getGlobalVariable=function(c){return"page"==c?C.getName():"pagenumber"==c?u+1:"pagecount"==c?null!=a.pages?a.pages.length:1:A.apply(this,arguments)};document.body.appendChild(e.container);
|
|
|
|
|
a.updatePageRoot(C);e.model.setRoot(C.root)}q=b(e,q,u!=l);e!=d&&e.container.parentNode.removeChild(e.container)}}else q=b(d);null==q?a.handleError({message:mxResources.get("errorUpdatingPreview")}):(q.mathEnabled&&(l=q.wnd.document,l.writeln('<script type="text/x-mathjax-config">'),l.writeln("MathJax.Hub.Config({"),l.writeln("showMathMenu: false,"),l.writeln('messageStyle: "none",'),l.writeln('jax: ["input/TeX", "input/MathML", "input/AsciiMath", "output/HTML-CSS"],'),l.writeln('extensions: ["tex2jax.js", "mml2jax.js", "asciimath2jax.js"],'),
|
|
|
|
|
l.writeln('"HTML-CSS": {'),l.writeln("imageFont: null"),l.writeln("},"),l.writeln("TeX: {"),l.writeln('extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]'),l.writeln("},"),l.writeln("tex2jax: {"),l.writeln('\tignoreClass: "geDisableMathJax"'),l.writeln("},"),l.writeln("asciimath2jax: {"),l.writeln('\tignoreClass: "geDisableMathJax"'),l.writeln("}"),l.writeln("});"),c&&(l.writeln("MathJax.Hub.Queue(function () {"),l.writeln("window.print();"),l.writeln("});")),l.writeln("\x3c/script>"),
|
|
|
|
|
l.writeln('<script type="text/javascript" src="'+DRAW_MATH_URL+'/MathJax.js">\x3c/script>')),q.closeDocument(),!q.mathEnabled&&c&&PrintDialog.printPreview(q))}var d=a.editor.graph,e=document.createElement("div"),g=document.createElement("h3");g.style.width="100%";g.style.textAlign="center";g.style.marginTop="0px";mxUtils.write(g,c||mxResources.get("print"));e.appendChild(g);var l=1,n=1,q=document.createElement("div");q.style.cssText="border-bottom:1px solid lightGray;padding-bottom:12px;margin-bottom:12px;";
|
|
|
|
|
var t=document.createElement("input");t.style.cssText="margin-right:8px;margin-bottom:8px;";t.setAttribute("value","all");t.setAttribute("type","radio");t.setAttribute("name","pages-printdialog");q.appendChild(t);g=document.createElement("span");mxUtils.write(g,mxResources.get("printAllPages"));q.appendChild(g);mxUtils.br(q);var x=t.cloneNode(!0);t.setAttribute("checked","checked");x.setAttribute("value","range");q.appendChild(x);g=document.createElement("span");mxUtils.write(g,mxResources.get("pages")+
|
|
|
|
|
":");q.appendChild(g);var k=document.createElement("input");k.style.cssText="margin:0 8px 0 8px;";k.setAttribute("value","1");k.setAttribute("type","number");k.setAttribute("min","1");k.style.width="50px";q.appendChild(k);g=document.createElement("span");mxUtils.write(g,mxResources.get("to"));q.appendChild(g);var y=k.cloneNode(!0);q.appendChild(y);mxEvent.addListener(k,"focus",function(){x.checked=!0});mxEvent.addListener(y,"focus",function(){x.checked=!0});mxEvent.addListener(k,"change",b);mxEvent.addListener(y,
|
|
|
|
|
"change",b);if(null!=a.pages&&(l=a.pages.length,null!=a.currentPage))for(g=0;g<a.pages.length;g++)if(a.currentPage==a.pages[g]){n=g+1;k.value=n;y.value=n;break}k.setAttribute("max",l);y.setAttribute("max",l);1<l&&e.appendChild(q);var u=document.createElement("div");u.style.marginBottom="10px";var C=document.createElement("input");C.style.marginRight="8px";C.setAttribute("value","adjust");C.setAttribute("type","radio");C.setAttribute("name","printZoom");u.appendChild(C);g=document.createElement("span");
|
|
|
|
|
var t=document.createElement("input");t.style.cssText="margin-right:8px;margin-bottom:8px;";t.setAttribute("value","all");t.setAttribute("type","radio");t.setAttribute("name","pages-printdialog");q.appendChild(t);g=document.createElement("span");mxUtils.write(g,mxResources.get("printAllPages"));q.appendChild(g);mxUtils.br(q);var y=t.cloneNode(!0);t.setAttribute("checked","checked");y.setAttribute("value","range");q.appendChild(y);g=document.createElement("span");mxUtils.write(g,mxResources.get("pages")+
|
|
|
|
|
":");q.appendChild(g);var k=document.createElement("input");k.style.cssText="margin:0 8px 0 8px;";k.setAttribute("value","1");k.setAttribute("type","number");k.setAttribute("min","1");k.style.width="50px";q.appendChild(k);g=document.createElement("span");mxUtils.write(g,mxResources.get("to"));q.appendChild(g);var x=k.cloneNode(!0);q.appendChild(x);mxEvent.addListener(k,"focus",function(){y.checked=!0});mxEvent.addListener(x,"focus",function(){y.checked=!0});mxEvent.addListener(k,"change",b);mxEvent.addListener(x,
|
|
|
|
|
"change",b);if(null!=a.pages&&(l=a.pages.length,null!=a.currentPage))for(g=0;g<a.pages.length;g++)if(a.currentPage==a.pages[g]){n=g+1;k.value=n;x.value=n;break}k.setAttribute("max",l);x.setAttribute("max",l);1<l&&e.appendChild(q);var u=document.createElement("div");u.style.marginBottom="10px";var C=document.createElement("input");C.style.marginRight="8px";C.setAttribute("value","adjust");C.setAttribute("type","radio");C.setAttribute("name","printZoom");u.appendChild(C);g=document.createElement("span");
|
|
|
|
|
mxUtils.write(g,mxResources.get("adjustTo"));u.appendChild(g);var m=document.createElement("input");m.style.cssText="margin:0 8px 0 8px;";m.setAttribute("value","100 %");m.style.width="50px";u.appendChild(m);mxEvent.addListener(m,"focus",function(){C.checked=!0});e.appendChild(u);var q=q.cloneNode(!1),F=C.cloneNode(!0);F.setAttribute("value","fit");C.setAttribute("checked","checked");g=document.createElement("div");g.style.cssText="display:inline-block;height:100%;vertical-align:top;padding-top:2px;";
|
|
|
|
|
g.appendChild(F);q.appendChild(g);u=document.createElement("table");u.style.display="inline-block";var p=document.createElement("tbody"),E=document.createElement("tr"),A=E.cloneNode(!0),v=document.createElement("td"),z=v.cloneNode(!0),B=v.cloneNode(!0),L=v.cloneNode(!0),I=v.cloneNode(!0),ea=v.cloneNode(!0);v.style.textAlign="right";L.style.textAlign="right";mxUtils.write(v,mxResources.get("fitTo"));var M=document.createElement("input");M.style.cssText="margin:0 8px 0 8px;";M.setAttribute("value",
|
|
|
|
|
"1");M.setAttribute("min","1");M.setAttribute("type","number");M.style.width="40px";z.appendChild(M);g=document.createElement("span");mxUtils.write(g,mxResources.get("fitToSheetsAcross"));B.appendChild(g);mxUtils.write(L,mxResources.get("fitToBy"));var T=M.cloneNode(!0);I.appendChild(T);mxEvent.addListener(M,"focus",function(){F.checked=!0});mxEvent.addListener(T,"focus",function(){F.checked=!0});g=document.createElement("span");mxUtils.write(g,mxResources.get("fitToSheetsDown"));ea.appendChild(g);
|
|
|
|
@ -2953,8 +2954,8 @@ E.appendChild(v);E.appendChild(z);E.appendChild(B);A.appendChild(L);A.appendChil
|
|
|
|
|
mxConstants.PAGE_FORMAT_A4_PORTRAIT);q.appendChild(g);g=document.createElement("span");mxUtils.write(g,mxResources.get("pageScale"));q.appendChild(g);var ia=document.createElement("input");ia.style.cssText="margin:0 8px 0 8px;";ia.setAttribute("value","100 %");ia.style.width="60px";q.appendChild(ia);e.appendChild(q);g=document.createElement("div");g.style.cssText="text-align:right;margin:48px 0 0 0;";q=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});q.className="geBtn";a.editor.cancelFirst&&
|
|
|
|
|
g.appendChild(q);a.isOffline()||(u=mxUtils.button(mxResources.get("help"),function(){d.openLink("https://desk.draw.io/support/solutions/articles/16000048947")}),u.className="geBtn",g.appendChild(u));PrintDialog.previewEnabled&&(u=mxUtils.button(mxResources.get("preview"),function(){a.hideDialog();f(!1)}),u.className="geBtn",g.appendChild(u));u=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){a.hideDialog();f(!0)});u.className="geBtn gePrimaryBtn";g.appendChild(u);
|
|
|
|
|
a.editor.cancelFirst||g.appendChild(q);e.appendChild(g);this.container=e};var E=ChangePageSetup.prototype.execute;ChangePageSetup.prototype.execute=function(){null==this.page&&(this.page=this.ui.currentPage);this.page!=this.ui.currentPage?null!=this.page.viewState&&(this.ignoreColor||(this.page.viewState.background=this.color),this.ignoreImage||(this.page.viewState.backgroundImage=this.image),null!=this.format&&(this.page.viewState.pageFormat=this.format),null!=this.mathEnabled&&(this.page.viewState.mathEnabled=
|
|
|
|
|
this.mathEnabled),null!=this.shadowVisible&&(this.page.viewState.shadowVisible=this.shadowVisible)):(E.apply(this,arguments),null!=this.mathEnabled&&this.mathEnabled!=this.ui.isMathEnabled()&&(this.ui.setMathEnabled(this.mathEnabled),this.mathEnabled=!this.mathEnabled),null!=this.shadowVisible&&this.shadowVisible!=this.ui.editor.graph.shadowVisible&&(this.ui.editor.graph.setShadowVisible(this.shadowVisible),this.shadowVisible=!this.shadowVisible))};Editor.prototype.useCanvasForExport=!1;try{var y=
|
|
|
|
|
document.createElement("canvas"),F=new Image;F.onload=function(){try{y.getContext("2d").drawImage(F,0,0);var a=y.toDataURL("image/png");Editor.prototype.useCanvasForExport=null!=a&&6<a.length}catch(A){}};F.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1px" height="1px" version="1.1"><foreignObject pointer-events="all" width="1" height="1"><div xmlns="http://www.w3.org/1999/xhtml"></div></foreignObject></svg>')))}catch(u){}})();
|
|
|
|
|
this.mathEnabled),null!=this.shadowVisible&&(this.page.viewState.shadowVisible=this.shadowVisible)):(E.apply(this,arguments),null!=this.mathEnabled&&this.mathEnabled!=this.ui.isMathEnabled()&&(this.ui.setMathEnabled(this.mathEnabled),this.mathEnabled=!this.mathEnabled),null!=this.shadowVisible&&this.shadowVisible!=this.ui.editor.graph.shadowVisible&&(this.ui.editor.graph.setShadowVisible(this.shadowVisible),this.shadowVisible=!this.shadowVisible))};Editor.prototype.useCanvasForExport=!1;try{var x=
|
|
|
|
|
document.createElement("canvas"),F=new Image;F.onload=function(){try{x.getContext("2d").drawImage(F,0,0);var a=x.toDataURL("image/png");Editor.prototype.useCanvasForExport=null!=a&&6<a.length}catch(A){}};F.src="data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1px" height="1px" version="1.1"><foreignObject pointer-events="all" width="1" height="1"><div xmlns="http://www.w3.org/1999/xhtml"></div></foreignObject></svg>')))}catch(u){}})();
|
|
|
|
|
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,e,d){d.ui=a.ui;return e};a.afterDecode=function(a,e,d){d.previousColor=d.color;d.previousImage=d.image;d.previousFormat=d.format;null!=d.foldingEnabled&&(d.foldingEnabled=!d.foldingEnabled);null!=d.mathEnabled&&(d.mathEnabled=!d.mathEnabled);null!=d.shadowVisible&&(d.shadowVisible=!d.shadowVisible);return d};mxCodecRegistry.register(a)})();(function(){EditorUi.VERSION="@DRAWIO-VERSION@";EditorUi.compactUi="atlas"!=uiTheme;mxGraphView.prototype.defaultDarkGridColor="#6e6e6e";"dark"==uiTheme&&(mxGraphView.prototype.gridColor=mxGraphView.prototype.defaultDarkGridColor);EditorUi.enableLogging="1"!=urlParams.stealth&&/.*\.draw\.io$/.test(window.location.hostname)&&"support.draw.io"!=window.location.hostname;EditorUi.drawHost="https://www.draw.io";EditorUi.lastErrorMessage=null;EditorUi.ignoredAnonymizedChars="\n\t`~!@#$%^&*()_+{}|:\"<>?-=[];'./,\n\t";
|
|
|
|
|
EditorUi.templateFile=TEMPLATE_PATH+"/index.xml";EditorUi.cacheUrl="1"==urlParams.dev?"/cache":"https://rt.draw.io/cache";Editor.cacheTimeout=1E4;EditorUi.enablePlantUml=EditorUi.enableLogging;EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.scratchpadHelpLink="https://desk.draw.io/support/solutions/articles/16000042367";EditorUi.logError=function(a,b,d,e,n){if("1"==urlParams.dev)EditorUi.debug("logError",a,b,
|
|
|
|
|
d,e,n);else if(EditorUi.enableLogging)try{if(a!=EditorUi.lastErrorMessage&&(null==a||null==b||-1==a.indexOf("Script error")&&-1==a.indexOf("extension"))&&null!=a&&0>a.indexOf("DocumentClosedError")){EditorUi.lastErrorMessage=a;var c=0<=a.indexOf("NetworkError")||0<=a.indexOf("SecurityError")||0<=a.indexOf("NS_ERROR_FAILURE")||0<=a.indexOf("out of memory")?"CONFIG":"SEVERE",f=null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"";n=null!=n?n:Error(a);(new Image).src=f+"/log?severity="+c+"&v="+encodeURIComponent(EditorUi.VERSION)+
|
|
|
|
@ -2972,14 +2973,14 @@ g.style.color="white",g.style.fontFamily="Helvetica, Arial",g.style.fontSize="9p
|
|
|
|
|
e.charAt(e.length-1)&&(e+="..."),g.innerHTML=e,d.appendChild(g),c.status=g,mxClient.IS_VML&&(null==document.documentMode||8>=document.documentMode)&&(g.style.left=Math.round(Math.max(0,a-g.offsetWidth/2))+"px",g.style.top=Math.round(Math.max(0,b+70-g.offsetHeight/2))+"px")),this.pause=mxUtils.bind(this,function(){var a=function(){};this.active&&(a=mxUtils.bind(this,function(){this.spin(d,e)}));this.stop();return a}),g=!0);return g};var e=c.stop;c.stop=function(){e.call(this);this.active=!1;null!=
|
|
|
|
|
c.status&&(c.status.parentNode.removeChild(c.status),c.status=null)};c.pause=function(){return function(){}};return c};EditorUi.prototype.isCompatibleString=function(a){try{var c=mxUtils.parseXml(a),b=this.editor.extractGraphModel(c.documentElement,!0);return null!=b&&0==b.getElementsByTagName("parsererror").length}catch(q){}return!1};EditorUi.prototype.isVisioData=function(a){return 8<a.length&&208==a.charCodeAt(0)&&207==a.charCodeAt(1)&&17==a.charCodeAt(2)&&224==a.charCodeAt(3)&&161==a.charCodeAt(4)&&
|
|
|
|
|
177==a.charCodeAt(5)&&26==a.charCodeAt(6)&&225==a.charCodeAt(7)||80==a.charCodeAt(0)&&75==a.charCodeAt(1)&&3==a.charCodeAt(2)&&4==a.charCodeAt(3)||80==a.charCodeAt(0)&&75==a.charCodeAt(1)&&3==a.charCodeAt(2)&&6==a.charCodeAt(3)};EditorUi.prototype.isPngData=function(a){return 8<a.length&&137==a.charCodeAt(0)&&80==a.charCodeAt(1)&&78==a.charCodeAt(2)&&71==a.charCodeAt(3)&&13==a.charCodeAt(4)&&10==a.charCodeAt(5)&&26==a.charCodeAt(6)&&10==a.charCodeAt(7)};var a=EditorUi.prototype.extractGraphModelFromHtml;
|
|
|
|
|
EditorUi.prototype.extractGraphModelFromHtml=function(c){var b=a.apply(this,arguments);if(null==b)try{var d=c.indexOf("<mxfile ");if(0<=d){var e=c.lastIndexOf("</mxfile>");e>d&&(b=c.substring(d,e+15).replace(/>/g,">").replace(/</g,"<").replace(/\\"/g,'"').replace(/\n/g,""))}else var n=mxUtils.parseXml(c),l=this.editor.extractGraphModel(n.documentElement,null!=this.pages||"hidden"==this.diagramContainer.style.visibility),b=null!=l?mxUtils.getXml(l):""}catch(x){}return b};EditorUi.prototype.validateFileData=
|
|
|
|
|
EditorUi.prototype.extractGraphModelFromHtml=function(c){var b=a.apply(this,arguments);if(null==b)try{var d=c.indexOf("<mxfile ");if(0<=d){var e=c.lastIndexOf("</mxfile>");e>d&&(b=c.substring(d,e+15).replace(/>/g,">").replace(/</g,"<").replace(/\\"/g,'"').replace(/\n/g,""))}else var n=mxUtils.parseXml(c),l=this.editor.extractGraphModel(n.documentElement,null!=this.pages||"hidden"==this.diagramContainer.style.visibility),b=null!=l?mxUtils.getXml(l):""}catch(y){}return b};EditorUi.prototype.validateFileData=
|
|
|
|
|
function(a){if(null!=a&&0<a.length){var c=a.indexOf('<meta charset="utf-8">');0<=c&&(a=a.slice(0,c)+'<meta charset="utf-8"/>'+a.slice(c+23-1,a.length));a=Graph.zapGremlins(a)}return a};EditorUi.prototype.replaceFileData=function(a){a=this.validateFileData(a);a=null!=a&&0<a.length?mxUtils.parseXml(a).documentElement:null;var c=null!=a?this.editor.extractGraphModel(a,!0):null;null!=c&&(a=c);if(null!=a){c=this.editor.graph;c.model.beginUpdate();try{var b=null!=this.pages?this.pages.slice():null,d=a.getElementsByTagName("diagram");
|
|
|
|
|
if("0"!=urlParams.pages||1<d.length||1==d.length&&d[0].hasAttribute("name")){this.fileNode=a;this.pages=null!=this.pages?this.pages:[];for(var e=d.length-1;0<=e;e--){var l=this.updatePageRoot(new DiagramPage(d[e]));null==l.getName()&&l.setName(mxResources.get("pageWithNumber",[e+1]));c.model.execute(new ChangePage(this,l,0==e?l:null,0))}}else"0"!=urlParams.pages&&null==this.fileNode&&(this.fileNode=a.ownerDocument.createElement("mxfile"),this.currentPage=new DiagramPage(a.ownerDocument.createElement("diagram")),
|
|
|
|
|
this.currentPage.setName(mxResources.get("pageWithNumber",[1])),c.model.execute(new ChangePage(this,this.currentPage,this.currentPage,0))),this.editor.setGraphXml(a),null!=this.currentPage&&(this.currentPage.root=this.editor.graph.model.root);if(null!=b)for(e=0;e<b.length;e++)c.model.execute(new ChangePage(this,b[e],null))}finally{c.model.endUpdate()}}};EditorUi.prototype.createFileData=function(a,b,d,e,n,l,x,k,t,m,y){b=null!=b?b:this.editor.graph;n=null!=n?n:!1;t=null!=t?t:!0;var c,f=null;null==
|
|
|
|
|
d||d.getMode()==App.MODE_DEVICE||d.getMode()==App.MODE_BROWSER?c="_blank":f=c=e;if(null==a)return"";var g=a;if("mxfile"!=g.nodeName.toLowerCase()){if(y){var q=a.ownerDocument.createElement("diagram");q.setAttribute("id",Editor.guid());q.appendChild(a)}else{q=Graph.zapGremlins(mxUtils.getXml(a));g=Graph.compress(q);if(Graph.decompress(g)!=q)return q;q=a.ownerDocument.createElement("diagram");q.setAttribute("id",Editor.guid());mxUtils.setTextContent(q,g)}g=a.ownerDocument.createElement("mxfile");g.appendChild(q)}m?
|
|
|
|
|
this.currentPage.setName(mxResources.get("pageWithNumber",[1])),c.model.execute(new ChangePage(this,this.currentPage,this.currentPage,0))),this.editor.setGraphXml(a),null!=this.currentPage&&(this.currentPage.root=this.editor.graph.model.root);if(null!=b)for(e=0;e<b.length;e++)c.model.execute(new ChangePage(this,b[e],null))}finally{c.model.endUpdate()}}};EditorUi.prototype.createFileData=function(a,b,d,e,n,l,y,k,t,m,x){b=null!=b?b:this.editor.graph;n=null!=n?n:!1;t=null!=t?t:!0;var c,f=null;null==
|
|
|
|
|
d||d.getMode()==App.MODE_DEVICE||d.getMode()==App.MODE_BROWSER?c="_blank":f=c=e;if(null==a)return"";var g=a;if("mxfile"!=g.nodeName.toLowerCase()){if(x){var q=a.ownerDocument.createElement("diagram");q.setAttribute("id",Editor.guid());q.appendChild(a)}else{q=Graph.zapGremlins(mxUtils.getXml(a));g=Graph.compress(q);if(Graph.decompress(g)!=q)return q;q=a.ownerDocument.createElement("diagram");q.setAttribute("id",Editor.guid());mxUtils.setTextContent(q,g)}g=a.ownerDocument.createElement("mxfile");g.appendChild(q)}m?
|
|
|
|
|
(g=g.cloneNode(!0),g.removeAttribute("modified"),g.removeAttribute("host"),g.removeAttribute("agent"),g.removeAttribute("etag"),g.removeAttribute("userAgent"),g.removeAttribute("version"),g.removeAttribute("editor"),g.removeAttribute("type")):(g.removeAttribute("userAgent"),g.removeAttribute("version"),g.removeAttribute("editor"),g.removeAttribute("pages"),g.removeAttribute("type"),mxClient.IS_CHROMEAPP?g.setAttribute("host","Chrome"):EditorUi.isElectronApp?g.setAttribute("host","Electron"):g.setAttribute("host",
|
|
|
|
|
window.location.hostname),g.setAttribute("modified",(new Date).toISOString()),g.setAttribute("agent",navigator.userAgent),g.setAttribute("version",EditorUi.VERSION),g.setAttribute("etag",Editor.guid()),a=null!=d?d.getMode():this.mode,null!=a&&g.setAttribute("type",a),null!=this.pages&&g.setAttribute("pages",this.pages.length));y=y?mxUtils.getPrettyXml(g):mxUtils.getXml(g);if(!l&&!n&&(x||null!=d&&/(\.html)$/i.test(d.getTitle())))y=this.getHtml2(mxUtils.getXml(g),b,null!=d?d.getTitle():null,c,f);else if(l||
|
|
|
|
|
!n&&null!=d&&/(\.svg)$/i.test(d.getTitle()))null==d||d.getMode()!=App.MODE_DEVICE&&d.getMode()!=App.MODE_BROWSER||(e=null),y=this.getEmbeddedSvg(y,b,e,null,k,t,f);return y};EditorUi.prototype.getXmlFileData=function(a,b,d){a=null!=a?a:!0;b=null!=b?b:!1;d=null!=d?d:!Editor.compressXml;var c=this.editor.getGraphXml(a);if(a&&null!=this.fileNode&&null!=this.currentPage)if(d?(EditorUi.removeChildNodes(this.currentPage.node),this.currentPage.node.appendChild(c)):(c=Graph.compressNode(c),mxUtils.setTextContent(this.currentPage.node,
|
|
|
|
|
window.location.hostname),g.setAttribute("modified",(new Date).toISOString()),g.setAttribute("agent",navigator.userAgent),g.setAttribute("version",EditorUi.VERSION),g.setAttribute("etag",Editor.guid()),a=null!=d?d.getMode():this.mode,null!=a&&g.setAttribute("type",a),null!=this.pages&&g.setAttribute("pages",this.pages.length));x=x?mxUtils.getPrettyXml(g):mxUtils.getXml(g);if(!l&&!n&&(y||null!=d&&/(\.html)$/i.test(d.getTitle())))x=this.getHtml2(mxUtils.getXml(g),b,null!=d?d.getTitle():null,c,f);else if(l||
|
|
|
|
|
!n&&null!=d&&/(\.svg)$/i.test(d.getTitle()))null==d||d.getMode()!=App.MODE_DEVICE&&d.getMode()!=App.MODE_BROWSER||(e=null),x=this.getEmbeddedSvg(x,b,e,null,k,t,f);return x};EditorUi.prototype.getXmlFileData=function(a,b,d){a=null!=a?a:!0;b=null!=b?b:!1;d=null!=d?d:!Editor.compressXml;var c=this.editor.getGraphXml(a);if(a&&null!=this.fileNode&&null!=this.currentPage)if(d?(EditorUi.removeChildNodes(this.currentPage.node),this.currentPage.node.appendChild(c)):(c=Graph.compressNode(c),mxUtils.setTextContent(this.currentPage.node,
|
|
|
|
|
c)),c=this.fileNode.cloneNode(!1),b)c.appendChild(this.currentPage.node);else for(b=0;b<this.pages.length;b++)this.currentPage!=this.pages[b]&&(this.pages[b].needsUpdate?(a=(new mxCodec(mxUtils.createXmlDocument())).encode(new mxGraphModel(this.pages[b].root)),this.editor.graph.saveViewState(this.pages[b].viewState,a),d?(EditorUi.removeChildNodes(this.pages[b].node),this.pages[b].node.appendChild(a)):mxUtils.setTextContent(this.pages[b].node,Graph.compressNode(a)),delete this.pages[b].needsUpdate):
|
|
|
|
|
d&&(a=Editor.parseDiagramNode(this.pages[b].node),EditorUi.removeChildNodes(this.pages[b].node),this.pages[b].node.appendChild(a))),c.appendChild(this.pages[b].node);return c};EditorUi.prototype.anonymizeString=function(a,b){for(var c=[],f=0;f<a.length;f++){var d=a.charAt(f);0<=EditorUi.ignoredAnonymizedChars.indexOf(d)?c.push(d):isNaN(parseInt(d))?d.toLowerCase()!=d?c.push(String.fromCharCode(65+Math.round(25*Math.random()))):d.toUpperCase()!=d?c.push(String.fromCharCode(97+Math.round(25*Math.random()))):
|
|
|
|
|
/\s/.test(d)?c.push(" "):c.push("?"):c.push(b?"0":Math.round(9*Math.random()))}return c.join("")};EditorUi.prototype.anonymizePatch=function(a){if(null!=a[EditorUi.DIFF_INSERT])for(var c=0;c<a[EditorUi.DIFF_INSERT].length;c++)try{var b=mxUtils.parseXml(a[EditorUi.DIFF_INSERT][c].data).documentElement.cloneNode(!1);null!=b.getAttribute("name")&&b.setAttribute("name",this.anonymizeString(b.getAttribute("name")));a[EditorUi.DIFF_INSERT][c].data=mxUtils.getXml(b)}catch(l){a[EditorUi.DIFF_INSERT][c].data=
|
|
|
|
@ -2987,8 +2988,8 @@ l.message}if(null!=a[EditorUi.DIFF_UPDATE]){for(var d in a[EditorUi.DIFF_UPDATE]
|
|
|
|
|
delete e.cells[a]}}),c(EditorUi.DIFF_INSERT),c(EditorUi.DIFF_UPDATE),0==Object.keys(e.cells).length&&delete e.cells);0==Object.keys(e).length&&delete a[EditorUi.DIFF_UPDATE][d]}0==Object.keys(a[EditorUi.DIFF_UPDATE]).length&&delete a[EditorUi.DIFF_UPDATE]}return a};EditorUi.prototype.anonymizeAttributes=function(a,b){if(null!=a.attributes)for(var c=0;c<a.attributes.length;c++)"as"!=a.attributes[c].name&&a.setAttribute(a.attributes[c].name,this.anonymizeString(a.attributes[c].value,b));if(null!=a.childNodes)for(c=
|
|
|
|
|
0;c<a.childNodes.length;c++)this.anonymizeAttributes(a.childNodes[c],b)};EditorUi.prototype.anonymizeNode=function(a,b){for(var c=a.getElementsByTagName("mxCell"),f=0;f<c.length;f++)null!=c[f].getAttribute("value")&&c[f].setAttribute("value","["+c[f].getAttribute("value").length+"]"),null!=c[f].getAttribute("xmlValue")&&c[f].setAttribute("xmlValue","["+c[f].getAttribute("xmlValue").length+"]"),null!=c[f].getAttribute("style")&&c[f].setAttribute("style","["+c[f].getAttribute("style").length+"]"),null!=
|
|
|
|
|
c[f].parentNode&&"root"!=c[f].parentNode.nodeName&&null!=c[f].parentNode.parentNode&&(c[f].setAttribute("id",c[f].parentNode.getAttribute("id")),c[f].parentNode.parentNode.replaceChild(c[f],c[f].parentNode));return a};EditorUi.prototype.synchronizeCurrentFile=function(a){var c=this.getCurrentFile();null!=c&&(c.savingFile?this.handleError({message:mxResources.get("busy")}):!a&&c.invalidChecksum?c.handleFileError(null,!0):this.spinner.spin(document.body,mxResources.get("updatingDocument"))&&(c.clearAutosave(),
|
|
|
|
|
this.editor.setStatus(""),a?c.reloadFile(mxUtils.bind(this,function(){c.handleFileSuccess("manual"==DrawioFile.SYNC)}),mxUtils.bind(this,function(a){c.handleFileError(a,!0)})):c.synchronizeFile(mxUtils.bind(this,function(){c.handleFileSuccess("manual"==DrawioFile.SYNC)}),mxUtils.bind(this,function(a){c.handleFileError(a,!0)}))))};EditorUi.prototype.getFileData=function(a,b,d,e,n,l,x,k,t,m){n=null!=n?n:!0;l=null!=l?l:!1;var c=this.editor.graph;if(b||!a&&null!=t&&/(\.svg)$/i.test(t.getTitle()))if(m=
|
|
|
|
|
!1,null!=this.pages&&this.currentPage!=this.pages[0]){var f=c.getGlobalVariable,c=this.createTemporaryGraph(c.getStylesheet()),g=this.pages[0];c.getGlobalVariable=function(a){return"page"==a?g.getName():"pagenumber"==a?1:f.apply(this,arguments)};document.body.appendChild(c.container);c.model.setRoot(g.root)}x=null!=x?x:this.getXmlFileData(n,l,m);t=null!=t?t:this.getCurrentFile();a=this.createFileData(x,c,t,window.location.href,a,b,d,e,n,k,m);c!=this.editor.graph&&c.container.parentNode.removeChild(c.container);
|
|
|
|
|
this.editor.setStatus(""),a?c.reloadFile(mxUtils.bind(this,function(){c.handleFileSuccess("manual"==DrawioFile.SYNC)}),mxUtils.bind(this,function(a){c.handleFileError(a,!0)})):c.synchronizeFile(mxUtils.bind(this,function(){c.handleFileSuccess("manual"==DrawioFile.SYNC)}),mxUtils.bind(this,function(a){c.handleFileError(a,!0)}))))};EditorUi.prototype.getFileData=function(a,b,d,e,n,l,y,k,t,m){n=null!=n?n:!0;l=null!=l?l:!1;var c=this.editor.graph;if(b||!a&&null!=t&&/(\.svg)$/i.test(t.getTitle()))if(m=
|
|
|
|
|
!1,null!=this.pages&&this.currentPage!=this.pages[0]){var f=c.getGlobalVariable,c=this.createTemporaryGraph(c.getStylesheet()),g=this.pages[0];c.getGlobalVariable=function(a){return"page"==a?g.getName():"pagenumber"==a?1:f.apply(this,arguments)};document.body.appendChild(c.container);c.model.setRoot(g.root)}y=null!=y?y:this.getXmlFileData(n,l,m);t=null!=t?t:this.getCurrentFile();a=this.createFileData(y,c,t,window.location.href,a,b,d,e,n,k,m);c!=this.editor.graph&&c.container.parentNode.removeChild(c.container);
|
|
|
|
|
return a};EditorUi.prototype.getHtml=function(a,b,d,e,n,l){l=null!=l?l:!0;var c=null,f=EditorUi.drawHost+"/js/embed-static.min.js";if(null!=b){var c=l?b.getGraphBounds():b.getBoundingBox(b.getSelectionCells()),g=b.view.scale;l=Math.floor(c.x/g-b.view.translate.x);g=Math.floor(c.y/g-b.view.translate.y);c=b.background;null==n&&(b=this.getBasenames().join(";"),0<b.length&&(f=EditorUi.drawHost+"/embed.js?s="+b));a.setAttribute("x0",l);a.setAttribute("y0",g)}null!=a&&(a.setAttribute("pan","1"),a.setAttribute("zoom",
|
|
|
|
|
"1"),a.setAttribute("resize","0"),a.setAttribute("fit","0"),a.setAttribute("border","20"),a.setAttribute("links","1"),null!=e&&a.setAttribute("edit",e));null!=n&&(n=n.replace(/&/g,"&"));a=null!=a?Graph.zapGremlins(mxUtils.getXml(a)):"";e=Graph.compress(a);Graph.decompress(e)!=a&&(e=encodeURIComponent(a));return(null==n?'\x3c!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=5,IE=9" ><![endif]--\x3e\n':"")+"<!DOCTYPE html>\n<html"+(null!=n?' xmlns="http://www.w3.org/1999/xhtml">':">")+"\n<head>\n"+
|
|
|
|
|
(null==n?null!=d?"<title>"+mxUtils.htmlEntities(d)+"</title>\n":"":"<title>Draw.io Diagram</title>\n")+(null!=n?'<meta http-equiv="refresh" content="0;URL=\''+n+"'\"/>\n":"")+"</head>\n<body"+(null==n&&null!=c&&c!=mxConstants.NONE?' style="background-color:'+c+';">':">")+'\n<div class="mxgraph" style="position:relative;overflow:auto;width:100%;">\n<div style="width:1px;height:1px;overflow:hidden;">'+e+"</div>\n</div>\n"+(null==n?'<script type="text/javascript" src="'+f+'">\x3c/script>':'<a style="position:absolute;top:50%;left:50%;margin-top:-128px;margin-left:-64px;" href="'+
|
|
|
|
@ -2998,26 +2999,26 @@ b+'">\x3c/script>':'<a style="position:absolute;top:50%;left:50%;margin-top:-128
|
|
|
|
|
c=null!=a?this.editor.extractGraphModel(a,!0):null;null!=c&&(a=c);if(null!=a&&"mxfile"==a.nodeName&&(c=a.getElementsByTagName("diagram"),"0"!=urlParams.pages||1<c.length||1==c.length&&c[0].hasAttribute("name"))){var b=null;this.fileNode=a;this.pages=[];for(a=0;a<c.length;a++){null==c[a].getAttribute("id")&&c[a].setAttribute("id",a);var d=new DiagramPage(c[a]);null==d.getName()&&d.setName(mxResources.get("pageWithNumber",[a+1]));this.pages.push(d);null!=urlParams["page-id"]&&d.getId()==urlParams["page-id"]&&
|
|
|
|
|
(b=d)}this.currentPage=null!=b?b:this.pages[Math.max(0,Math.min(this.pages.length-1,urlParams.page||0))];a=this.currentPage.node}"0"!=urlParams.pages&&null==this.fileNode&&null!=a&&(this.fileNode=a.ownerDocument.createElement("mxfile"),this.currentPage=new DiagramPage(a.ownerDocument.createElement("diagram")),this.currentPage.setName(mxResources.get("pageWithNumber",[1])),this.pages=[this.currentPage]);this.editor.setGraphXml(a);null!=this.currentPage&&(this.currentPage.root=this.editor.graph.model.root)};
|
|
|
|
|
EditorUi.prototype.getBaseFilename=function(a){var c=this.getCurrentFile(),c=null!=c&&null!=c.getTitle()?c.getTitle():this.defaultFilename;if(/(\.xml)$/i.test(c)||/(\.html)$/i.test(c)||/(\.svg)$/i.test(c)||/(\.png)$/i.test(c)||/(\.drawio)$/i.test(c))c=c.substring(0,c.lastIndexOf("."));!a&&null!=this.pages&&1<this.pages.length&&null!=this.currentPage&&null!=this.currentPage.node.getAttribute("name")&&0<this.currentPage.getName().length&&(c=c+"-"+this.currentPage.getName());return c};EditorUi.prototype.downloadFile=
|
|
|
|
|
function(a,b,d,e,n,l,x,k,t,m){try{e=null!=e?e:this.editor.graph.isSelectionEmpty();var c=this.getBaseFilename(!n),f=c+"."+a;if("xml"==a){var g='<?xml version="1.0" encoding="UTF-8"?>\n'+this.getFileData(!0,null,null,null,e,n,null,null,null,b);this.saveData(f,a,g,"text/xml")}else if("html"==a)g=this.getHtml2(this.getFileData(!0),this.editor.graph,c),this.saveData(f,a,g,"text/html");else if("svg"!=a&&"xmlsvg"!=a||!this.spinner.spin(document.body,mxResources.get("export")))"xmlpng"==a?f=c+".png":"jpeg"==
|
|
|
|
|
a&&(f=c+".jpg"),this.saveRequest(f,a,mxUtils.bind(this,function(c,b){try{var f=this.editor.graph.pageVisible;null!=l&&(this.editor.graph.pageVisible=l);var d=this.createDownloadRequest(c,a,e,b,x,n,k,t,m);this.editor.graph.pageVisible=f;return d}catch(Q){this.handleError(Q)}}));else{var q=null,C=mxUtils.bind(this,function(a){a.length<=MAX_REQUEST_SIZE?this.saveData(f,"svg",a,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(q)}))});
|
|
|
|
|
if("svg"==a){var p=this.editor.graph.background;if(x||p==mxConstants.NONE)p=null;var E=this.editor.graph.getSvg(p,null,null,null,null,e);d&&this.editor.graph.addSvgShadow(E);this.convertImages(E,mxUtils.bind(this,mxUtils.bind(this,function(a){this.spinner.stop();C('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(a))})))}else f=c+".svg",q=this.getFileData(!1,!0,null,mxUtils.bind(this,function(a){this.spinner.stop();
|
|
|
|
|
C(a)}),e)}}catch(P){this.handleError(P)}};EditorUi.prototype.createDownloadRequest=function(a,b,d,e,n,l,x,k,t){var c=this.editor.graph,f=c.getGraphBounds();d=this.getFileData(!0,null,null,null,d,0==l?!1:"xmlpng"!=b);var g="",q="";if(f.width*f.height>MAX_AREA||d.length>MAX_REQUEST_SIZE)throw{message:mxResources.get("drawingTooLarge")};f="0";"pdf"==b&&0==l&&(q="&allPages=1");if("xmlpng"==b&&(f="1",b="png",null!=this.pages&&null!=this.currentPage))for(l=0;l<this.pages.length;l++)if(this.pages[l]==this.currentPage){g=
|
|
|
|
|
"&from="+l;break}l=c.background;"png"==b&&n?l=mxConstants.NONE:n||null!=l&&l!=mxConstants.NONE||(l="#ffffff");n={globalVars:c.getExportVariables()};t&&(n.grid={size:c.gridSize,steps:c.view.gridSteps,color:c.view.gridColor});return new mxXmlRequest(EXPORT_URL,"format="+b+g+q+"&bg="+(null!=l?l:mxConstants.NONE)+"&base64="+e+"&embedXml="+f+"&xml="+encodeURIComponent(d)+(null!=a?"&filename="+encodeURIComponent(a):"")+"&extras="+encodeURIComponent(JSON.stringify(n))+(null!=x?"&scale="+x:"")+(null!=k?"&border="+
|
|
|
|
|
function(a,b,d,e,n,l,y,k,t,m){try{e=null!=e?e:this.editor.graph.isSelectionEmpty();var c=this.getBaseFilename(!n),f=c+"."+a;if("xml"==a){var g='<?xml version="1.0" encoding="UTF-8"?>\n'+this.getFileData(!0,null,null,null,e,n,null,null,null,b);this.saveData(f,a,g,"text/xml")}else if("html"==a)g=this.getHtml2(this.getFileData(!0),this.editor.graph,c),this.saveData(f,a,g,"text/html");else if("svg"!=a&&"xmlsvg"!=a||!this.spinner.spin(document.body,mxResources.get("export")))"xmlpng"==a?f=c+".png":"jpeg"==
|
|
|
|
|
a&&(f=c+".jpg"),this.saveRequest(f,a,mxUtils.bind(this,function(c,b){try{var f=this.editor.graph.pageVisible;null!=l&&(this.editor.graph.pageVisible=l);var d=this.createDownloadRequest(c,a,e,b,y,n,k,t,m);this.editor.graph.pageVisible=f;return d}catch(Q){this.handleError(Q)}}));else{var q=null,C=mxUtils.bind(this,function(a){a.length<=MAX_REQUEST_SIZE?this.saveData(f,"svg",a,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(q)}))});
|
|
|
|
|
if("svg"==a){var p=this.editor.graph.background;if(y||p==mxConstants.NONE)p=null;var E=this.editor.graph.getSvg(p,null,null,null,null,e);d&&this.editor.graph.addSvgShadow(E);this.convertImages(E,mxUtils.bind(this,mxUtils.bind(this,function(a){this.spinner.stop();C('<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(a))})))}else f=c+".svg",q=this.getFileData(!1,!0,null,mxUtils.bind(this,function(a){this.spinner.stop();
|
|
|
|
|
C(a)}),e)}}catch(P){this.handleError(P)}};EditorUi.prototype.createDownloadRequest=function(a,b,d,e,n,l,y,k,t){var c=this.editor.graph,f=c.getGraphBounds();d=this.getFileData(!0,null,null,null,d,0==l?!1:"xmlpng"!=b);var g="",q="";if(f.width*f.height>MAX_AREA||d.length>MAX_REQUEST_SIZE)throw{message:mxResources.get("drawingTooLarge")};f="0";"pdf"==b&&0==l&&(q="&allPages=1");if("xmlpng"==b&&(f="1",b="png",null!=this.pages&&null!=this.currentPage))for(l=0;l<this.pages.length;l++)if(this.pages[l]==this.currentPage){g=
|
|
|
|
|
"&from="+l;break}l=c.background;"png"==b&&n?l=mxConstants.NONE:n||null!=l&&l!=mxConstants.NONE||(l="#ffffff");n={globalVars:c.getExportVariables()};t&&(n.grid={size:c.gridSize,steps:c.view.gridSteps,color:c.view.gridColor});return new mxXmlRequest(EXPORT_URL,"format="+b+g+q+"&bg="+(null!=l?l:mxConstants.NONE)+"&base64="+e+"&embedXml="+f+"&xml="+encodeURIComponent(d)+(null!=a?"&filename="+encodeURIComponent(a):"")+"&extras="+encodeURIComponent(JSON.stringify(n))+(null!=y?"&scale="+y:"")+(null!=k?"&border="+
|
|
|
|
|
k:""))};EditorUi.prototype.setMode=function(a,b){this.mode=a};EditorUi.prototype.loadDescriptor=function(a,b,d){var c=window.location.hash,f=mxUtils.bind(this,function(f){var d=null!=a.data?a.data:"";null!=f&&0<f.length&&(0<d.length&&(d+="\n"),d+=f);f=new LocalFile(this,"csv"!=a.format&&0<d.length?d:this.emptyDiagramXml,null!=urlParams.title?decodeURIComponent(urlParams.title):this.defaultFilename,!0);f.getHash=function(){return c};this.fileLoaded(f);"csv"==a.format&&this.importCsv(d,mxUtils.bind(this,
|
|
|
|
|
function(a){this.editor.undoManager.clear();this.editor.setModified(!1);this.editor.setStatus("")}));if(null!=a.update){var e=null!=a.interval?parseInt(a.interval):6E4,g=null,l=mxUtils.bind(this,function(){var c=this.currentPage;mxUtils.post(a.update,"xml="+encodeURIComponent(mxUtils.getXml(this.editor.getGraphXml())),mxUtils.bind(this,function(a){c===this.currentPage&&(200<=a.getStatus()&&300>=a.getStatus()?(this.updateDiagram(a.getText()),n()):this.handleError({message:mxResources.get("error")+
|
|
|
|
|
" "+a.getStatus()}))}),mxUtils.bind(this,function(a){this.handleError(a)}))}),n=mxUtils.bind(this,function(){window.clearTimeout(g);g=window.setTimeout(l,e)});this.editor.addListener("pageSelected",mxUtils.bind(this,function(){n();l()}));n();l()}null!=b&&b()});if(null!=a.url&&0<a.url.length){var e=a.url;/^https?:\/\//.test(e)&&!this.editor.isCorsEnabledForUrl(e)&&(e=PROXY_URL+"?url="+encodeURIComponent(e));this.loadUrl(e,mxUtils.bind(this,function(a){f(a)}),mxUtils.bind(this,function(a){null!=d&&
|
|
|
|
|
d(a)}))}else f("")};EditorUi.prototype.updateDiagram=function(a){function c(a){var c=new mxCellOverlay(a.image||e.warningImage,a.tooltip,a.align,a.valign,a.offset);c.addListener(mxEvent.CLICK,function(c,b){d.alert(a.tooltip)});return c}var b=null,d=this;if(null!=a&&0<a.length&&(b=mxUtils.parseXml(a),a=null!=b?b.documentElement:null,null!=a&&"updates"==a.nodeName)){var e=this.editor.graph,l=e.getModel();l.beginUpdate();var x=null;try{for(a=a.firstChild;null!=a;){if("update"==a.nodeName){var k=l.getCell(a.getAttribute("id"));
|
|
|
|
|
if(null!=k){try{var t=a.getAttribute("value");if(null!=t){var m=mxUtils.parseXml(t).documentElement;if(null!=m)if("1"==m.getAttribute("replace-value"))l.setValue(k,m);else for(var y=m.attributes,p=0;p<y.length;p++)e.setAttributeForCell(k,y[p].nodeName,0<y[p].nodeValue.length?y[p].nodeValue:null)}}catch(K){null!=window.console&&console.log("Error in value for "+k.id+": "+K)}try{var u=a.getAttribute("style");null!=u&&e.model.setStyle(k,u)}catch(K){null!=window.console&&console.log("Error in style for "+
|
|
|
|
|
d(a)}))}else f("")};EditorUi.prototype.updateDiagram=function(a){function c(a){var c=new mxCellOverlay(a.image||e.warningImage,a.tooltip,a.align,a.valign,a.offset);c.addListener(mxEvent.CLICK,function(c,b){d.alert(a.tooltip)});return c}var b=null,d=this;if(null!=a&&0<a.length&&(b=mxUtils.parseXml(a),a=null!=b?b.documentElement:null,null!=a&&"updates"==a.nodeName)){var e=this.editor.graph,l=e.getModel();l.beginUpdate();var y=null;try{for(a=a.firstChild;null!=a;){if("update"==a.nodeName){var k=l.getCell(a.getAttribute("id"));
|
|
|
|
|
if(null!=k){try{var t=a.getAttribute("value");if(null!=t){var m=mxUtils.parseXml(t).documentElement;if(null!=m)if("1"==m.getAttribute("replace-value"))l.setValue(k,m);else for(var x=m.attributes,p=0;p<x.length;p++)e.setAttributeForCell(k,x[p].nodeName,0<x[p].nodeValue.length?x[p].nodeValue:null)}}catch(K){null!=window.console&&console.log("Error in value for "+k.id+": "+K)}try{var u=a.getAttribute("style");null!=u&&e.model.setStyle(k,u)}catch(K){null!=window.console&&console.log("Error in style for "+
|
|
|
|
|
k.id+": "+K)}try{var A=a.getAttribute("icon");if(null!=A){var v=0<A.length?JSON.parse(A):null;null!=v&&v.append||e.removeCellOverlays(k);null!=v&&e.addCellOverlay(k,c(v))}}catch(K){null!=window.console&&console.log("Error in icon for "+k.id+": "+K)}try{var z=a.getAttribute("geometry");if(null!=z){var z=JSON.parse(z),H=e.getCellGeometry(k);if(null!=H){H=H.clone();for(key in z){var B=parseFloat(z[key]);"dx"==key?H.x+=B:"dy"==key?H.y+=B:"dw"==key?H.width+=B:"dh"==key?H.height+=B:H[key]=parseFloat(z[key])}e.model.setGeometry(k,
|
|
|
|
|
H)}}}catch(K){null!=window.console&&console.log("Error in icon for "+k.id+": "+K)}}}else if("model"==a.nodeName){for(var D=a.firstChild;null!=D&&D.nodeType!=mxConstants.NODETYPE_ELEMENT;)D=D.nextSibling;null!=D&&(new mxCodec(a.firstChild)).decode(D,l)}else if("view"==a.nodeName){if(a.hasAttribute("scale")&&(e.view.scale=parseFloat(a.getAttribute("scale"))),a.hasAttribute("dx")||a.hasAttribute("dy"))e.view.translate=new mxPoint(parseFloat(a.getAttribute("dx")||0),parseFloat(a.getAttribute("dy")||0))}else"fit"==
|
|
|
|
|
a.nodeName&&(x=a.hasAttribute("max-scale")?parseFloat(a.getAttribute("max-scale")):1);a=a.nextSibling}}finally{l.endUpdate()}null!=x&&this.chromelessResize&&this.chromelessResize(!0,x)}return b};EditorUi.prototype.getCopyFilename=function(a,b){var c=null!=a&&null!=a.getTitle()?a.getTitle():this.defaultFilename,f="",d=c.lastIndexOf(".");0<=d&&(f=c.substring(d),c=c.substring(0,d));if(b)var e=new Date,d=e.getFullYear(),k=e.getMonth()+1,C=e.getDate(),t=e.getHours(),m=e.getMinutes(),e=e.getSeconds(),c=
|
|
|
|
|
a.nodeName&&(y=a.hasAttribute("max-scale")?parseFloat(a.getAttribute("max-scale")):1);a=a.nextSibling}}finally{l.endUpdate()}null!=y&&this.chromelessResize&&this.chromelessResize(!0,y)}return b};EditorUi.prototype.getCopyFilename=function(a,b){var c=null!=a&&null!=a.getTitle()?a.getTitle():this.defaultFilename,f="",d=c.lastIndexOf(".");0<=d&&(f=c.substring(d),c=c.substring(0,d));if(b)var e=new Date,d=e.getFullYear(),k=e.getMonth()+1,C=e.getDate(),t=e.getHours(),m=e.getMinutes(),e=e.getSeconds(),c=
|
|
|
|
|
c+(" "+(d+"-"+k+"-"+C+"-"+t+"-"+m+"-"+e));return c=mxResources.get("copyOf",[c])+f};EditorUi.prototype.fileLoaded=function(a,b){var c=this.getCurrentFile();this.fileLoadedError=null;this.setCurrentFile(null);var f=!1;this.hideDialog();null!=c&&(c.removeListener(this.descriptorChangedListener),c.close());this.editor.graph.model.clear();this.editor.undoManager.clear();var d=mxUtils.bind(this,function(){this.setGraphEnabled(!1);this.setCurrentFile(null);null!=c&&this.updateDocumentTitle();this.editor.graph.model.clear();
|
|
|
|
|
this.editor.undoManager.clear();this.setBackgroundImage(null);!b&&null!=window.location.hash&&0<window.location.hash.length&&(window.location.hash="");null!=this.fname&&(this.fnameWrapper.style.display="none",this.fname.innerHTML="",this.fname.setAttribute("title",mxResources.get("rename")));this.editor.setStatus("");this.updateUi();b||this.showSplash()});if(null!=a)try{mxClient.IS_SF&&"min"==uiTheme&&(this.diagramContainer.style.visibility="");this.openingFile=!0;this.setCurrentFile(a);a.addListener("descriptorChanged",
|
|
|
|
|
this.descriptorChangedListener);a.addListener("contentChanged",this.descriptorChangedListener);a.open();delete this.openingFile;this.setGraphEnabled(!0);this.setMode(a.getMode());this.editor.graph.model.prefix=Editor.guid()+"-";this.editor.undoManager.clear();this.descriptorChanged();this.updateUi();a.isEditable()?a.isModified()?(a.addUnsavedStatus(),null!=a.backupPatch&&a.patch([a.backupPatch])):this.editor.setStatus(""):this.editor.setStatus('<span class="geStatusAlert" style="margin-left:8px;">'+
|
|
|
|
|
mxUtils.htmlEntities(mxResources.get("readOnly"))+"</span>");!this.editor.isChromelessView()||this.editor.editable?(this.editor.graph.selectUnlockedLayer(),this.showLayersDialog(),this.restoreLibraries(),window.self!==window.top&&window.focus()):this.editor.graph.isLightboxView()&&this.lightboxFit();this.chromelessResize&&this.chromelessResize();this.editor.fireEvent(new mxEventObject("fileLoaded"));f=!0;this.isOffline()||null==a.getMode()||EditorUi.logEvent({category:a.getMode().toUpperCase()+"-OPEN-FILE-"+
|
|
|
|
|
a.getHash(),action:"size_"+a.getSize(),label:"autosave_"+(this.editor.autosave?"on":"off")});if(this.editor.editable&&this.mode==a.getMode()&&a.getMode()!=App.MODE_DEVICE&&null!=a.getMode())try{this.addRecent({id:a.getHash(),title:a.getTitle(),mode:a.getMode()})}catch(x){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+1),mxSettings.save()}catch(x){}}catch(x){this.fileLoadedError=x;null!=window.console&&(console.error(x),console.log("error in fileLoaded:",a,x));if(EditorUi.enableLogging&&
|
|
|
|
|
!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=x&&null!=x.message?":err:"+encodeURIComponent(x.message):"")+(null!=x&&null!=x.stack?"&stack="+encodeURIComponent(x.stack):"")}catch(C){}var e=mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):
|
|
|
|
|
null!=c?this.fileLoaded(c):d()});b?e():this.handleError(x,mxResources.get("errorLoadingFile"),e,!0)}else d();return f};EditorUi.prototype.getHashValueForPages=function(a,b){var c=0,f=new mxGraphModel,d=new mxCodec;null!=b&&(b.byteCount=0,b.attrCount=0,b.eltCount=0,b.nodeCount=0);for(var e=0;e<a.length;e++){this.updatePageRoot(a[e]);var k=a[e].node.cloneNode(!1);k.removeAttribute("name");f.root=a[e].root;var C=d.encode(f);this.editor.graph.saveViewState(a[e].viewState,C,!0);C.removeAttribute("pageWidth");
|
|
|
|
|
a.getHash(),action:"size_"+a.getSize(),label:"autosave_"+(this.editor.autosave?"on":"off")});if(this.editor.editable&&this.mode==a.getMode()&&a.getMode()!=App.MODE_DEVICE&&null!=a.getMode())try{this.addRecent({id:a.getHash(),title:a.getTitle(),mode:a.getMode()})}catch(y){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+1),mxSettings.save()}catch(y){}}catch(y){this.fileLoadedError=y;null!=window.console&&(console.error(y),console.log("error in fileLoaded:",a,y));if(EditorUi.enableLogging&&
|
|
|
|
|
!this.isOffline())try{(new Image).src=(null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"")+"/log?v="+encodeURIComponent(EditorUi.VERSION)+"&msg=errorInFileLoaded:url:"+encodeURIComponent(window.location.href)+(null!=y&&null!=y.message?":err:"+encodeURIComponent(y.message):"")+(null!=y&&null!=y.stack?"&stack="+encodeURIComponent(y.stack):"")}catch(C){}var e=mxUtils.bind(this,function(){null!=urlParams.url&&this.spinner.spin(document.body,mxResources.get("reconnecting"))?window.location.search=this.getSearch(["url"]):
|
|
|
|
|
null!=c?this.fileLoaded(c):d()});b?e():this.handleError(y,mxResources.get("errorLoadingFile"),e,!0)}else d();return f};EditorUi.prototype.getHashValueForPages=function(a,b){var c=0,f=new mxGraphModel,d=new mxCodec;null!=b&&(b.byteCount=0,b.attrCount=0,b.eltCount=0,b.nodeCount=0);for(var e=0;e<a.length;e++){this.updatePageRoot(a[e]);var k=a[e].node.cloneNode(!1);k.removeAttribute("name");f.root=a[e].root;var C=d.encode(f);this.editor.graph.saveViewState(a[e].viewState,C,!0);C.removeAttribute("pageWidth");
|
|
|
|
|
C.removeAttribute("pageHeight");k.appendChild(C);null!=b&&(b.eltCount+=k.getElementsByTagName("*").length,b.nodeCount+=k.getElementsByTagName("mxCell").length);c=(c<<5)-c+this.hashValue(k,function(a,c,b,f){return!f||"mxGeometry"!=a.nodeName&&"mxPoint"!=a.nodeName||"x"!=c&&"y"!=c&&"width"!=c&&"height"!=c?f&&"mxCell"==a.nodeName&&"previous"==c?null:b:Math.round(b)},b)<<0}return c};EditorUi.prototype.hashValue=function(a,b,d){var c=0;if(null!=a&&"object"===typeof a&&"number"===typeof a.nodeType&&"string"===
|
|
|
|
|
typeof a.nodeName&&"function"===typeof a.getAttribute){null!=a.nodeName&&(c^=this.hashValue(a.nodeName,b,d));if(null!=a.attributes){null!=d&&(d.attrCount+=a.attributes.length);for(var f=0;f<a.attributes.length;f++){var e=a.attributes[f].name,g=null!=b?b(a,e,a.attributes[f].value,!0):a.attributes[f].value;null!=g&&(c^=this.hashValue(e,b,d)+this.hashValue(g,b,d))}}if(null!=a.childNodes)for(f=0;f<a.childNodes.length;f++)c=(c<<5)-c+this.hashValue(a.childNodes[f],b,d)<<0}else if(null!=a&&"function"!==
|
|
|
|
|
typeof a){a=String(a);b=0;null!=d&&(d.byteCount+=a.length);for(f=0;f<a.length;f++)b=(b<<5)-b+a.charCodeAt(f)<<0;c^=b}return c};EditorUi.prototype.descriptorChanged=function(){};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(a,b,d,e,n,l,k){};EditorUi.prototype.isScratchpadEnabled=function(){return isLocalStorage||mxClient.IS_CHROMEAPP};EditorUi.prototype.toggleScratchpad=function(){this.isScratchpadEnabled()&&(null==this.scratchpad?this.getLocalData(".scratchpad",
|
|
|
|
@ -3026,17 +3027,17 @@ mxUtils.bind(this,function(a){null==a&&(a=this.emptyLibraryXml);this.loadLibrary
|
|
|
|
|
var b=c.lastChild,d=b.previousSibling;c.insertBefore(b,a);c.insertBefore(d,b)};EditorUi.prototype.loadLibrary=function(a){var c=mxUtils.parseXml(a.getData());if("mxlibrary"==c.documentElement.nodeName){var b=JSON.parse(mxUtils.getTextContent(c.documentElement));this.libraryLoaded(a,b,c.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};EditorUi.prototype.getLibraryStorageHint=function(a){return""};EditorUi.prototype.libraryLoaded=function(a,b,d){if(null!=
|
|
|
|
|
this.sidebar){a.constructor!=LocalLibrary&&mxSettings.addCustomLibrary(a.getHash());".scratchpad"==a.title&&(this.scratchpad=a);var c=this.sidebar.palettes[a.getHash()],c=null!=c?c[c.length-1].nextSibling:null;this.removeLibrarySidebar(a.getHash());var f=null,e=mxUtils.bind(this,function(c,b){0==c.length&&a.isEditable()?(null==f&&(f=document.createElement("div"),f.className="geDropTarget",mxUtils.write(f,mxResources.get("dragElementsHere"))),b.appendChild(f)):this.addLibraryEntries(c,b)});null!=this.sidebar&&
|
|
|
|
|
null!=b&&this.sidebar.addEntries(b);d=null!=d&&0<d.length?d:a.getTitle();var g=this.sidebar.addPalette(a.getHash(),d,!0,mxUtils.bind(this,function(a){e(b,a)}));this.repositionLibrary(c);var k=g.parentNode.previousSibling;d=k.getAttribute("title");null!=d&&0<d.length&&".scratchpad"!=a.title&&k.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+d);var t=document.createElement("div");t.style.position="absolute";t.style.right="0px";t.style.top="0px";t.style.padding="8px";mxClient.IS_QUIRKS||8==document.documentMode||
|
|
|
|
|
(t.style.backgroundColor="inherit");k.style.position="relative";var m=document.createElement("img");m.setAttribute("src",Dialog.prototype.closeImage);m.setAttribute("title",mxResources.get("close"));m.setAttribute("valign","absmiddle");m.setAttribute("border","0");m.style.margin="0 3px";var y=null;if(".scratchpad"!=a.title||this.closableScratchpad)t.appendChild(m),mxEvent.addListener(m,"click",mxUtils.bind(this,function(c){if(!mxEvent.isConsumed(c)){var b=mxUtils.bind(this,function(){this.closeLibrary(a)});
|
|
|
|
|
null!=y?this.confirm(mxResources.get("allChangesLost"),null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b();mxEvent.consume(c)}}));if(a.isEditable()){var p=this.editor.graph,u=null,A=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),g,b,a,a.getMode());mxEvent.consume(c)}),v=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=u&&null!=u.parentNode&&u.parentNode.removeChild(u),u=m.cloneNode(!1),u.setAttribute("src",Editor.spinImage),u.setAttribute("title",
|
|
|
|
|
mxResources.get("saving")),u.style.cursor="default",u.style.marginRight="2px",u.style.marginTop="-2px",t.insertBefore(u,t.firstChild),k.style.paddingRight=18*t.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=u&&null!=u.parentNode&&(u.parentNode.removeChild(u),k.style.paddingRight=18*t.childNodes.length+"px")})):null==y&&(y=m.cloneNode(!1),y.setAttribute("src",IMAGE_PATH+"/download.png"),y.setAttribute("title",mxResources.get("save")),t.insertBefore(y,t.firstChild),
|
|
|
|
|
mxEvent.addListener(y,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==y||a.isModified()||(k.style.paddingRight=18*t.childNodes.length+"px",y.parentNode.removeChild(y),y=null)});mxEvent.consume(c)})),k.style.paddingRight=18*t.childNodes.length+"px")}),z=mxUtils.bind(this,function(a,c,d,e){a=p.cloneCells(mxUtils.sortCells(p.model.getTopmostCells(a)));for(var l=0;l<a.length;l++){var n=p.getCellGeometry(a[l]);null!=n&&
|
|
|
|
|
(t.style.backgroundColor="inherit");k.style.position="relative";var m=document.createElement("img");m.setAttribute("src",Dialog.prototype.closeImage);m.setAttribute("title",mxResources.get("close"));m.setAttribute("valign","absmiddle");m.setAttribute("border","0");m.style.margin="0 3px";var x=null;if(".scratchpad"!=a.title||this.closableScratchpad)t.appendChild(m),mxEvent.addListener(m,"click",mxUtils.bind(this,function(c){if(!mxEvent.isConsumed(c)){var b=mxUtils.bind(this,function(){this.closeLibrary(a)});
|
|
|
|
|
null!=x?this.confirm(mxResources.get("allChangesLost"),null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b();mxEvent.consume(c)}}));if(a.isEditable()){var p=this.editor.graph,u=null,A=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),g,b,a,a.getMode());mxEvent.consume(c)}),v=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=u&&null!=u.parentNode&&u.parentNode.removeChild(u),u=m.cloneNode(!1),u.setAttribute("src",Editor.spinImage),u.setAttribute("title",
|
|
|
|
|
mxResources.get("saving")),u.style.cursor="default",u.style.marginRight="2px",u.style.marginTop="-2px",t.insertBefore(u,t.firstChild),k.style.paddingRight=18*t.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=u&&null!=u.parentNode&&(u.parentNode.removeChild(u),k.style.paddingRight=18*t.childNodes.length+"px")})):null==x&&(x=m.cloneNode(!1),x.setAttribute("src",IMAGE_PATH+"/download.png"),x.setAttribute("title",mxResources.get("save")),t.insertBefore(x,t.firstChild),
|
|
|
|
|
mxEvent.addListener(x,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==x||a.isModified()||(k.style.paddingRight=18*t.childNodes.length+"px",x.parentNode.removeChild(x),x=null)});mxEvent.consume(c)})),k.style.paddingRight=18*t.childNodes.length+"px")}),z=mxUtils.bind(this,function(a,c,d,e){a=p.cloneCells(mxUtils.sortCells(p.model.getTopmostCells(a)));for(var l=0;l<a.length;l++){var n=p.getCellGeometry(a[l]);null!=n&&
|
|
|
|
|
n.translate(-c.x,-c.y)}g.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,e||"",!0,!1,!1));a={xml:Graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),w:c.width,h:c.height};null!=e&&(a.title=e);b.push(a);v(d);null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)}),H=mxUtils.bind(this,function(a){if(p.isSelectionEmpty())p.getRubberband().isActive()?(p.getRubberband().execute(a),p.getRubberband().reset()):this.showError(mxResources.get("error"),
|
|
|
|
|
mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var c=p.getSelectionCells(),b=p.view.getBounds(c),d=p.view.scale;b.x/=d;b.y/=d;b.width/=d;b.height/=d;b.x-=p.view.translate.x;b.y-=p.view.translate.y;z(c,b)}mxEvent.consume(a)});mxEvent.addGestureListeners(g,function(){},mxUtils.bind(this,function(a){p.isMouseDown&&null!=p.panningManager&&null!=p.graphHandler.shape&&(p.graphHandler.shape.node.style.visibility="hidden",g.style.backgroundColor="#f1f3f4",g.style.cursor="copy",p.panningManager.stop(),
|
|
|
|
|
p.autoScroll=!1,null!=p.graphHandler.guide&&p.graphHandler.guide.setVisible(!1),null!=p.graphHandler.hint&&(p.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,function(a){p.isMouseDown&&null!=p.panningManager&&null!=p.graphHandler&&(g.style.backgroundColor="",g.style.cursor="default",this.sidebar.showTooltips=!0,p.panningManager.stop(),p.graphHandler.reset(),p.isMouseDown=!1,p.autoScroll=!0,H(a),mxEvent.consume(a))}));mxEvent.addListener(g,"mouseleave",mxUtils.bind(this,
|
|
|
|
|
function(a){p.isMouseDown&&null!=p.graphHandler.shape&&(p.graphHandler.shape.node.style.visibility="visible",g.style.backgroundColor="",g.style.cursor="",p.autoScroll=!0,null!=p.graphHandler.guide&&p.graphHandler.guide.setVisible(!0),null!=p.graphHandler.hint&&(p.graphHandler.hint.style.visibility="visible"))}));Graph.fileSupport&&(mxEvent.addListener(g,"dragover",mxUtils.bind(this,function(a){g.style.backgroundColor="#f1f3f4";a.dataTransfer.dropEffect="copy";g.style.cursor="copy";this.sidebar.hideTooltip();
|
|
|
|
|
a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"drop",mxUtils.bind(this,function(a){g.style.cursor="";g.style.backgroundColor="";0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,l,n,q,t,k,x,u){if(null!=c&&"image/"==d.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",new mxGeometry(0,0,q,t),c)],c[0].vertex=!0,z(c,new mxRectangle(0,
|
|
|
|
|
0,q,t),a,mxEvent.isAltDown(a)?null:k.substring(0,k.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var y=!1,C=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var l=mxUtils.parseXml(c);if("mxlibrary"==l.documentElement.nodeName)try{var n=JSON.parse(mxUtils.getTextContent(l.documentElement));e(n,g);b=b.concat(n);v(a);this.spinner.stop();y=!0}catch(L){}else if("mxfile"==l.documentElement.nodeName)try{for(var q=l.documentElement.getElementsByTagName("diagram"),
|
|
|
|
|
l=0;l<q.length;l++){var t=this.stringToCells(Editor.getDiagramNodeXml(q[l])),k=this.editor.graph.getBoundingBoxFromGeometry(t);z(t,new mxRectangle(0,0,k.width,k.height),a)}y=!0}catch(L){null!=window.console&&console.log("error in drop handler:",L)}}y||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)});null!=u&&null!=k&&(/(\.v(dx|sdx?))($|\?)/i.test(k)||/(\.vs(x|sx?))($|\?)/i.test(k))?
|
|
|
|
|
a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"drop",mxUtils.bind(this,function(a){g.style.cursor="";g.style.backgroundColor="";0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,l,n,q,t,k,y,u){if(null!=c&&"image/"==d.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+this.convertDataUri(c),c=[new mxCell("",new mxGeometry(0,0,q,t),c)],c[0].vertex=!0,z(c,new mxRectangle(0,
|
|
|
|
|
0,q,t),a,mxEvent.isAltDown(a)?null:k.substring(0,k.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var x=!1,C=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var l=mxUtils.parseXml(c);if("mxlibrary"==l.documentElement.nodeName)try{var n=JSON.parse(mxUtils.getTextContent(l.documentElement));e(n,g);b=b.concat(n);v(a);this.spinner.stop();x=!0}catch(L){}else if("mxfile"==l.documentElement.nodeName)try{for(var q=l.documentElement.getElementsByTagName("diagram"),
|
|
|
|
|
l=0;l<q.length;l++){var t=this.stringToCells(Editor.getDiagramNodeXml(q[l])),k=this.editor.graph.getBoundingBoxFromGeometry(t);z(t,new mxRectangle(0,0,k.width,k.height),a)}x=!0}catch(L){null!=window.console&&console.log("error in drop handler:",L)}}x||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)});null!=u&&null!=k&&(/(\.v(dx|sdx?))($|\?)/i.test(k)||/(\.vs(x|sx?))($|\?)/i.test(k))?
|
|
|
|
|
this.importVisio(u,function(a){C(a,"text/xml")},null,k):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,k)&&null!=u?this.parseFile(u,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?C(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):C(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"dragleave",
|
|
|
|
|
function(a){g.style.cursor="";g.style.backgroundColor="";a.stopPropagation();a.preventDefault()}));m=m.cloneNode(!1);m.setAttribute("src",Editor.editImage);m.setAttribute("title",mxResources.get("edit"));t.insertBefore(m,t.firstChild);mxEvent.addListener(m,"click",A);mxEvent.addListener(g,"dblclick",function(a){mxEvent.getSource(a)==g&&A(a)});d=m.cloneNode(!1);d.setAttribute("src",Editor.plusImage);d.setAttribute("title",mxResources.get("add"));t.insertBefore(d,t.firstChild);mxEvent.addListener(d,
|
|
|
|
|
"click",H);this.isOffline()||".scratchpad"!=a.title||null==EditorUi.scratchpadHelpLink||(d=document.createElement("span"),d.setAttribute("title",mxResources.get("help")),d.style.cssText="color:#a3a3a3;text-decoration:none;margin-right:2px;",mxUtils.write(d,"?"),mxEvent.addGestureListeners(d,mxUtils.bind(this,function(a){this.openLink(EditorUi.scratchpadHelpLink);mxEvent.consume(a)})),t.insertBefore(d,t.firstChild))}k.appendChild(t);k.style.paddingRight=18*t.childNodes.length+"px"}};EditorUi.prototype.addLibraryEntries=
|
|
|
|
@ -3050,8 +3051,8 @@ Editor.checkmarkImage="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAM
|
|
|
|
|
b.apply(this,arguments);this.editor.graph.addListener("viewStateChanged",mxUtils.bind(this,function(a){this.editor.graph.isSelectionEmpty()&&c.refresh()}));return c};EditorUi.prototype.createSidebarFooterContainer=function(){var a=this.createDiv("geSidebarContainer geSidebarFooter");a.style.position="absolute";a.style.overflow="hidden";var b=document.createElement("a");b.className="geTitle";b.style.color="#DF6C0C";b.style.fontWeight="bold";b.style.height="100%";b.style.paddingTop="9px";b.innerHTML=
|
|
|
|
|
'<span style="font-size:18px;margin-right:5px;">+</span>';mxUtils.write(b,mxResources.get("moreShapes")+"...");mxEvent.addListener(b,mxClient.IS_POINTER?"pointerdown":"mousedown",mxUtils.bind(this,function(a){a.preventDefault()}));mxEvent.addListener(b,"click",mxUtils.bind(this,function(a){this.actions.get("shapes").funct();mxEvent.consume(a)}));a.appendChild(b);return a};EditorUi.prototype.handleError=function(a,b,d,e,n){var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},
|
|
|
|
|
f=null!=a&&null!=a.error?a.error:a;if(null!=f||null!=b){var g=mxUtils.htmlEntities(mxResources.get("unknownError")),q=mxResources.get("ok"),k=null;b=null!=b?b:mxResources.get("error");if(null!=f)if(null!=f.retry&&(q=mxResources.get("cancel"),k=function(){c();f.retry()}),404==f.code||404==f.status||403==f.code){var g=403==f.code?null!=f.message?mxUtils.htmlEntities(f.message):mxUtils.htmlEntities(mxResources.get("accessDenied")):null!=n?n:mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied")+
|
|
|
|
|
(null!=this.drive&&null!=this.drive.user?" ("+this.drive.user.displayName+", "+this.drive.user.email+")":"")),y=window.location.hash;if(null!=y&&("#G"==y.substring(0,2)||"#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D"==y.substring(0,45))&&(null!=a&&null!=a.error&&(null!=a.error.errors&&0<a.error.errors.length&&"fileAccess"==a.error.errors[0].reason||null!=a.error.data&&0<a.error.data.length&&"fileAccess"==a.error.data[0].reason)||404==f.code||404==f.status)){y="#U"==y.substring(0,2)?y.substring(45,
|
|
|
|
|
y.lastIndexOf("%26ex")):y.substring(2);this.showError(b,g,mxResources.get("openInNewWindow"),mxUtils.bind(this,function(){this.editor.graph.openLink("https://drive.google.com/open?id="+y);this.handleError(a,b,d,e,n)}),k,mxResources.get("changeUser"),mxUtils.bind(this,function(){function a(){f.innerHTML="";for(var a=0;a<c.length;a++){var b=document.createElement("option");mxUtils.write(b,c[a].displayName);b.value=a;f.appendChild(b);b=document.createElement("option");b.innerHTML=" ";
|
|
|
|
|
(null!=this.drive&&null!=this.drive.user?" ("+this.drive.user.displayName+", "+this.drive.user.email+")":"")),x=window.location.hash;if(null!=x&&("#G"==x.substring(0,2)||"#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D"==x.substring(0,45))&&(null!=a&&null!=a.error&&(null!=a.error.errors&&0<a.error.errors.length&&"fileAccess"==a.error.errors[0].reason||null!=a.error.data&&0<a.error.data.length&&"fileAccess"==a.error.data[0].reason)||404==f.code||404==f.status)){x="#U"==x.substring(0,2)?x.substring(45,
|
|
|
|
|
x.lastIndexOf("%26ex")):x.substring(2);this.showError(b,g,mxResources.get("openInNewWindow"),mxUtils.bind(this,function(){this.editor.graph.openLink("https://drive.google.com/open?id="+x);this.handleError(a,b,d,e,n)}),k,mxResources.get("changeUser"),mxUtils.bind(this,function(){function a(){f.innerHTML="";for(var a=0;a<c.length;a++){var b=document.createElement("option");mxUtils.write(b,c[a].displayName);b.value=a;f.appendChild(b);b=document.createElement("option");b.innerHTML=" ";
|
|
|
|
|
mxUtils.write(b,"<"+c[a].email+">");b.setAttribute("disabled","disabled");f.appendChild(b)}b=document.createElement("option");mxUtils.write(b,mxResources.get("addAccount"));b.value=c.length;f.appendChild(b)}var c=this.drive.getUsersList(),b=document.createElement("div"),d=document.createElement("span");d.style.marginTop="6px";mxUtils.write(d,mxResources.get("changeUser")+": ");b.appendChild(d);var f=document.createElement("select");f.style.width="200px";a();mxEvent.addListener(f,"change",mxUtils.bind(this,
|
|
|
|
|
function(){var b=f.value,d=c.length!=b;d&&this.drive.setUser(c[b]);this.drive.authorize(d,mxUtils.bind(this,function(){d||(c=this.drive.getUsersList(),a())}),mxUtils.bind(this,function(a){this.handleError(a)}),!0)}));b.appendChild(f);b=new CustomDialog(this,b,mxUtils.bind(this,function(){this.loadFile(window.location.hash.substr(1),!0)}));this.showDialog(b.container,300,75,!0,!0)}),mxResources.get("cancel"),mxUtils.bind(this,function(){window.location.hash=""}),480,150);return}}else null!=f.message?
|
|
|
|
|
g=mxUtils.htmlEntities(f.message):null!=f.response&&null!=f.response.error?g=mxUtils.htmlEntities(f.response.error):"undefined"!==typeof window.App&&(f.code==App.ERROR_TIMEOUT?g=mxUtils.htmlEntities(mxResources.get("timeout")):f.code==App.ERROR_BUSY&&(g=mxUtils.htmlEntities(mxResources.get("busy"))));var m=null,u=null;null!=f&&null!=f.helpLink&&(m=mxResources.get("help"),u=mxUtils.bind(this,function(){return this.editor.graph.openLink(f.helpLink)}));this.showError(b,g,q,d,k,null,null,m,u,null,null,
|
|
|
|
@ -3061,7 +3062,7 @@ a.toDataURL("image/"+d);if(6>=c.length||c==a.cloneNode(!1).toDataURL("image/"+d)
|
|
|
|
|
urlParams.save&&(mxClient.IS_IE||"undefined"!==typeof window.Blob&&"undefined"!==typeof window.URL)&&9!=document.documentMode&&8!=document.documentMode&&7!=document.documentMode&&!mxClient.IS_QUIRKS||this.isOfflineApp()||mxClient.IS_IOS};EditorUi.prototype.showTextDialog=function(a,b){var c=new TextareaDialog(this,a,b,null,null,mxResources.get("close"));c.textarea.style.width="600px";c.textarea.style.height="380px";this.showDialog(c.container,620,460,!0,!0,null,null,null,null,!0);c.init();document.execCommand("selectall",
|
|
|
|
|
!1,null)};EditorUi.prototype.doSaveLocalFile=function(a,b,d,e,n){if(window.Blob&&navigator.msSaveOrOpenBlob)a=e?this.base64ToBlob(a,d):new Blob([a],{type:d}),navigator.msSaveOrOpenBlob(a,b);else if(mxClient.IS_IE)d=window.open("about:blank","_blank"),null==d?mxUtils.popup(a,!0):(d.document.write(a),d.document.close(),d.document.execCommand("SaveAs",!0,b),d.close());else{var c=document.createElement("a"),f=!mxClient.IS_SF&&0>navigator.userAgent.indexOf("PaleMoon/")&&"undefined"!==typeof c.download;
|
|
|
|
|
if(mxClient.IS_GC)var g=navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./),f=65==(g?parseInt(g[2],10):!1)?!1:f;if(f||this.isOffline()){c.href=URL.createObjectURL(e?this.base64ToBlob(a,d):new Blob([a],{type:d}));f?c.download=b:c.setAttribute("target","_blank");document.body.appendChild(c);try{window.setTimeout(function(){URL.revokeObjectURL(c.href)},0),c.click(),c.parentNode.removeChild(c)}catch(t){}}else this.createEchoRequest(a,b,d,e,n).simulate(document,"_blank")}};EditorUi.prototype.createEchoRequest=
|
|
|
|
|
function(a,b,d,e,n,l){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=d?"&mime="+d:"")+(null!=n?"&format="+n:"")+(null!=l?"&base64="+l:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(e?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(a,b){b=b||"";for(var c=atob(a),d=c.length,f=Math.ceil(d/1024),e=Array(f),k=0;k<f;++k){for(var m=1024*k,t=Math.min(m+1024,d),p=Array(t-m),y=0;m<t;++y,++m)p[y]=c[m].charCodeAt(0);e[k]=new Uint8Array(p)}return new Blob(e,{type:b})};
|
|
|
|
|
function(a,b,d,e,n,l){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=d?"&mime="+d:"")+(null!=n?"&format="+n:"")+(null!=l?"&base64="+l:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(e?"&binary=1":""))};EditorUi.prototype.base64ToBlob=function(a,b){b=b||"";for(var c=atob(a),d=c.length,f=Math.ceil(d/1024),e=Array(f),k=0;k<f;++k){for(var m=1024*k,t=Math.min(m+1024,d),p=Array(t-m),x=0;m<t;++x,++m)p[x]=c[m].charCodeAt(0);e[k]=new Uint8Array(p)}return new Blob(e,{type:b})};
|
|
|
|
|
EditorUi.prototype.saveLocalFile=function(a,b,d,e,n,l,k){l=null!=l?l:!1;k=null!=k?k:"vsdx"!=n&&(!mxClient.IS_IOS||!navigator.standalone);n=this.getServiceCount(l);isLocalStorage&&n++;var c=4>=n?2:6<n?4:3;b=new CreateDialog(this,b,mxUtils.bind(this,function(c,b){try{if("_blank"==b)if(null==d||"image/"!=d.substring(0,6)||"image/svg"==d.substring(0,9)&&!mxClient.IS_SVG){var f=window.open("about:blank");null==f?mxUtils.popup(a,!0):(f.document.write("<pre>"+mxUtils.htmlEntities(a,!1)+"<pre>"),f.document.close())}else this.openInNewWindow(a,
|
|
|
|
|
d,e);else b==App.MODE_DEVICE||"download"==b?this.doSaveLocalFile(a,c,d,e):null!=c&&0<c.length&&this.pickFolder(b,mxUtils.bind(this,function(f){try{this.exportFile(a,c,d,e,b,f)}catch(u){this.handleError(u)}}))}catch(F){this.handleError(F)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,l,k,null,1<n,c,a,d,e);l=this.isServices(n)?n>c?390:270:160;this.showDialog(b.container,400,l,!0,!0);b.init()};EditorUi.prototype.openInNewWindow=function(a,
|
|
|
|
|
b,d){if(mxClient.IS_GC||mxClient.IS_EDGE||11==document.documentMode||10==document.documentMode){var c=window.open("about:blank");null==c||null==c.document?mxUtils.popup(a,!0):("image/svg+xml"==b?c.document.write("<html>"+a+"</html>"):c.document.write('<html><img src="data:'+b+(d?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))+'"/></html>'),c.document.close())}else c=window.open("data:"+b+(d?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null!=c&&null!=c.document||mxUtils.popup(a,!0)};
|
|
|
|
@ -3084,14 +3085,14 @@ Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("l
|
|
|
|
|
f.setAttribute("value","self");mxUtils.write(f,mxResources.get("openInThisWindow"));d.appendChild(f);b&&(f=document.createElement("option"),f.setAttribute("value","frame"),mxUtils.write(f,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),d.appendChild(f));a.appendChild(d);mxUtils.write(a,mxResources.get("borderColor")+":");var e="#0000ff",k=null,k=mxUtils.button("",mxUtils.bind(this,function(a){this.pickColor(e||"none",function(a){e=a;c()});mxEvent.consume(a)}));c();k.style.padding=
|
|
|
|
|
mxClient.IS_FF?"4px 2px 4px 2px":"4px";k.style.marginLeft="4px";k.style.height="22px";k.style.width="22px";k.style.position="relative";k.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";k.className="geColorBtn";a.appendChild(k);mxUtils.br(a);return{getColor:function(){return e},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=function(a,b,d,e,n,l,k,m){var c=this.getCurrentFile(),f=[];e&&(f.push("lightbox=1"),"auto"!=a&&f.push("target="+
|
|
|
|
|
a),null!=b&&b!=mxConstants.NONE&&f.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),null!=n&&0<n.length&&f.push("edit="+encodeURIComponent(n)),l&&f.push("layers=1"),this.editor.graph.foldingEnabled&&f.push("nav=1"));d&&null!=this.currentPage&&null!=this.pages&&this.currentPage!=this.pages[0]&&f.push("page-id="+this.currentPage.getId());a=!0;null!=k?d="#U"+encodeURIComponent(k):(c=this.getCurrentFile(),m||null==c||c.constructor!=window.DriveFile?d="#R"+encodeURIComponent(d?this.getFileData(!0,
|
|
|
|
|
null,null,null,null,null,null,!0):Graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(d="#"+c.getHash(),a=!1));a&&null!=c&&null!=c.getTitle()&&c.getTitle()!=this.defaultFilename&&f.push("title="+encodeURIComponent(c.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||!/.*\.draw\.io$/.test(window.location.hostname)?EditorUi.drawHost:"https://"+window.location.host+"/")+(0<f.length?"?"+f.join("&"):"")+d};EditorUi.prototype.createHtml=function(a,b,d,e,n,l,k,m,t,p,y){this.getBasenames();
|
|
|
|
|
null,null,null,null,null,null,!0):Graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(d="#"+c.getHash(),a=!1));a&&null!=c&&null!=c.getTitle()&&c.getTitle()!=this.defaultFilename&&f.push("title="+encodeURIComponent(c.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||!/.*\.draw\.io$/.test(window.location.hostname)?EditorUi.drawHost:"https://"+window.location.host+"/")+(0<f.length?"?"+f.join("&"):"")+d};EditorUi.prototype.createHtml=function(a,b,d,e,n,l,k,m,t,p,x){this.getBasenames();
|
|
|
|
|
var c={};""!=n&&n!=mxConstants.NONE&&(c.highlight=n);"auto"!==e&&(c.target=e);t||(c.lightbox=!1);c.nav=this.editor.graph.foldingEnabled;d=parseInt(d);isNaN(d)||100==d||(c.zoom=d/100);d=[];k&&(d.push("pages"),c.resize=!0,null!=this.pages&&null!=this.currentPage&&(c.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(d.push("zoom"),c.resize=!0);m&&d.push("layers");0<d.length&&(t&&d.push("lightbox"),c.toolbar=d.join(" "));null!=p&&0<p.length&&(c.edit=p);null!=a?c.url=a:c.xml=this.getFileData(!0,
|
|
|
|
|
null,null,null,null,!k);b='<div class="mxgraph" style="'+(l?"max-width:100%;":"")+(""!=d?"border:1px solid transparent;":"")+'" data-mxgraph="'+mxUtils.htmlEntities(JSON.stringify(c))+'"></div>';a=null!=a?"&fetch="+encodeURIComponent(a):"";y(b,'<script type="text/javascript" src="'+(0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1":EditorUi.drawHost+"/embed2.js?")+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":window.VIEWER_URL?window.VIEWER_URL:EditorUi.drawHost+
|
|
|
|
|
null,null,null,null,!k);b='<div class="mxgraph" style="'+(l?"max-width:100%;":"")+(""!=d?"border:1px solid transparent;":"")+'" data-mxgraph="'+mxUtils.htmlEntities(JSON.stringify(c))+'"></div>';a=null!=a?"&fetch="+encodeURIComponent(a):"";x(b,'<script type="text/javascript" src="'+(0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1":EditorUi.drawHost+"/embed2.js?")+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":window.VIEWER_URL?window.VIEWER_URL:EditorUi.drawHost+
|
|
|
|
|
"/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(a,b,d,e){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=document.createElement("div");g.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var k=document.createElement("input");k.style.cssText=
|
|
|
|
|
"margin-right:8px;margin-top:8px;margin-bottom:8px;";k.setAttribute("value","url");k.setAttribute("type","radio");k.setAttribute("name","type-embedhtmldialog");f=k.cloneNode(!0);f.setAttribute("value","copy");g.appendChild(f);var q=document.createElement("span");mxUtils.write(q,mxResources.get("includeCopyOfMyDiagram"));g.appendChild(q);mxUtils.br(g);g.appendChild(k);q=document.createElement("span");mxUtils.write(q,mxResources.get("publicDiagramUrl"));g.appendChild(q);var m=this.getCurrentFile();
|
|
|
|
|
null==d&&null!=m&&m.constructor==window.DriveFile&&(q=document.createElement("a"),q.style.paddingLeft="12px",q.style.color="gray",q.setAttribute("href","javascript:void(0);"),mxUtils.write(q,mxResources.get("share")),g.appendChild(q),mxEvent.addListener(q,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(m.getId())})));f.setAttribute("checked","checked");null==d&&k.setAttribute("disabled","disabled");c.appendChild(g);var y=this.addLinkSection(c),p=this.addCheckbox(c,
|
|
|
|
|
null==d&&null!=m&&m.constructor==window.DriveFile&&(q=document.createElement("a"),q.style.paddingLeft="12px",q.style.color="gray",q.setAttribute("href","javascript:void(0);"),mxUtils.write(q,mxResources.get("share")),g.appendChild(q),mxEvent.addListener(q,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(m.getId())})));f.setAttribute("checked","checked");null==d&&k.setAttribute("disabled","disabled");c.appendChild(g);var x=this.addLinkSection(c),p=this.addCheckbox(c,
|
|
|
|
|
mxResources.get("zoom"),!0,null,!0);mxUtils.write(c,":");var u=document.createElement("input");u.setAttribute("type","text");u.style.marginRight="16px";u.style.width="60px";u.style.marginLeft="4px";u.style.marginRight="12px";u.value="100%";c.appendChild(u);var A=this.addCheckbox(c,mxResources.get("fit"),!0),g=null!=this.pages&&1<this.pages.length,v=v=this.addCheckbox(c,mxResources.get("allPages"),g,!g),z=this.addCheckbox(c,mxResources.get("layers"),!0),H=this.addCheckbox(c,mxResources.get("lightbox"),
|
|
|
|
|
!0),B=this.addEditButton(c,H),D=B.getEditInput();D.style.marginBottom="16px";mxEvent.addListener(H,"change",function(){H.checked?D.removeAttribute("disabled"):D.setAttribute("disabled","disabled");D.checked&&H.checked?B.getEditSelect().removeAttribute("disabled"):B.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,c,mxUtils.bind(this,function(){e(k.checked?d:null,p.checked,u.value,y.getTarget(),y.getColor(),A.checked,v.checked,z.checked,H.checked,B.getLink())}),null,a,
|
|
|
|
|
!0),B=this.addEditButton(c,H),D=B.getEditInput();D.style.marginBottom="16px";mxEvent.addListener(H,"change",function(){H.checked?D.removeAttribute("disabled"):D.setAttribute("disabled","disabled");D.checked&&H.checked?B.getEditSelect().removeAttribute("disabled"):B.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,c,mxUtils.bind(this,function(){e(k.checked?d:null,p.checked,u.value,x.getTarget(),x.getColor(),A.checked,v.checked,z.checked,H.checked,B.getLink())}),null,a,
|
|
|
|
|
b);this.showDialog(a.container,340,384,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,d,e,n,l){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,a||mxResources.get("link"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";c.appendChild(f);var g=this.getCurrentFile(),f="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=g&&g.constructor==window.DriveFile&&
|
|
|
|
|
!b){a=80;var f="https://desk.draw.io/support/solutions/articles/16000039384",k=document.createElement("div");k.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";var q=document.createElement("div");q.style.whiteSpace="normal";mxUtils.write(q,mxResources.get("linkAccountRequired"));k.appendChild(q);q=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(g.getId())}));q.style.marginTop=
|
|
|
|
|
"12px";q.className="geBtn";k.appendChild(q);c.appendChild(k);q=document.createElement("a");q.style.paddingLeft="12px";q.style.color="gray";q.style.fontSize="11px";q.setAttribute("href","javascript:void(0);");mxUtils.write(q,mxResources.get("check"));k.appendChild(q);mxEvent.addListener(q,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(a){this.spinner.stop();a=new ErrorDialog(this,null,
|
|
|
|
@ -3102,12 +3103,12 @@ u=document.createElement("input"),u.setAttribute("type","text"),u.style.width="5
|
|
|
|
|
mxResources.get("image"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:"+(n?"10":"4")+"px";c.appendChild(f);if(n){mxUtils.write(c,mxResources.get("zoom")+":");var g=document.createElement("input");g.setAttribute("type","text");g.style.marginRight="16px";g.style.width="60px";g.style.marginLeft="4px";g.style.marginRight="12px";g.value=this.lastExportZoom||"100%";c.appendChild(g);mxUtils.write(c,mxResources.get("borderWidth")+":");var k=document.createElement("input");k.setAttribute("type",
|
|
|
|
|
"text");k.style.marginRight="16px";k.style.width="60px";k.style.marginLeft="4px";k.value=this.lastExportBorder||"0";c.appendChild(k);mxUtils.br(c)}var q=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),m=e?null:this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),!0),f=this.editor.graph,p=e?null:this.addCheckbox(c,mxResources.get("transparentBackground"),f.background==mxConstants.NONE||null==f.background);null!=p&&(p.style.marginBottom="16px");a=
|
|
|
|
|
new CustomDialog(this,c,mxUtils.bind(this,function(){var a=parseInt(g.value)/100||1,c=parseInt(k.value)||0;d(!q.checked,null!=m?m.checked:!1,null!=p?p.checked:!1,a,c)}),null,a,b);this.showDialog(a.container,300,(n?25:0)+(e?125:210),!0,!0)};EditorUi.prototype.showExportDialog=function(a,b,d,e,n,l,k,m){k=null!=k?k:!0;var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph,g="jpeg"==m?196:300,q=document.createElement("h3");mxUtils.write(q,a);q.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";
|
|
|
|
|
c.appendChild(q);mxUtils.write(c,mxResources.get("zoom")+":");var u=document.createElement("input");u.setAttribute("type","text");u.style.marginRight="16px";u.style.width="60px";u.style.marginLeft="4px";u.style.marginRight="12px";u.value=this.lastExportZoom||"100%";c.appendChild(u);mxUtils.write(c,mxResources.get("borderWidth")+":");var x=document.createElement("input");x.setAttribute("type","text");x.style.marginRight="16px";x.style.width="60px";x.style.marginLeft="4px";x.value=this.lastExportBorder||
|
|
|
|
|
"0";c.appendChild(x);mxUtils.br(c);var p=this.addCheckbox(c,mxResources.get("transparentBackground"),!1,null,null,"jpeg"!=m),C=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,f.isSelectionEmpty()),v=document.createElement("input");v.style.marginTop="16px";v.style.marginRight="8px";v.style.marginLeft="24px";v.setAttribute("disabled","disabled");v.setAttribute("type","checkbox");l&&(c.appendChild(v),mxUtils.write(c,mxResources.get("crop")),mxUtils.br(c),g+=26,mxEvent.addListener(C,"change",function(){C.checked?
|
|
|
|
|
c.appendChild(q);mxUtils.write(c,mxResources.get("zoom")+":");var u=document.createElement("input");u.setAttribute("type","text");u.style.marginRight="16px";u.style.width="60px";u.style.marginLeft="4px";u.style.marginRight="12px";u.value=this.lastExportZoom||"100%";c.appendChild(u);mxUtils.write(c,mxResources.get("borderWidth")+":");var y=document.createElement("input");y.setAttribute("type","text");y.style.marginRight="16px";y.style.width="60px";y.style.marginLeft="4px";y.value=this.lastExportBorder||
|
|
|
|
|
"0";c.appendChild(y);mxUtils.br(c);var p=this.addCheckbox(c,mxResources.get("transparentBackground"),!1,null,null,"jpeg"!=m),C=this.addCheckbox(c,mxResources.get("selectionOnly"),!1,f.isSelectionEmpty()),v=document.createElement("input");v.style.marginTop="16px";v.style.marginRight="8px";v.style.marginLeft="24px";v.setAttribute("disabled","disabled");v.setAttribute("type","checkbox");l&&(c.appendChild(v),mxUtils.write(c,mxResources.get("crop")),mxUtils.br(c),g+=26,mxEvent.addListener(C,"change",function(){C.checked?
|
|
|
|
|
v.removeAttribute("disabled"):v.setAttribute("disabled","disabled")}));f.isSelectionEmpty()||(v.setAttribute("checked","checked"),v.defaultChecked=!0);var z=this.addCheckbox(c,mxResources.get("shadow"),f.shadowVisible),D=document.createElement("input");D.style.marginTop="16px";D.style.marginRight="8px";D.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||D.setAttribute("disabled","disabled");b&&(c.appendChild(D),mxUtils.write(c,mxResources.get("embedImages")),mxUtils.br(c),g+=
|
|
|
|
|
26);var K=null;if("png"==m||"jpeg"==m)K=this.addCheckbox(c,mxResources.get("grid"),!1,this.isOffline()||!this.canvasSupported,!1,!0),g+=26;var B=this.addCheckbox(c,mxResources.get("includeCopyOfMyDiagram"),k,null,null,"jpeg"!=m),Q=null!=this.pages&&1<this.pages.length,ba=this.addCheckbox(c,Q?mxResources.get("allPages"):"",Q,!Q,null,"jpeg"!=m);ba.style.marginLeft="24px";ba.style.marginBottom="16px";Q||(ba.style.display="none");mxEvent.addListener(B,"change",function(){B.checked&&Q?ba.removeAttribute("disabled"):
|
|
|
|
|
ba.setAttribute("disabled","disabled")});k&&Q||ba.setAttribute("disabled","disabled");var W=document.createElement("select");W.style.maxWidth="260px";W.style.marginLeft="8px";W.style.marginRight="10px";W.className="geBtn";a=document.createElement("option");a.setAttribute("value","auto");mxUtils.write(a,mxResources.get("automatic"));W.appendChild(a);a=document.createElement("option");a.setAttribute("value","blank");mxUtils.write(a,mxResources.get("openInNewWindow"));W.appendChild(a);a=document.createElement("option");
|
|
|
|
|
a.setAttribute("value","self");mxUtils.write(a,mxResources.get("openInThisWindow"));W.appendChild(a);"svg"==m&&(mxUtils.write(c,mxResources.get("links")+":"),c.appendChild(W),mxUtils.br(c),mxUtils.br(c),g+=26);d=new CustomDialog(this,c,mxUtils.bind(this,function(){this.lastExportBorder=x.value;this.lastExportZoom=u.value;n(u.value,p.checked,!C.checked,z.checked,B.checked,D.checked,x.value,v.checked,!ba.checked,W.value,null!=K?K.checked:null)}),null,d,e);this.showDialog(d.container,340,g,!0,!0,null,
|
|
|
|
|
a.setAttribute("value","self");mxUtils.write(a,mxResources.get("openInThisWindow"));W.appendChild(a);"svg"==m&&(mxUtils.write(c,mxResources.get("links")+":"),c.appendChild(W),mxUtils.br(c),mxUtils.br(c),g+=26);d=new CustomDialog(this,c,mxUtils.bind(this,function(){this.lastExportBorder=y.value;this.lastExportZoom=u.value;n(u.value,p.checked,!C.checked,z.checked,B.checked,D.checked,y.value,v.checked,!ba.checked,W.value,null!=K?K.checked:null)}),null,d,e);this.showDialog(d.container,340,g,!0,!0,null,
|
|
|
|
|
null,null,null,!0);u.focus();mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?u.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,d,e,n){var c=document.createElement("div");c.style.whiteSpace="nowrap";var f=this.editor.graph;if(null!=b){var g=document.createElement("h3");mxUtils.write(g,b);g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";c.appendChild(g)}var k=this.addCheckbox(c,mxResources.get("fit"),
|
|
|
|
|
!0),q=this.addCheckbox(c,mxResources.get("shadow"),f.shadowVisible&&e,!e),m=this.addCheckbox(c,d),p=this.addCheckbox(c,mxResources.get("lightbox"),!0),u=this.addEditButton(c,p),v=u.getEditInput(),z=1<f.model.getChildCount(f.model.getRoot()),B=this.addCheckbox(c,mxResources.get("layers"),z,!z);B.style.marginLeft=v.style.marginLeft;B.style.marginBottom="12px";B.style.marginTop="8px";mxEvent.addListener(p,"change",function(){p.checked?(z&&B.removeAttribute("disabled"),v.removeAttribute("disabled")):
|
|
|
|
|
(B.setAttribute("disabled","disabled"),v.setAttribute("disabled","disabled"));v.checked&&p.checked?u.getEditSelect().removeAttribute("disabled"):u.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,c,mxUtils.bind(this,function(){a(k.checked,q.checked,m.checked,p.checked,u.getLink(),B.checked)}),null,mxResources.get("embed"),n);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(a,b,d,e,n,l,k,m){function c(c){var b=" ",g="";e&&(b=" onclick=\"(function(img){if(img.wnd!=null&&!img.wnd.closed){img.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==img.wnd){img.wnd.postMessage(decodeURIComponent(img.getAttribute('src')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);img.wnd=window.open('"+
|
|
|
|
@ -3121,25 +3122,25 @@ function(){e()}))}),0)):e()};EditorUi.prototype.decodeNodeIntoGraph=function(a,b
|
|
|
|
|
d}return a};EditorUi.prototype.getEmbeddedPng=function(a,b,d){try{var c=this.editor.graph,f=null;if(null!=d&&0<d.length)c=this.createTemporaryGraph(this.editor.graph.getStylesheet()),document.body.appendChild(c.container),this.decodeNodeIntoGraph(this.editor.extractGraphModel(mxUtils.parseXml(d).documentElement,!0),c),f=d;else if(null!=this.pages&&this.currentPage!=this.pages[0]){var c=this.createTemporaryGraph(c.getStylesheet()),e=c.getGlobalVariable,g=this.pages[0];c.getGlobalVariable=function(a){return"page"==
|
|
|
|
|
a?g.getName():"pagenumber"==a?1:e.apply(this,arguments)};document.body.appendChild(c.container);c.model.setRoot(g.root)}this.exportToCanvas(mxUtils.bind(this,function(d){try{null==f&&(f=this.getFileData(!0,null,null,null,null,null,null,null,null,!1));var e=d.toDataURL("image/png"),e=this.writeGraphModelToPng(e,"tEXt","mxfile",encodeURIComponent(f));a(e.substring(e.lastIndexOf(",")+1));c!=this.editor.graph&&c.container.parentNode.removeChild(c.container)}catch(E){null!=b&&b(E)}}),null,null,null,mxUtils.bind(this,
|
|
|
|
|
function(a){null!=b&&b(a)}),null,null,null,null,c.shadowVisible,null,c)}catch(C){null!=b&&b(C)}};EditorUi.prototype.getEmbeddedSvg=function(a,b,d,e,n,l,k){k=b.background;k==mxConstants.NONE&&(k=null);l=b.getSvg(k,null,null,null,null,l);b.shadowVisible&&b.addSvgShadow(l);null!=a&&l.setAttribute("content",a);null!=d&&l.setAttribute("resource",d);if(null!=n)this.convertImages(l,mxUtils.bind(this,function(a){n((e?"":'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')+
|
|
|
|
|
mxUtils.getXml(a))}));else return(e?"":'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')+mxUtils.getXml(l)};EditorUi.prototype.exportImage=function(a,b,d,e,n,l,k,m,t,p,y){t=null!=t?t:"png";if(this.spinner.spin(document.body,mxResources.get("exporting"))){var c=this.editor.graph.isSelectionEmpty();d=null!=d?d:c;null==this.thumbImageCache&&(this.thumbImageCache={});try{this.exportToCanvas(mxUtils.bind(this,
|
|
|
|
|
function(a){this.spinner.stop();try{this.saveCanvas(a,n?this.getFileData(!0,null,null,null,d,m):null,t,!m,y)}catch(A){"Invalid image"==A.message?this.downloadFile(t):this.handleError(A)}}),null,this.thumbImageCache,null,mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a)}),null,d,a||1,b,e,null,null,l,k,p)}catch(u){this.spinner.stop(),this.handleError(u)}}};EditorUi.prototype.loadFonts=function(a){if(null!=this.editor.fontCss&&null==this.editor.resolvedFontCss){var c=function(a){return a.replace(RegExp("^[\\s\"']+",
|
|
|
|
|
mxUtils.getXml(a))}));else return(e?"":'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')+mxUtils.getXml(l)};EditorUi.prototype.exportImage=function(a,b,d,e,n,l,k,m,t,p,x){t=null!=t?t:"png";if(this.spinner.spin(document.body,mxResources.get("exporting"))){var c=this.editor.graph.isSelectionEmpty();d=null!=d?d:c;null==this.thumbImageCache&&(this.thumbImageCache={});try{this.exportToCanvas(mxUtils.bind(this,
|
|
|
|
|
function(a){this.spinner.stop();try{this.saveCanvas(a,n?this.getFileData(!0,null,null,null,d,m):null,t,!m,x)}catch(A){"Invalid image"==A.message?this.downloadFile(t):this.handleError(A)}}),null,this.thumbImageCache,null,mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a)}),null,d,a||1,b,e,null,null,l,k,p)}catch(u){this.spinner.stop(),this.handleError(u)}}};EditorUi.prototype.loadFonts=function(a){if(null!=this.editor.fontCss&&null==this.editor.resolvedFontCss){var c=function(a){return a.replace(RegExp("^[\\s\"']+",
|
|
|
|
|
"g"),"").replace(RegExp("[\\s\"']+$","g"),"")},b=this.editor.fontCss.split("url("),d=0,e={},l=mxUtils.bind(this,function(){if(0==d){for(var f=[b[0]],g=1;g<b.length;g++){var l=b[g].indexOf(")");f.push('url("');f.push(e[c(b[g].substring(0,l))]);f.push('"'+b[g].substring(l))}this.editor.resolvedFontCss=f.join("");a()}});if(0<b.length)for(var k=1;k<b.length;k++){var m=b[k].indexOf(")"),t=null,p=b[k].indexOf("format(",m);0<p&&(t=c(b[k].substring(p+7,b[k].indexOf(")",p))));mxUtils.bind(this,function(a){if(null==
|
|
|
|
|
e[a]){e[a]=a;d++;var c="application/x-font-ttf";if("svg"==t||/(\.svg)($|\?)/i.test(a))c="image/svg+xml";else if("otf"==t||"embedded-opentype"==t||/(\.otf)($|\?)/i.test(a))c="application/x-font-opentype";else if("woff"==t||/(\.woff)($|\?)/i.test(a))c="application/font-woff";else if("woff2"==t||/(\.woff2)($|\?)/i.test(a))c="application/font-woff2";else if("eot"==t||/(\.eot)($|\?)/i.test(a))c="application/vnd.ms-fontobject";else if("sfnt"==t||/(\.sfnt)($|\?)/i.test(a))c="application/font-sfnt";var b=
|
|
|
|
|
a;/^https?:\/\//.test(b)&&!this.editor.isCorsEnabledForUrl(b)&&(b=PROXY_URL+"?url="+encodeURIComponent(a));this.loadUrl(b,mxUtils.bind(this,function(c){e[a]=c;d--;l()}),mxUtils.bind(this,function(a){d--;l()}),!0,null,"data:"+c+";charset=utf-8;base64,")}})(c(b[k].substring(0,m)),t)}}else a()};EditorUi.prototype.exportToCanvas=function(a,b,d,e,k,l,m,p,t,v,y,F,u,A,z){try{l=null!=l?l:!0;m=null!=m?m:!0;F=null!=F?F:this.editor.graph;u=null!=u?u:0;var c=t?null:F.background;c==mxConstants.NONE&&(c=null);
|
|
|
|
|
a;/^https?:\/\//.test(b)&&!this.editor.isCorsEnabledForUrl(b)&&(b=PROXY_URL+"?url="+encodeURIComponent(a));this.loadUrl(b,mxUtils.bind(this,function(c){e[a]=c;d--;l()}),mxUtils.bind(this,function(a){d--;l()}),!0,null,"data:"+c+";charset=utf-8;base64,")}})(c(b[k].substring(0,m)),t)}}else a()};EditorUi.prototype.exportToCanvas=function(a,b,d,e,k,l,m,p,t,v,x,F,u,A,z){try{l=null!=l?l:!0;m=null!=m?m:!0;F=null!=F?F:this.editor.graph;u=null!=u?u:0;var c=t?null:F.background;c==mxConstants.NONE&&(c=null);
|
|
|
|
|
null==c&&(c=e);null==c&&0==t&&(c="#ffffff");this.convertImages(F.getSvg(null,null,null,A,null,m,null,null,null,v),mxUtils.bind(this,function(d){var f=new Image;f.onload=mxUtils.bind(this,function(){try{var e=function(){mxClient.IS_SF?window.setTimeout(function(){t.drawImage(f,u/p,u/p);a(g)},0):(t.drawImage(f,u/p,u/p),a(g))},g=document.createElement("canvas"),n=parseInt(d.getAttribute("width")),q=parseInt(d.getAttribute("height"));p=null!=p?p:1;null!=b&&(p=l?Math.min(1,Math.min(3*b/(4*q),b/n)):b/n);
|
|
|
|
|
n=Math.ceil(p*n)+2*u;q=Math.ceil(p*q)+2*u;g.setAttribute("width",n);g.setAttribute("height",q);var t=g.getContext("2d");null!=c&&(t.beginPath(),t.rect(0,0,n,q),t.fillStyle=c,t.fill());t.scale(p,p);if(z){var m=F.view,y=btoa(unescape(encodeURIComponent(m.createSvgGrid(m.gridColor)))),y="data:image/svg+xml;base64,"+y,x=F.gridSize*m.gridSteps*p,C=F.getGraphBounds(),v=C.x*p,D=C.y*p,A=new Image;A.src=y;A.onload=function(){for(var a=-Math.round(x-mxUtils.mod(m.translate.x*p-v,x)),c=-Math.round(x-mxUtils.mod(m.translate.y*
|
|
|
|
|
p-D,x));a<n;a+=x)for(var b=c;b<q;b+=x)t.drawImage(A,a/p,b/p);e()}}else e()}catch(V){null!=k&&k(V)}});f.onerror=function(a){null!=k&&k(a)};try{v&&this.editor.graph.addSvgShadow(d);var e=mxUtils.bind(this,function(){if(null!=this.editor.resolvedFontCss){var a=document.createElement("style");a.setAttribute("type","text/css");a.innerHTML=this.editor.resolvedFontCss;d.getElementsByTagName("defs")[0].appendChild(a)}this.convertMath(F,d,!0,mxUtils.bind(this,function(){f.src=this.createSvgDataUri(mxUtils.getXml(d))}))});
|
|
|
|
|
this.loadFonts(e)}catch(K){null!=k&&k(K)}}),d,y)}catch(H){null!=k&&k(H)}};EditorUi.prototype.createImageUrlConverter=function(){var a=new mxUrlConverter;a.updateBaseUrl();var b=a.convert,d=this;a.convert=function(c){if(null!=c){var f="http://"==c.substring(0,7)||"https://"==c.substring(0,8);f&&!navigator.onLine?c=d.svgBrokenImage.src:!f||c.substring(0,a.baseUrl.length)==a.baseUrl||d.crossOriginImages&&d.editor.isCorsEnabledForUrl(c)?"chrome-extension://"==c.substring(0,19)||mxClient.IS_CHROMEAPP||
|
|
|
|
|
n=Math.ceil(p*n)+2*u;q=Math.ceil(p*q)+2*u;g.setAttribute("width",n);g.setAttribute("height",q);var t=g.getContext("2d");null!=c&&(t.beginPath(),t.rect(0,0,n,q),t.fillStyle=c,t.fill());t.scale(p,p);if(z){var m=F.view,x=btoa(unescape(encodeURIComponent(m.createSvgGrid(m.gridColor)))),x="data:image/svg+xml;base64,"+x,y=F.gridSize*m.gridSteps*p,C=F.getGraphBounds(),v=C.x*p,D=C.y*p,A=new Image;A.src=x;A.onload=function(){for(var a=-Math.round(y-mxUtils.mod(m.translate.x*p-v,y)),c=-Math.round(y-mxUtils.mod(m.translate.y*
|
|
|
|
|
p-D,y));a<n;a+=y)for(var b=c;b<q;b+=y)t.drawImage(A,a/p,b/p);e()}}else e()}catch(V){null!=k&&k(V)}});f.onerror=function(a){null!=k&&k(a)};try{v&&this.editor.graph.addSvgShadow(d);var e=mxUtils.bind(this,function(){if(null!=this.editor.resolvedFontCss){var a=document.createElement("style");a.setAttribute("type","text/css");a.innerHTML=this.editor.resolvedFontCss;d.getElementsByTagName("defs")[0].appendChild(a)}this.convertMath(F,d,!0,mxUtils.bind(this,function(){f.src=this.createSvgDataUri(mxUtils.getXml(d))}))});
|
|
|
|
|
this.loadFonts(e)}catch(K){null!=k&&k(K)}}),d,x)}catch(H){null!=k&&k(H)}};EditorUi.prototype.createImageUrlConverter=function(){var a=new mxUrlConverter;a.updateBaseUrl();var b=a.convert,d=this;a.convert=function(c){if(null!=c){var f="http://"==c.substring(0,7)||"https://"==c.substring(0,8);f&&!navigator.onLine?c=d.svgBrokenImage.src:!f||c.substring(0,a.baseUrl.length)==a.baseUrl||d.crossOriginImages&&d.editor.isCorsEnabledForUrl(c)?"chrome-extension://"==c.substring(0,19)||mxClient.IS_CHROMEAPP||
|
|
|
|
|
(c=b.apply(this,arguments)):c=PROXY_URL+"?url="+encodeURIComponent(c)}return c};return a};EditorUi.prototype.convertImages=function(a,b,d,e){null==e&&(e=this.createImageUrlConverter());var c=0,f=d||{};d=mxUtils.bind(this,function(d,g){for(var l=a.getElementsByTagName(d),k=0;k<l.length;k++)mxUtils.bind(this,function(d){try{if(null!=d){var l=e.convert(d.getAttribute(g));if(null!=l&&"data:"!=l.substring(0,5)){var k=f[l];null==k?(c++,this.convertImageToDataUri(l,function(e){null!=e&&(f[l]=e,d.setAttribute(g,
|
|
|
|
|
e));c--;0==c&&b(a)})):d.setAttribute(g,k)}else null!=l&&d.setAttribute(g,l)}}catch(A){}})(l[k])});d("image","xlink:href");d("img","src");0==c&&b(a)};EditorUi.prototype.loadUrl=function(a,b,d,e,k,l,m){try{var c=!m&&(e||/(\.png)($|\?)/i.test(a)||/(\.jpe?g)($|\?)/i.test(a)||/(\.gif)($|\?)/i.test(a));k=null!=k?k:!0;var f=mxUtils.bind(this,function(){mxUtils.get(a,mxUtils.bind(this,function(a){if(200<=a.getStatus()&&299>=a.getStatus()){if(null!=b){var f=a.getText();if(c){if((9==document.documentMode||
|
|
|
|
|
10==document.documentMode)&&"undefined"!==typeof window.mxUtilsBinaryToArray){a=mxUtilsBinaryToArray(a.request.responseBody).toArray();for(var f=Array(a.length),e=0;e<a.length;e++)f[e]=String.fromCharCode(a[e]);f=f.join("")}l=null!=l?l:"data:image/png;base64,";f=l+this.base64Encode(f)}b(f)}}else null!=d&&d({message:mxResources.get("error")+" "+a.getStatus()},a)}),function(a){null!=d&&d({message:mxResources.get("error")+" "+a.getStatus()})},c,this.timeout,function(){k&&null!=d&&d({code:App.ERROR_TIMEOUT,
|
|
|
|
|
retry:f})})});f()}catch(E){null!=d&&d(E)}};EditorUi.prototype.isCorsEnabledForUrl=function(a){return this.editor.isCorsEnabledForUrl(a)};EditorUi.prototype.convertImageToDataUri=function(a,b){try{var c=!0,d=window.setTimeout(mxUtils.bind(this,function(){c=!1;b(this.svgBrokenImage.src)}),this.timeout);if(/(\.svg)$/i.test(a))mxUtils.get(a,mxUtils.bind(this,function(a){window.clearTimeout(d);c&&b(this.createSvgDataUri(a.getText()))}),function(){window.clearTimeout(d);c&&b(this.svgBrokenImage.src)});
|
|
|
|
|
else{var f=new Image,e=this;this.crossOriginImages&&(f.crossOrigin="anonymous");f.onload=function(){window.clearTimeout(d);if(c)try{var a=document.createElement("canvas"),g=a.getContext("2d");a.height=f.height;a.width=f.width;g.drawImage(f,0,0);b(a.toDataURL())}catch(t){b(e.svgBrokenImage.src)}};f.onerror=function(){window.clearTimeout(d);c&&b(e.svgBrokenImage.src)};f.src=a}}catch(x){b(this.svgBrokenImage.src)}};EditorUi.prototype.importXml=function(a,b,d,e,k){b=null!=b?b:0;d=null!=d?d:0;var c=[];
|
|
|
|
|
else{var f=new Image,e=this;this.crossOriginImages&&(f.crossOrigin="anonymous");f.onload=function(){window.clearTimeout(d);if(c)try{var a=document.createElement("canvas"),g=a.getContext("2d");a.height=f.height;a.width=f.width;g.drawImage(f,0,0);b(a.toDataURL())}catch(t){b(e.svgBrokenImage.src)}};f.onerror=function(){window.clearTimeout(d);c&&b(e.svgBrokenImage.src)};f.src=a}}catch(y){b(this.svgBrokenImage.src)}};EditorUi.prototype.importXml=function(a,b,d,e,k){b=null!=b?b:0;d=null!=d?d:0;var c=[];
|
|
|
|
|
try{var f=this.editor.graph;if(null!=a&&0<a.length){f.model.beginUpdate();try{var g=mxUtils.parseXml(a),n=this.editor.extractGraphModel(g.documentElement,null!=this.pages);if(null!=n&&"mxfile"==n.nodeName&&null!=this.pages){var q=n.getElementsByTagName("diagram");if(1==q.length)n=Editor.parseDiagramNode(q[0]);else if(1<q.length){a={};var g=[],m=0;null!=this.pages&&1==this.pages.length&&this.isDiagramEmpty()&&(n=Editor.parseDiagramNode(q[0]),e=!1,m=1);for(;m<q.length;m++){var p=q[m].getAttribute("id");
|
|
|
|
|
q[m].removeAttribute("id");var u=this.updatePageRoot(new DiagramPage(q[m]));a[p]=q[m].getAttribute("id");var v=this.pages.length;null==u.getName()&&u.setName(mxResources.get("pageWithNumber",[v+1]));f.model.execute(new ChangePage(this,u,u,v,!0));g.push(u)}this.updatePageLinks(a,g)}}null!=n&&"mxGraphModel"===n.nodeName&&(c=f.importGraphModel(n,b,d,e))}finally{f.model.endUpdate()}}}catch(N){if(k)throw N;this.handleError(N)}return c};EditorUi.prototype.updatePageLinks=function(a,b){for(var c=0;c<b.length;c++)this.updatePageLinksForCell(a,
|
|
|
|
|
b[c].root)};EditorUi.prototype.updatePageLinksForCell=function(a,b){var c=document.createElement("div"),d=this.editor.graph,f=d.getLinkForCell(b);null!=f&&d.setLinkForCell(b,this.updatePageLink(a,f));if(d.isHtmlLabel(b)){c.innerHTML=d.getLabel(b);for(var e=c.getElementsByTagName("a"),k=!1,m=0;m<e.length;m++)f=e[m].getAttribute("href"),null!=f&&(e[m].setAttribute("href",this.updatePageLink(a,f)),k=!0);k&&d.labelChanged(b,c.innerHTML)}for(m=0;m<d.model.getChildCount(b);m++)this.updatePageLinksForCell(a,
|
|
|
|
|
d.model.getChildAt(b,m))};EditorUi.prototype.updatePageLink=function(a,b){if("data:page/id,"==b.substring(0,13)){var c=a[b.substring(b.indexOf(",")+1)];b=null!=c?"data:page/id,"+c:null}else if("data:action/json,"==b.substring(0,17))try{var d=JSON.parse(b.substring(17));if(null!=d.actions){for(var f=0;f<d.actions.length;f++){var e=d.actions[f];null!=e.open&&"data:page/id,"==e.open.substring(0,13)&&(c=a[e.open.substring(e.open.indexOf(",")+1)],null!=c?e.open="data:page/id,"+c:delete e.open)}b="data:action/json,"+
|
|
|
|
|
JSON.stringify(d)}}catch(x){}return b};EditorUi.prototype.isRemoteVisioFormat=function(a){return/(\.v(sd|dx))($|\?)/i.test(a)||/(\.vs(s|x))($|\?)/i.test(a)};EditorUi.prototype.importVisio=function(a,b,d,e){e=null!=e?e:a.name;d=null!=d?d:mxUtils.bind(this,function(a){this.handleError(a)});var c=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.doImportVisio){var c=this.isRemoteVisioFormat(e);try{var f="UNKNOWN-VISIO",g=e.lastIndexOf(".");0<=g&&g<e.length&&(f=e.substring(g+1).toUpperCase());
|
|
|
|
|
JSON.stringify(d)}}catch(y){}return b};EditorUi.prototype.isRemoteVisioFormat=function(a){return/(\.v(sd|dx))($|\?)/i.test(a)||/(\.vs(s|x))($|\?)/i.test(a)};EditorUi.prototype.importVisio=function(a,b,d,e){e=null!=e?e:a.name;d=null!=d?d:mxUtils.bind(this,function(a){this.handleError(a)});var c=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.doImportVisio){var c=this.isRemoteVisioFormat(e);try{var f="UNKNOWN-VISIO",g=e.lastIndexOf(".");0<=g&&g<e.length&&(f=e.substring(g+1).toUpperCase());
|
|
|
|
|
EditorUi.logEvent({category:f+"-MS-IMPORT-FILE",action:"filename_"+e,label:c?"remote":"local"})}catch(E){}if(c)if(null!=VSD_CONVERT_URL){c=new FormData;c.append("file1",a,e);var k=new XMLHttpRequest;k.open("POST",VSD_CONVERT_URL);k.responseType="blob";this.addRemoteServiceSecurityCheck(k);k.onreadystatechange=mxUtils.bind(this,function(){if(4==k.readyState)if(200<=k.status&&299>=k.status)try{var a=k.response;if("text/xml"==a.type){var c=new FileReader;c.onload=mxUtils.bind(this,function(a){try{b(a.target.result)}catch(u){d({message:mxResources.get("errorLoadingFile")})}});
|
|
|
|
|
c.readAsText(a)}else this.doImportVisio(a,b,d,e)}catch(F){d(F)}else d({})});k.send(c)}else d({message:"conf"==this.getServiceName()?mxResources.get("vsdNoConfig"):mxResources.get("serviceUnavailableOrBlocked")});else try{this.doImportVisio(a,b,d,e)}catch(E){d(E)}}else this.spinner.stop(),this.handleError({message:mxResources.get("serviceUnavailableOrBlocked")})});this.doImportVisio||this.loadingExtensions||this.isOffline(!0)?c():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",c))};EditorUi.prototype.importGraphML=
|
|
|
|
|
function(a,b,d){d=null!=d?d:mxUtils.bind(this,function(a){this.handleError(a)});var c=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.doImportGraphML)try{this.doImportGraphML(a,b,d)}catch(n){d(n)}else this.spinner.stop(),this.handleError({message:mxResources.get("serviceUnavailableOrBlocked")})});this.doImportGraphML||this.loadingExtensions||this.isOffline(!0)?c():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",c))};EditorUi.prototype.exportVisio=function(){var a=mxUtils.bind(this,
|
|
|
|
@ -3150,7 +3151,7 @@ PLANT_URL+"/svg/")+function(a){r="";for(i=0;i<a.length;i+=3)r=i+2==a.length?r+c(
|
|
|
|
|
b.width,f=b.height;if(0==a&&0==f){var e=c.result,g=e.indexOf(","),e=decodeURIComponent(escape(atob(e.substring(g+1)))),e=mxUtils.parseXml(e).getElementsByTagName("svg");0<e.length&&(a=parseFloat(e[0].getAttribute("width")),f=parseFloat(e[0].getAttribute("height")))}d(c.result,a,f)};b.src=c.result};c.onerror=function(a){e(a)}}else e(a)};g.onerror=function(a){e(a)};g.send()};EditorUi.prototype.insertAsPreText=function(a,b,d){var c=this.editor.graph,f=null;c.getModel().beginUpdate();try{f=c.insertVertex(null,
|
|
|
|
|
null,"<pre>"+a+"</pre>",b,d,1,1,"text;html=1;align=left;verticalAlign=top;"),c.updateCellSize(f,!0)}finally{c.getModel().endUpdate()}return f};EditorUi.prototype.insertTextAt=function(a,b,d,e,k,l,m){l=null!=l?l:!0;m=null!=m?m:!0;if(null!=a)if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a))this.parseFile(new Blob([a.replace(/\s+/g," ")],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&this.editor.graph.setSelectionCells(this.insertTextAt(a.responseText,
|
|
|
|
|
b,d,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(k||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var c=this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var f=this.extractGraphModelFromPng(a),g=this.importXml(f,b,d,l,!0);if(0<g.length)return g}if("data:image/svg+xml;"==a.substring(0,19))try{if(f=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(f=a.substring(a.indexOf(",")+1),f=window.atob&&!mxClient.IS_SF?atob(f):Base64.decode(f,!0)):f=decodeURIComponent(a.substring(a.indexOf(",")+
|
|
|
|
|
1)),g=this.importXml(f,b,d,l,!0),0<g.length)return g}catch(y){}this.loadImage(a,mxUtils.bind(this,function(f){if("data:"==a.substring(0,5))this.resizeImage(f,a,mxUtils.bind(this,function(a,f,e){c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),f,e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),m,this.maxImageSize);else{var e=Math.min(1,Math.min(this.maxImageSize/f.width,this.maxImageSize/
|
|
|
|
|
1)),g=this.importXml(f,b,d,l,!0),0<g.length)return g}catch(x){}this.loadImage(a,mxUtils.bind(this,function(f){if("data:"==a.substring(0,5))this.resizeImage(f,a,mxUtils.bind(this,function(a,f,e){c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),f,e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),m,this.maxImageSize);else{var e=Math.min(1,Math.min(this.maxImageSize/f.width,this.maxImageSize/
|
|
|
|
|
f.height)),g=Math.round(f.width*e);f=Math.round(f.height*e);c.setSelectionCell(c.insertVertex(null,null,"",c.snap(b),c.snap(d),g,f,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var f=null;c.getModel().beginUpdate();try{f=c.insertVertex(c.getDefaultParent(),null,a,c.snap(b),c.snap(d),1,1,"text;"+(e?"html=1;":"")),c.updateCellSize(f),c.fireEvent(new mxEventObject("textInserted","cells",
|
|
|
|
|
[f]))}finally{c.getModel().endUpdate()}c.setSelectionCell(f)}))}else{a=Graph.zapGremlins(mxUtils.trim(a));if(this.isCompatibleString(a))return this.importXml(a,b,d,l);if(0<a.length)if(this.isLucidChartData(a))this.convertLucidChart(a,mxUtils.bind(this,function(a){this.editor.graph.setSelectionCells(this.importXml(a,b,d,l))}),mxUtils.bind(this,function(a){this.handleError(a)}));else{c=this.editor.graph;k=null;c.getModel().beginUpdate();try{k=c.insertVertex(c.getDefaultParent(),null,"",c.snap(b),c.snap(d),
|
|
|
|
|
1,1,"text;"+(e?"html=1;":"")),c.fireEvent(new mxEventObject("textInserted","cells",[k])),"<"==a.charAt(0)&&a.indexOf(">")==a.length-1&&(a=mxUtils.htmlEntities(a)),a.length>this.maxTextBytes&&(a=a.substring(0,this.maxTextBytes)+"..."),k.value=a,c.updateCellSize(k),/\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i.test(k.value)&&c.setLinkForCell(k,
|
|
|
|
@ -3159,75 +3160,75 @@ EditorUi.prototype.isLucidChartData=function(a){return null!=a&&('{"state":"{\\"
|
|
|
|
|
"none";document.body.appendChild(c);this.importFileInputElt=c}this.importFileInputElt.click()}else{window.openNew=!1;window.openKey="import";if(!b){var d=Editor.useLocalStorage;Editor.useLocalStorage=!a}window.openFile=new OpenFile(mxUtils.bind(this,function(a){this.hideDialog(a)}));window.openFile.setConsumer(mxUtils.bind(this,function(a,c){if(null!=c&&Graph.fileSupport&&/(\.v(dx|sdx?))($|\?)/i.test(c)){var b=new Blob([a],{type:"application/octet-stream"});this.importVisio(b,mxUtils.bind(this,function(a){this.importXml(a,
|
|
|
|
|
0,0,!0)}),null,c)}else this.editor.graph.setSelectionCells(this.importXml(a,0,0,!0))}));this.showDialog((new OpenDialog(this)).container,360,220,!0,!0,function(){window.openFile=null});if(!b){var f=this.dialog,e=f.close;this.dialog.close=mxUtils.bind(this,function(a){Editor.useLocalStorage=d;e.apply(f,arguments);a&&null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()})}}};EditorUi.prototype.importZipFile=function(a,b,d){var c=this,f=mxUtils.bind(this,function(){this.loadingExtensions=
|
|
|
|
|
!1;"undefined"!==typeof JSZip?JSZip.loadAsync(a).then(function(f){if(0==Object.keys(f.files).length)d();else{var e=0,g,l=!1;f.forEach(function(a,c){var f=c.name.toLowerCase();"diagram/diagram.xml"==f?(l=!0,c.async("string").then(function(a){0==a.indexOf("<mxfile ")?b(a):d()})):0==f.indexOf("versions/")&&(f=parseInt(f.substr(9)),f>e&&(e=f,g=c))});0<e?g.async("string").then(function(f){!c.isOffline()&&(new XMLHttpRequest).upload&&c.isRemoteFileFormat(f,a.name)?c.parseFile(new Blob([f],{type:"application/octet-stream"}),
|
|
|
|
|
mxUtils.bind(this,function(a){4==a.readyState&&(200<=a.status&&299>=a.status?b(a.responseText):d())}),a.name):d()}):l||d()}},function(a){d(a)}):d()});"undefined"!==typeof JSZip||this.loadingExtensions||this.isOffline(!0)?f():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",f))};EditorUi.prototype.importFile=function(a,b,d,e,k,l,m,p,t,v,y){v=null!=v?v:!0;var c=!1,f=null,g=mxUtils.bind(this,function(a){var c=null;null!=a&&"<mxlibrary"==a.substring(0,10)?this.loadLibrary(new LocalLibrary(this,
|
|
|
|
|
a,m)):c=this.importXml(a,d,e,v);null!=p&&p(c)});"image"==b.substring(0,5)?(t=!1,"image/png"==b.substring(0,9)&&(b=y?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(f=this.importXml(b,d,e,v),t=!0)),t||(b=this.editor.graph,y=a.indexOf(";"),0<y&&(a=a.substring(0,y)+a.substring(a.indexOf(",",y+1))),v&&b.isGridEnabled()&&(d=b.snap(d),e=b.snap(e)),f=[b.insertVertex(null,null,"",d,e,k,l,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
|
|
|
|
mxUtils.bind(this,function(a){4==a.readyState&&(200<=a.status&&299>=a.status?b(a.responseText):d())}),a.name):d()}):l||d()}},function(a){d(a)}):d()});"undefined"!==typeof JSZip||this.loadingExtensions||this.isOffline(!0)?f():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",f))};EditorUi.prototype.importFile=function(a,b,d,e,k,l,m,p,t,v,x){v=null!=v?v:!0;var c=!1,f=null,g=mxUtils.bind(this,function(a){var c=null;null!=a&&"<mxlibrary"==a.substring(0,10)?this.loadLibrary(new LocalLibrary(this,
|
|
|
|
|
a,m)):c=this.importXml(a,d,e,v);null!=p&&p(c)});"image"==b.substring(0,5)?(t=!1,"image/png"==b.substring(0,9)&&(b=x?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(f=this.importXml(b,d,e,v),t=!0)),t||(b=this.editor.graph,x=a.indexOf(";"),0<x&&(a=a.substring(0,x)+a.substring(a.indexOf(",",x+1))),v&&b.isGridEnabled()&&(d=b.snap(d),e=b.snap(e)),f=[b.insertVertex(null,null,"",d,e,k,l,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
|
|
|
|
a+";")])):/(\.*<graphml )/.test(a)?(c=!0,this.importGraphML(a,g)):null!=t&&null!=m&&(/(\.v(dx|sdx?))($|\?)/i.test(m)||/(\.vs(x|sx?))($|\?)/i.test(m))?(c=!0,this.importVisio(t,g)):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,m)?(c=!0,this.parseFile(null!=t?t:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&(200<=a.status&&299>=a.status?g(a.responseText):null!=p&&p(null))}),m)):0==a.indexOf("PK")&&null!=t?(c=!0,this.importZipFile(t,
|
|
|
|
|
g,mxUtils.bind(this,function(){f=this.insertTextAt(this.validateFileData(a),d,e,!0,null,v);p(f)}))):/(\.v(sd|dx))($|\?)/i.test(m)||/(\.vs(s|x))($|\?)/i.test(m)||(f=this.insertTextAt(this.validateFileData(a),d,e,!0,null,v));c||null==p||p(f);return f};EditorUi.prototype.base64Encode=function(a){for(var c="",b=0,d=a.length,e,l,k;b<d;){e=a.charCodeAt(b++)&255;if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&
|
|
|
|
|
3)<<4);c+="==";break}l=a.charCodeAt(b++);if(b==d){c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(l&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((l&15)<<2);c+="=";break}k=a.charCodeAt(b++);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&
|
|
|
|
|
3)<<4|(l&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((l&15)<<2|(k&192)>>6);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(k&63)}return c};EditorUi.prototype.importFiles=function(a,b,d,e,k,l,m,p,t,v,y,z){b=null!=b?b:0;d=null!=d?d:0;e=null!=e?e:this.maxImageSize;v=null!=v?v:this.maxImageBytes;var c=null!=b&&null!=d,f=!0,g=!1;if(!mxClient.IS_CHROMEAPP&&null!=a)for(var n=y||this.resampleThreshold,q=0;q<a.length;q++)if("image/"==a[q].type.substring(0,
|
|
|
|
|
6)&&a[q].size>n){g=!0;break}var x=mxUtils.bind(this,function(){var g=this.editor.graph,n=g.gridSize;k=null!=k?k:mxUtils.bind(this,function(a,b,d,f,e,g,l,k,n){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,l)),null):this.importFile(a,b,d,f,e,g,l,k,n,c,z)});l=null!=l?l:mxUtils.bind(this,function(a){g.setSelectionCells(a)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var q=a.length,u=q,t=[],x=mxUtils.bind(this,function(a,
|
|
|
|
|
3)<<4|(l&240)>>4);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((l&15)<<2|(k&192)>>6);c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(k&63)}return c};EditorUi.prototype.importFiles=function(a,b,d,e,k,l,m,p,t,v,x,z){b=null!=b?b:0;d=null!=d?d:0;e=null!=e?e:this.maxImageSize;v=null!=v?v:this.maxImageBytes;var c=null!=b&&null!=d,f=!0,g=!1;if(!mxClient.IS_CHROMEAPP&&null!=a)for(var n=x||this.resampleThreshold,q=0;q<a.length;q++)if("image/"==a[q].type.substring(0,
|
|
|
|
|
6)&&a[q].size>n){g=!0;break}var y=mxUtils.bind(this,function(){var g=this.editor.graph,n=g.gridSize;k=null!=k?k:mxUtils.bind(this,function(a,b,d,f,e,g,l,k,n){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,l)),null):this.importFile(a,b,d,f,e,g,l,k,n,c,z)});l=null!=l?l:mxUtils.bind(this,function(a){g.setSelectionCells(a)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var q=a.length,u=q,t=[],y=mxUtils.bind(this,function(a,
|
|
|
|
|
c){t[a]=c;if(0==--u){this.spinner.stop();if(null!=p)p(t);else{var b=[];g.getModel().beginUpdate();try{for(var d=0;d<t.length;d++){var f=t[d]();null!=f&&(b=b.concat(f))}}finally{g.getModel().endUpdate()}}l(b)}}),A=0;A<q;A++)mxUtils.bind(this,function(c){var l=a[c];if(null!=l){var q=new FileReader;q.onload=mxUtils.bind(this,function(a){if(null==m||m(l))if("image/"==l.type.substring(0,6))if("image/svg"==l.type.substring(0,9)){var q=a.target.result,u=q.indexOf(","),t=decodeURIComponent(escape(atob(q.substring(u+
|
|
|
|
|
1)))),p=mxUtils.parseXml(t),t=p.getElementsByTagName("svg");if(0<t.length){var t=t[0],D=z?null:t.getAttribute("content");null!=D&&"<"!=D.charAt(0)&&"%"!=D.charAt(0)&&(D=unescape(window.atob?atob(D):Base64.decode(D,!0)));null!=D&&"%"==D.charAt(0)&&(D=decodeURIComponent(D));null==D||"<mxfile "!==D.substring(0,8)&&"<mxGraphModel "!==D.substring(0,14)?x(c,mxUtils.bind(this,function(){try{if(q.substring(0,u+1),null!=p){var a=p.getElementsByTagName("svg");if(0<a.length){var f=a[0],m=parseFloat(f.getAttribute("width")),
|
|
|
|
|
t=parseFloat(f.getAttribute("height")),y=f.getAttribute("viewBox");if(null==y||0==y.length)f.setAttribute("viewBox","0 0 "+m+" "+t);else if(isNaN(m)||isNaN(t)){var x=y.split(" ");3<x.length&&(m=parseFloat(x[2]),t=parseFloat(x[3]))}q=this.createSvgDataUri(mxUtils.getXml(f));var v=Math.min(1,Math.min(e/Math.max(1,m)),e/Math.max(1,t)),D=k(q,l.type,b+c*n,d+c*n,Math.max(1,Math.round(m*v)),Math.max(1,Math.round(t*v)),l.name);if(isNaN(m)||isNaN(t)){var A=new Image;A.onload=mxUtils.bind(this,function(){m=
|
|
|
|
|
Math.max(1,A.width);t=Math.max(1,A.height);D[0].geometry.width=m;D[0].geometry.height=t;f.setAttribute("viewBox","0 0 "+m+" "+t);q=this.createSvgDataUri(mxUtils.getXml(f));var a=q.indexOf(";");0<a&&(q=q.substring(0,a)+q.substring(q.indexOf(",",a+1)));g.setCellStyles("image",q,[D[0]])});A.src=this.createSvgDataUri(mxUtils.getXml(f))}return D}}}catch(aa){}return null})):x(c,mxUtils.bind(this,function(){return k(D,"text/xml",b+c*n,d+c*n,0,0,l.name)}))}else x(c,mxUtils.bind(this,function(){return null}))}else{t=
|
|
|
|
|
!1;if("image/png"==l.type){var A=z?null:this.extractGraphModelFromPng(a.target.result);if(null!=A&&0<A.length){var C=new Image;C.src=a.target.result;x(c,mxUtils.bind(this,function(){return k(A,"text/xml",b+c*n,d+c*n,C.width,C.height,l.name)}));t=!0}}t||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):
|
|
|
|
|
this.loadImage(a.target.result,mxUtils.bind(this,function(g){this.resizeImage(g,a.target.result,mxUtils.bind(this,function(g,m,q){x(c,mxUtils.bind(this,function(){if(null!=g&&g.length<v){var t=f&&this.isResampleImage(a.target.result,y)?Math.min(1,Math.min(e/m,e/q)):1;return k(g,l.type,b+c*n,d+c*n,Math.round(m*t),Math.round(q*t),l.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),f,e,y)}),mxUtils.bind(this,function(){this.handleError({message:mxResources.get("invalidOrMissingFile")})})))}else k(a.target.result,
|
|
|
|
|
l.type,b+c*n,d+c*n,240,160,l.name,function(a){x(c,function(){return a})},l)});/(\.v(dx|sdx?))($|\?)/i.test(l.name)||/(\.vs(x|sx?))($|\?)/i.test(l.name)?k(null,l.type,b+c*n,d+c*n,240,160,l.name,function(a){x(c,function(){return a})},l):"image"==l.type.substring(0,5)?q.readAsDataURL(l):q.readAsText(l)}})(A)});if(g){g=[];for(q=0;q<a.length;q++)g.push(a[q]);a=g;this.confirmImageResize(function(a){f=a;x()},t)}else x()};EditorUi.prototype.confirmImageResize=function(a,b){b=null!=b?b:!1;var c=null!=this.spinner&&
|
|
|
|
|
null!=this.spinner.pause?this.spinner.pause():function(){},d=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():null,f=function(d,f){if(d||b)mxSettings.setResizeImages(d?f:null),mxSettings.save();c();a(f)};null==d||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){f(a,!0)},function(a){f(a,!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+
|
|
|
|
|
Editor.hiResImage+'"/>',isLocalStorage||mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):f(!1,d)};EditorUi.prototype.parseFile=function(a,b,d){d=null!=d?d:a.name;var c=new FormData;c.append("format","xml");c.append("upfile",a,d);var f=new XMLHttpRequest;f.open("POST",OPEN_URL);f.onreadystatechange=function(){b(f)};f.send(c);try{EditorUi.logEvent({category:"GLIFFY-IMPORT-FILE",action:"size_"+a.size})}catch(l){}};EditorUi.prototype.isResampleImage=function(a,
|
|
|
|
|
b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,d,e,k,l){k=null!=k?k:this.maxImageSize;var c=Math.max(1,a.width),f=Math.max(1,a.height);if(e&&this.isResampleImage(b,l))try{var g=Math.max(c/k,f/k);if(1<g){var n=Math.round(c/g),m=Math.round(f/g),q=document.createElement("canvas");q.width=n;q.height=m;q.getContext("2d").drawImage(a,0,0,n,m);var u=q.toDataURL();if(u.length<b.length){var p=document.createElement("canvas");p.width=n;p.height=m;var v=
|
|
|
|
|
p.toDataURL();u!==v&&(b=u,c=n,f=m)}}}catch(Y){}d(b,c,f)};EditorUi.prototype.crcTable=[];for(var d=0;256>d;d++)for(var k=d,m=0;8>m;m++)k=1==(k&1)?3988292384^k>>>1:k>>>1,EditorUi.prototype.crcTable[d]=k;EditorUi.prototype.updateCRC=function(a,b,d,e){for(var c=0;c<e;c++)a=EditorUi.prototype.crcTable[(a^b.charCodeAt(d+c))&255]^a>>>8;return a};EditorUi.prototype.crc32=function(a){this.crcTable=this.crcTable||this.createCrcTable();for(var c=-1,b=0;b<a.length;b++)c=c>>>8^this.crcTable[(c^a.charCodeAt(b))&
|
|
|
|
|
255];return(c^-1)>>>0};EditorUi.prototype.writeGraphModelToPng=function(a,b,d,e,k){function c(a,b){var c=n;n+=b;return a.substring(c,n)}function f(a){a=c(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function g(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+1);a=window.atob?atob(a):Base64.decode(a,!0);var n=0;if(c(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=k&&k();else if(c(a,
|
|
|
|
|
4),"IHDR"!=c(a,4))null!=k&&k();else{c(a,17);k=a.substring(0,n);do{var m=f(a);if("IDAT"==c(a,4)){k=a.substring(0,n-8);"pHYs"==b&&"dpi"==d?(d=Math.round(e/.0254),d=g(d)+g(d)+String.fromCharCode(1)):d=d+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+e;e=4294967295;e=this.updateCRC(e,b,0,4);e=this.updateCRC(e,d,0,d.length);k+=g(d.length)+b+d+g(e^4294967295);k+=a.substring(n-8,a.length);break}k+=a.substring(n-8,n-4+m);c(a,m);c(a,4)}while(m);return"data:image/png;base64,"+(window.btoa?btoa(k):
|
|
|
|
|
Base64.encode(k,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){return Editor.extractGraphModelFromPng(a)};EditorUi.prototype.loadImage=function(a,b,d){try{var c=new Image;c.onload=function(){b(c)};null!=d&&(c.onerror=d);c.src=a}catch(n){if(null!=d)d(n);else throw n;}};var p=EditorUi.prototype.init;EditorUi.prototype.init=function(){mxStencilRegistry.allowEval=mxStencilRegistry.allowEval&&!this.isOfflineApp();"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());
|
|
|
|
|
var a=this,b=this.editor.graph,d=b.cellEditor.startEditing;b.cellEditor.startEditing=function(c,f){var e=this.graph.getAttributeForCell(c,"plantUmlData");if(null!=e){var g=JSON.parse(e),e=new TextareaDialog(a,mxResources.get("plantUml")+":",g.data,function(d){null!=d&&a.spinner.spin(document.body,mxResources.get("inserting"))&&a.generatePlantUmlImage(d,g.format,function(f,e,l){a.spinner.stop();b.getModel().beginUpdate();try{if("txt"==g.format)b.labelChanged(c,"<pre>"+f+"</pre>"),b.updateCellSize(c,
|
|
|
|
|
!0);else{b.setCellStyles("image",a.convertDataUri(f),[c]);var k=b.model.getGeometry(c);null!=k&&(k=k.clone(),k.width=e,k.height=l,b.cellsResized([c],[k],!1))}b.setAttributeForCell(c,"plantUmlData",JSON.stringify({data:d,format:g.format}))}finally{b.getModel().endUpdate()}},function(b){a.handleError(b)})},null,null,400,220);a.showDialog(e.container,420,300,!0,!0);e.init()}else d.apply(this,arguments)};b.getLinkTitle=function(b){return a.getLinkTitle(b)};b.customLinkClicked=function(b){var c=!1;try{a.handleCustomLink(b),
|
|
|
|
|
c=!0}catch(N){a.handleError(N)}return c};var e=this.clearDefaultStyle;this.clearDefaultStyle=function(){e.apply(this,arguments)};this.isOffline()||"undefined"===typeof window.EditDataDialog||(EditDataDialog.placeholderHelpLink="https://desk.draw.io/support/solutions/articles/16000051979");var k=a.editor.getEditBlankUrl;this.editor.getEditBlankUrl=function(b){b=null!=b?b:"";if(null!=a.pages&&null!=a.currentPage)for(var c=0;c<a.pages.length;c++)if(a.pages[c]==a.currentPage){0<c&&(b+=(0<b.length?"&":
|
|
|
|
|
"?")+"page="+c);break}"1"==urlParams.dev&&(b+=(0<b.length?"&":"?")+"dev=1&drawdev=1");return k.apply(this,arguments)};var l=b.addClickHandler;b.addClickHandler=function(a,c,d){var f=c;c=function(a,c){if(null==c){var d=mxEvent.getSource(a);"a"==d.nodeName.toLowerCase()&&(c=d.getAttribute("href"))}null!=c&&b.isCustomLink(c)&&(mxEvent.isTouchEvent(a)||!mxEvent.isPopupTrigger(a))&&b.customLinkClicked(c)&&mxEvent.consume(a);null!=f&&f(a,c)};l.call(this,a,c,d)};p.apply(this,arguments);mxClient.IS_SVG&&
|
|
|
|
|
this.editor.graph.addSvgShadow(b.view.canvas.ownerSVGElement,null,!0);a.actions.get("print").funct=function(){a.showDialog((new PrintDialog(a)).container,360,null!=a.pages&&1<a.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");var m=b.getExportVariables;b.getExportVariables=function(){var b=m.apply(this,arguments);b.pagecount=null!=a.pages?a.pages.length:1;b.page=null!=a.currentPage?a.currentPage.getName():"";b.pagenumber=null!=a.pages&&null!=a.currentPage?mxUtils.indexOf(a.pages,
|
|
|
|
|
a.currentPage)+1:1;return b};var v=b.getGlobalVariable;b.getGlobalVariable=function(b){return"page"==b&&null!=a.currentPage?a.currentPage.getName():"pagenumber"==b?null!=a.currentPage&&null!=a.pages?mxUtils.indexOf(a.pages,a.currentPage)+1:1:"pagecount"==b?null!=a.pages?a.pages.length:1:v.apply(this,arguments)};var t=b.labelLinkClicked;b.labelLinkClicked=function(a,c,d){var f=c.getAttribute("href");if(null==f||!b.isCustomLink(f)||!mxEvent.isTouchEvent(d)&&mxEvent.isPopupTrigger(d))t.apply(this,arguments);
|
|
|
|
|
else{if(!b.isEnabled()||null!=a&&b.isCellLocked(a.cell))b.customLinkClicked(f),b.getRubberband().reset();mxEvent.consume(d)}};this.editor.getOrCreateFilename=function(){var b=a.defaultFilename,c=a.getCurrentFile();null!=c&&(b=null!=c.getTitle()?c.getTitle():b);return b};var z=this.actions.get("print");z.setEnabled(!mxClient.IS_IOS||!navigator.standalone);z.visible=z.isEnabled();if(!this.editor.chromeless||this.editor.editable)this.keyHandler.bindAction(70,!0,"find"),this.keyHandler.bindAction(67,
|
|
|
|
|
!0,"copyStyle",!0),this.keyHandler.bindAction(86,!0,"pasteStyle",!0),this.keyHandler.bindAction(77,!0,"editGeometry",!0),this.keyHandler.bindAction(88,!0,"insertText",!0),this.keyHandler.bindAction(75,!0,"insertRectangle"),this.keyHandler.bindAction(75,!0,"insertEllipse",!0),mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||(this.altShiftActions[83]="synchronize"),this.installImagePasteHandler(),this.installNativeClipboardHandler();this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||
|
|
|
|
|
0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(a){var b=this.editor.graph,c=b.cellEditor.text2,d=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(a){null!=d&&(d.parentNode.removeChild(d),d=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(a){null==d&&(!mxClient.IS_IE||10<document.documentMode)&&(d=this.highlightElement(c));a.stopPropagation();
|
|
|
|
|
a.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(a){null!=d&&(d.parentNode.removeChild(d),d=null);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,function(a,c,d,f,e,g){b.insertImage(a,e,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()},mxEvent.isControlDown(a));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")){var c=a.dataTransfer.getData("text/uri-list");
|
|
|
|
|
/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(a){var d=Math.max(1,a.width);a=Math.max(1,a.height);var f=this.maxImageSize,f=Math.min(1,Math.min(f/Math.max(1,d)),f/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*f,a*f)})):document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,
|
|
|
|
|
"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));"undefined"!==typeof window.mxSettings&&(z=this.editor.graph.view,z.setUnit(mxSettings.getUnit()),z.addListener("unitChanged",function(a,b){mxSettings.setUnit(b.getProperty("unit"));mxSettings.save()}),this.ruler=!this.canvasSupported||9==document.documentMode||"1"!=urlParams.ruler&&!mxSettings.isRulerOn()||this.editor.isChromelessView()&&!this.editor.editable?null:
|
|
|
|
|
new mxDualRuler(this,z.unit),this.refresh());if("1"==urlParams.styledev){z=document.getElementById("geFooter");null!=z&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),
|
|
|
|
|
this.styleInput.value)})),z.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility="hidden"})));var y=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==
|
|
|
|
|
this.styleInput?!0:y.apply(this,arguments)}}z=document.getElementById("geInfo");null!=z&&z.parentNode.removeChild(z);if(Graph.fileSupport&&(!this.editor.chromeless||this.editor.editable)){var B=null;mxEvent.addListener(b.container,"dragleave",function(a){b.isEnabled()&&(null!=B&&(B.parentNode.removeChild(B),B=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(b.container,"dragover",mxUtils.bind(this,function(a){null==B&&(!mxClient.IS_IE||10<document.documentMode)&&(B=this.highlightElement(b.container));
|
|
|
|
|
null!=this.sidebar&&this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()}));mxEvent.addListener(b.container,"drop",mxUtils.bind(this,function(a){null!=B&&(B.parentNode.removeChild(B),B=null);if(b.isEnabled()){var c=mxUtils.convertPoint(b.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),d=b.view.translate,f=b.view.scale,e=c.x/f-d.x,g=c.y/f-d.y;mxEvent.isAltDown(a)&&(g=e=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,e,g,this.maxImageSize,null,null,null,
|
|
|
|
|
null,mxEvent.isControlDown(a),null,null,mxEvent.isShiftDown(a));else{var l=0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):null,c=this.extractGraphModelFromEvent(a,null!=this.pages);if(null!=c)b.setSelectionCells(this.importXml(c,e,g,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var k=a.dataTransfer.getData("text/html"),c=document.createElement("div");c.innerHTML=k;var n=null,d=c.getElementsByTagName("img");null!=d&&1==d.length?
|
|
|
|
|
(k=d[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)||(n=!0)):(c=c.getElementsByTagName("a"),null!=c&&1==c.length&&(k=c[0].getAttribute("href")));var m=!0,q=mxUtils.bind(this,function(){b.setSelectionCells(this.insertTextAt(k,e,g,!0,n,null,m))});n&&k.length>this.resampleThreshold?this.confirmImageResize(function(a){m=a;q()},mxEvent.isControlDown(a)):q()}else null!=l&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(l)?this.loadImage(decodeURIComponent(l),mxUtils.bind(this,function(a){var c=
|
|
|
|
|
Math.max(1,a.width);a=Math.max(1,a.height);var d=this.maxImageSize,d=Math.min(1,Math.min(d/Math.max(1,c)),d/Math.max(1,a));b.setSelectionCell(b.insertVertex(null,null,"",e,g,c*d,a*d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+l+";"))}),mxUtils.bind(this,function(a){b.setSelectionCells(this.insertTextAt(l,e,g,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&b.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),
|
|
|
|
|
e,g,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();this.editUpdateListener=mxUtils.bind(this,function(a,b){var c=b.getProperty("edit");null!=c&&this.updateEditReferences(c)});this.editor.undoManager.addListener(mxEvent.BEFORE_UNDO,this.editUpdateListener);this.editor.undoManager.addListener(mxEvent.BEFORE_REDO,this.editUpdateListener);"1"==urlParams.embed&&this.initializeEmbedMode();this.installSettings()};EditorUi.prototype.installImagePasteHandler=function(){if(!mxClient.IS_IE){var a=
|
|
|
|
|
this.editor.graph;a.container.addEventListener("paste",mxUtils.bind(this,function(b){if(!mxEvent.isConsumed(b))try{for(var c=b.clipboardData||b.originalEvent.clipboardData,d=!1,f=0;f<c.types.length;f++)if("text/"===c.types[f].substring(0,5)){d=!0;break}if(!d){var e=c.items;for(index in e){var k=e[index];if("file"===k.kind){if(a.isEditing())this.importFiles([k.getAsFile()],0,0,this.maxImageSize,function(b,c,d,f,e,g){a.insertImage(b,e,g)},function(){},function(a){return"image/"==a.type.substring(0,
|
|
|
|
|
6)},function(a){for(var b=0;b<a.length;b++)a[b]()});else{var m=this.editor.graph.getInsertPoint();this.importFiles([k.getAsFile()],m.x,m.y,this.maxImageSize);mxEvent.consume(b)}break}}}}catch(t){}}),!1)}};EditorUi.prototype.installNativeClipboardHandler=function(){function a(){window.setTimeout(function(){d.innerHTML=" ";d.focus();document.execCommand("selectAll",!1,null)},0)}var b=this.editor.graph,d=document.createElement("div");d.setAttribute("autocomplete","off");d.setAttribute("autocorrect",
|
|
|
|
|
"off");d.setAttribute("autocapitalize","off");d.setAttribute("spellcheck","false");d.style.position="absolute";d.style.whiteSpace="nowrap";d.style.overflow="hidden";d.style.display="block";d.contentEditable=!0;mxUtils.setOpacity(d,0);d.style.width="1px";d.style.height="1px";d.innerHTML=" ";var e=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,"keydown",mxUtils.bind(this,function(a){var c=mxEvent.getSource(a);
|
|
|
|
|
null==b.container||!b.isEnabled()||b.isMouseDown||b.isEditing()||null!=this.dialog||"INPUT"==c.nodeName||"TEXTAREA"==c.nodeName||!(224==a.keyCode||!mxClient.IS_MAC&&17==a.keyCode||mxClient.IS_MAC&&91==a.keyCode)||e||(d.style.left=b.container.scrollLeft+10+"px",d.style.top=b.container.scrollTop+10+"px",b.container.appendChild(d),e=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){d.focus();document.execCommand("selectAll",!1,null)},0):(d.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,
|
|
|
|
|
"keyup",mxUtils.bind(this,function(a){var c=a.keyCode;window.setTimeout(mxUtils.bind(this,function(){!e||224!=c&&17!=c&&91!=c||(e=!1,b.isEditing()||null!=this.dialog||null==b.container||b.container.focus(),d.parentNode.removeChild(d),null==this.dialog&&mxUtils.clearSelection())}),0)}));mxEvent.addListener(d,"copy",mxUtils.bind(this,function(c){if(b.isEnabled())try{mxClipboard.copy(b),this.copyCells(d),a()}catch(x){this.handleError(x)}}));mxEvent.addListener(d,"cut",mxUtils.bind(this,function(c){if(b.isEnabled())try{mxClipboard.copy(b),
|
|
|
|
|
this.copyCells(d,!0),a()}catch(x){this.handleError(x)}}));mxEvent.addListener(d,"paste",mxUtils.bind(this,function(a){b.isEnabled()&&!b.isCellLocked(b.getDefaultParent())&&(d.innerHTML=" ",d.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,d);d.innerHTML=" "}),0))}),!0);var k=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==d?!0:k.apply(this,arguments)}};EditorUi.prototype.getLinkTitle=function(a){var b=Graph.prototype.getLinkTitle.apply(this,
|
|
|
|
|
arguments);if("data:page/id,"==a.substring(0,13)){var c=a.indexOf(",");0<c&&(b=this.getPageById(a.substring(c+1)),b=null!=b?b.getName():mxResources.get("pageNotFound"))}else"data:"==a.substring(0,5)&&(b=mxResources.get("action"));return b};EditorUi.prototype.handleCustomLink=function(a){if("data:page/id,"==a.substring(0,13)){var b=a.indexOf(",");if(a=this.getPageById(a.substring(b+1)))this.selectPage(a);else throw Error(mxResources.get("pageNotFound")||"Page not found");}else this.editor.graph.handleCustomLink(a)};
|
|
|
|
|
EditorUi.prototype.isSettingsEnabled=function(){return"undefined"!==typeof window.mxSettings&&(isLocalStorage||mxClient.IS_CHROMEAPP)};EditorUi.prototype.installSettings=function(){if(this.isSettingsEnabled()){ColorDialog.recentColors=mxSettings.getRecentColors();if(isLocalStorage)try{window.addEventListener("storage",mxUtils.bind(this,function(a){a.key==mxSettings.key&&(mxSettings.load(),ColorDialog.recentColors=mxSettings.getRecentColors(),this.menus.customFonts=mxSettings.getCustomFonts())}),!1)}catch(c){}this.fireEvent(new mxEventObject("styleChanged",
|
|
|
|
|
"keys",[],"values",[],"cells",[]));this.menus.customFonts=mxSettings.getCustomFonts();this.addListener("customFontsChanged",mxUtils.bind(this,function(a,b){mxSettings.setCustomFonts(this.menus.customFonts);mxSettings.save()}));this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget());this.fireEvent(new mxEventObject("copyConnectChanged"));this.addListener("copyConnectChanged",mxUtils.bind(this,function(a,b){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());
|
|
|
|
|
mxSettings.save()}));this.editor.graph.pageFormat=mxSettings.getPageFormat();this.addListener("pageFormatChanged",mxUtils.bind(this,function(a,b){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()}));this.editor.graph.view.gridColor=mxSettings.getGridColor("dark"==uiTheme);this.addListener("gridColorChanged",mxUtils.bind(this,function(a,b){console.log("gridColorChanged",this.editor.graph.view.gridColor);mxSettings.setGridColor(this.editor.graph.view.gridColor,"dark"==uiTheme);
|
|
|
|
|
mxSettings.save()}));if(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)this.editor.addListener("autosaveChanged",mxUtils.bind(this,function(a,b){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave();null!=this.sidebar&&this.sidebar.showPalette("search",mxSettings.settings.search);this.editor.chromeless&&!this.editor.editable||null==this.sidebar||!(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||0))||(this.toggleScratchpad(),
|
|
|
|
|
mxSettings.save());this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})}};EditorUi.prototype.copyCells=function(a,b){var c=this.editor.graph;if(c.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),f=mxUtils.getXml(this.editor.graph.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(f));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=f,c.pasteCounter=0);a.focus();
|
|
|
|
|
document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b){if(!mxEvent.isConsumed(a)){var c=b.getElementsByTagName("span");if(null!=c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var d=c[0].getAttribute("data-lucid-content");null!=d&&0<d.length&&(this.convertLucidChart(d,mxUtils.bind(this,function(a){var b=this.editor.graph;b.setSelectionCells(this.importXml(a,0,0));b.scrollCellToVisible(b.getSelectionCell())}),mxUtils.bind(this,
|
|
|
|
|
function(a){this.handleError(a)})),mxEvent.consume(a))}else{var d=this.editor.graph,f=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):b.textContent),e=!1;try{var k=f.lastIndexOf("%3E");0<=k&&k<f.length-3&&(f=f.substring(0,k+3))}catch(t){}try{var c=b.getElementsByTagName("span"),m=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):decodeURIComponent(f);this.isCompatibleString(m)&&(e=!0,f=m)}catch(t){}d.lastPasteXml==f?d.pasteCounter++:(d.lastPasteXml=
|
|
|
|
|
f,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=f&&0<f.length&&(e||this.isCompatibleString(f)?d.setSelectionCells(this.importXml(f,c,c)):(e=d.getInsertPoint(),d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==f&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(f,e.x+c,e.y+c,!0))),!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=this.hoverIcons&&this.hoverIcons.update(d.view.getState(d.getSelectionCell()));try{mxEvent.consume(a)}catch(t){}}}}};
|
|
|
|
|
EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),
|
|
|
|
|
mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:
|
|
|
|
|
a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=c,d=d.getElementsByTagName("img"),0<d.length&&(c=d[0].getAttribute("src"))):0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==
|
|
|
|
|
c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?EditorUi.drawHost+"/":
|
|
|
|
|
"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,e;if(null==a){e=document.body;var l=document.documentElement;d=(e.clientWidth||l.clientWidth)-3;e=Math.max(e.clientHeight||0,l.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,e=a.clientHeight;l=document.createElement("div");l.style.zIndex=mxPopupMenu.prototype.zIndex+
|
|
|
|
|
2;l.style.border="3px dotted rgb(254, 137, 12)";l.style.pointerEvents="none";l.style.position="absolute";l.style.top=b+"px";l.style.left=c+"px";l.style.width=Math.max(0,d-3)+"px";l.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(l):document.body.appendChild(l);return l};EditorUi.prototype.stringToCells=function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),
|
|
|
|
|
d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=0;c<a.length;c++)mxUtils.bind(this,function(a){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){try{var d=c.target.result,f=a.name;if(null!=f&&0<f.length){!this.useCanvasForExport&&/(\.png)$/i.test(f)&&(f=f.substring(0,f.length-4)+".drawio");
|
|
|
|
|
var e=mxUtils.bind(this,function(a){f=0<=f.lastIndexOf(".")?f.substring(0,f.lastIndexOf("."))+".drawio":f+".drawio";if("<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,a,f))}catch(y){this.handleError(y,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,f,b)});if(/(\.v(dx|sdx?))($|\?)/i.test(f)||/(\.vs(x|sx?))($|\?)/i.test(f))this.importVisio(a,
|
|
|
|
|
mxUtils.bind(this,function(a){this.spinner.stop();e(a)}));else if(/(\.*<graphml )/.test(d))this.importGraphML(d,mxUtils.bind(this,function(a){this.spinner.stop();e(a)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,f))this.parseFile(a,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?e(a.responseText):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},
|
|
|
|
|
mxResources.get("errorLoadingFile")))}));else if(this.isLucidChartData(d))/(\.json)$/i.test(f)&&(f=f.substring(0,f.length-5)+".drawio"),this.convertLucidChart(d,mxUtils.bind(this,function(a){this.spinner.stop();this.openLocalFile(a,f,b)}),mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a)}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);
|
|
|
|
|
try{this.loadLibrary(new LocalLibrary(this,c.target.result,a.name))}catch(E){this.handleError(E,mxResources.get("errorLoadingFile"))}}else 0==d.indexOf("PK")?this.importZipFile(a,mxUtils.bind(this,function(a){this.spinner.stop();e(a)}),mxUtils.bind(this,function(){this.spinner.stop();this.openLocalFile(d,f,b)})):("image/png"==a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,f,b))}}catch(E){this.handleError(E)}});c.onerror=mxUtils.bind(this,function(a){this.spinner.stop();
|
|
|
|
|
this.handleError(a);window.openFile=null});"image"===a.type.substring(0,5)&&"image/svg"!==a.type.substring(0,9)?c.readAsDataURL(a):c.readAsText(a)})(a[c])};EditorUi.prototype.openLocalFile=function(a,b,d){var c=this.getCurrentFile(),f=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var c=mxUtils.parseXml(a);null!=c&&(this.editor.setGraphXml(c.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,
|
|
|
|
|
b||this.defaultFilename,d))});if(null!=a&&0<a.length)null==c||!c.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?f():(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&null!=c&&c.isModified()?this.confirm(mxResources.get("allChangesLost"),null,f,mxResources.get("cancel"),mxResources.get("discardChanges")):(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){null!=c&&c.isModified()?
|
|
|
|
|
1)))),p=mxUtils.parseXml(t),t=p.getElementsByTagName("svg");if(0<t.length){var t=t[0],D=z?null:t.getAttribute("content");null!=D&&"<"!=D.charAt(0)&&"%"!=D.charAt(0)&&(D=unescape(window.atob?atob(D):Base64.decode(D,!0)));null!=D&&"%"==D.charAt(0)&&(D=decodeURIComponent(D));null==D||"<mxfile "!==D.substring(0,8)&&"<mxGraphModel "!==D.substring(0,14)?y(c,mxUtils.bind(this,function(){try{if(q.substring(0,u+1),null!=p){var a=p.getElementsByTagName("svg");if(0<a.length){var f=a[0],m=f.getAttribute("width"),
|
|
|
|
|
t=f.getAttribute("height"),m=null!=m&&"%"!=m.charAt(m.length-1)?parseFloat(m):NaN,t=null!=t&&"%"!=t.charAt(t.length-1)?parseFloat(t):NaN,x=f.getAttribute("viewBox");if(null==x||0==x.length)f.setAttribute("viewBox","0 0 "+m+" "+t);else if(isNaN(m)||isNaN(t)){var y=x.split(" ");3<y.length&&(m=parseFloat(y[2]),t=parseFloat(y[3]))}q=this.createSvgDataUri(mxUtils.getXml(f));var v=Math.min(1,Math.min(e/Math.max(1,m)),e/Math.max(1,t)),D=k(q,l.type,b+c*n,d+c*n,Math.max(1,Math.round(m*v)),Math.max(1,Math.round(t*
|
|
|
|
|
v)),l.name);if(isNaN(m)||isNaN(t)){var A=new Image;A.onload=mxUtils.bind(this,function(){m=Math.max(1,A.width);t=Math.max(1,A.height);D[0].geometry.width=m;D[0].geometry.height=t;f.setAttribute("viewBox","0 0 "+m+" "+t);q=this.createSvgDataUri(mxUtils.getXml(f));var a=q.indexOf(";");0<a&&(q=q.substring(0,a)+q.substring(q.indexOf(",",a+1)));g.setCellStyles("image",q,[D[0]])});A.src=this.createSvgDataUri(mxUtils.getXml(f))}return D}}}catch(aa){}return null})):y(c,mxUtils.bind(this,function(){return k(D,
|
|
|
|
|
"text/xml",b+c*n,d+c*n,0,0,l.name)}))}else y(c,mxUtils.bind(this,function(){return null}))}else{t=!1;if("image/png"==l.type){var A=z?null:this.extractGraphModelFromPng(a.target.result);if(null!=A&&0<A.length){var C=new Image;C.src=a.target.result;y(c,mxUtils.bind(this,function(){return k(A,"text/xml",b+c*n,d+c*n,C.width,C.height,l.name)}));t=!0}}t||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),
|
|
|
|
|
mxUtils.bind(this,function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(a.target.result,mxUtils.bind(this,function(g){this.resizeImage(g,a.target.result,mxUtils.bind(this,function(g,m,q){y(c,mxUtils.bind(this,function(){if(null!=g&&g.length<v){var t=f&&this.isResampleImage(a.target.result,x)?Math.min(1,Math.min(e/m,e/q)):1;return k(g,l.type,b+c*n,d+c*n,Math.round(m*t),Math.round(q*t),l.name)}this.handleError({message:mxResources.get("imageTooBig")});
|
|
|
|
|
return null}))}),f,e,x)}),mxUtils.bind(this,function(){this.handleError({message:mxResources.get("invalidOrMissingFile")})})))}else k(a.target.result,l.type,b+c*n,d+c*n,240,160,l.name,function(a){y(c,function(){return a})},l)});/(\.v(dx|sdx?))($|\?)/i.test(l.name)||/(\.vs(x|sx?))($|\?)/i.test(l.name)?k(null,l.type,b+c*n,d+c*n,240,160,l.name,function(a){y(c,function(){return a})},l):"image"==l.type.substring(0,5)?q.readAsDataURL(l):q.readAsText(l)}})(A)});if(g){g=[];for(q=0;q<a.length;q++)g.push(a[q]);
|
|
|
|
|
a=g;this.confirmImageResize(function(a){f=a;y()},t)}else y()};EditorUi.prototype.confirmImageResize=function(a,b){b=null!=b?b:!1;var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},d=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():null,f=function(d,f){if(d||b)mxSettings.setResizeImages(d?f:null),mxSettings.save();c();a(f)};null==d||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){f(a,!0)},function(a){f(a,
|
|
|
|
|
!1)},mxResources.get("resize"),mxResources.get("actualSize"),'<img style="margin-top:8px;" src="'+Editor.loResImage+'"/>','<img style="margin-top:8px;" src="'+Editor.hiResImage+'"/>',isLocalStorage||mxClient.IS_CHROMEAPP)).container,340,isLocalStorage||mxClient.IS_CHROMEAPP?220:200,!0,!0):f(!1,d)};EditorUi.prototype.parseFile=function(a,b,d){d=null!=d?d:a.name;var c=new FormData;c.append("format","xml");c.append("upfile",a,d);var f=new XMLHttpRequest;f.open("POST",OPEN_URL);f.onreadystatechange=function(){b(f)};
|
|
|
|
|
f.send(c);try{EditorUi.logEvent({category:"GLIFFY-IMPORT-FILE",action:"size_"+a.size})}catch(l){}};EditorUi.prototype.isResampleImage=function(a,b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,d,e,k,l){k=null!=k?k:this.maxImageSize;var c=Math.max(1,a.width),f=Math.max(1,a.height);if(e&&this.isResampleImage(b,l))try{var g=Math.max(c/k,f/k);if(1<g){var n=Math.round(c/g),m=Math.round(f/g),q=document.createElement("canvas");q.width=n;q.height=m;q.getContext("2d").drawImage(a,
|
|
|
|
|
0,0,n,m);var u=q.toDataURL();if(u.length<b.length){var p=document.createElement("canvas");p.width=n;p.height=m;var v=p.toDataURL();u!==v&&(b=u,c=n,f=m)}}}catch(Y){}d(b,c,f)};EditorUi.prototype.crcTable=[];for(var d=0;256>d;d++)for(var k=d,m=0;8>m;m++)k=1==(k&1)?3988292384^k>>>1:k>>>1,EditorUi.prototype.crcTable[d]=k;EditorUi.prototype.updateCRC=function(a,b,d,e){for(var c=0;c<e;c++)a=EditorUi.prototype.crcTable[(a^b.charCodeAt(d+c))&255]^a>>>8;return a};EditorUi.prototype.crc32=function(a){this.crcTable=
|
|
|
|
|
this.crcTable||this.createCrcTable();for(var c=-1,b=0;b<a.length;b++)c=c>>>8^this.crcTable[(c^a.charCodeAt(b))&255];return(c^-1)>>>0};EditorUi.prototype.writeGraphModelToPng=function(a,b,d,e,k){function c(a,b){var c=n;n+=b;return a.substring(c,n)}function f(a){a=c(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function g(a){return String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,a&255)}a=a.substring(a.indexOf(",")+1);a=window.atob?atob(a):Base64.decode(a,
|
|
|
|
|
!0);var n=0;if(c(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=k&&k();else if(c(a,4),"IHDR"!=c(a,4))null!=k&&k();else{c(a,17);k=a.substring(0,n);do{var m=f(a);if("IDAT"==c(a,4)){k=a.substring(0,n-8);"pHYs"==b&&"dpi"==d?(d=Math.round(e/.0254),d=g(d)+g(d)+String.fromCharCode(1)):d=d+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+e;e=4294967295;e=this.updateCRC(e,b,0,4);e=this.updateCRC(e,d,0,d.length);k+=g(d.length)+b+d+g(e^4294967295);k+=a.substring(n-8,
|
|
|
|
|
a.length);break}k+=a.substring(n-8,n-4+m);c(a,m);c(a,4)}while(m);return"data:image/png;base64,"+(window.btoa?btoa(k):Base64.encode(k,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){return Editor.extractGraphModelFromPng(a)};EditorUi.prototype.loadImage=function(a,b,d){try{var c=new Image;c.onload=function(){b(c)};null!=d&&(c.onerror=d);c.src=a}catch(n){if(null!=d)d(n);else throw n;}};var p=EditorUi.prototype.init;EditorUi.prototype.init=function(){mxStencilRegistry.allowEval=mxStencilRegistry.allowEval&&
|
|
|
|
|
!this.isOfflineApp();"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var a=this,b=this.editor.graph,d=b.cellEditor.startEditing;b.cellEditor.startEditing=function(c,f){var e=this.graph.getAttributeForCell(c,"plantUmlData");if(null!=e){var g=JSON.parse(e),e=new TextareaDialog(a,mxResources.get("plantUml")+":",g.data,function(d){null!=d&&a.spinner.spin(document.body,mxResources.get("inserting"))&&a.generatePlantUmlImage(d,g.format,function(f,e,l){a.spinner.stop();
|
|
|
|
|
b.getModel().beginUpdate();try{if("txt"==g.format)b.labelChanged(c,"<pre>"+f+"</pre>"),b.updateCellSize(c,!0);else{b.setCellStyles("image",a.convertDataUri(f),[c]);var k=b.model.getGeometry(c);null!=k&&(k=k.clone(),k.width=e,k.height=l,b.cellsResized([c],[k],!1))}b.setAttributeForCell(c,"plantUmlData",JSON.stringify({data:d,format:g.format}))}finally{b.getModel().endUpdate()}},function(b){a.handleError(b)})},null,null,400,220);a.showDialog(e.container,420,300,!0,!0);e.init()}else d.apply(this,arguments)};
|
|
|
|
|
b.getLinkTitle=function(b){return a.getLinkTitle(b)};b.customLinkClicked=function(b){var c=!1;try{a.handleCustomLink(b),c=!0}catch(N){a.handleError(N)}return c};var e=this.clearDefaultStyle;this.clearDefaultStyle=function(){e.apply(this,arguments)};this.isOffline()||"undefined"===typeof window.EditDataDialog||(EditDataDialog.placeholderHelpLink="https://desk.draw.io/support/solutions/articles/16000051979");var k=a.editor.getEditBlankUrl;this.editor.getEditBlankUrl=function(b){b=null!=b?b:"";if(null!=
|
|
|
|
|
a.pages&&null!=a.currentPage)for(var c=0;c<a.pages.length;c++)if(a.pages[c]==a.currentPage){0<c&&(b+=(0<b.length?"&":"?")+"page="+c);break}"1"==urlParams.dev&&(b+=(0<b.length?"&":"?")+"dev=1&drawdev=1");return k.apply(this,arguments)};var l=b.addClickHandler;b.addClickHandler=function(a,c,d){var f=c;c=function(a,c){if(null==c){var d=mxEvent.getSource(a);"a"==d.nodeName.toLowerCase()&&(c=d.getAttribute("href"))}null!=c&&b.isCustomLink(c)&&(mxEvent.isTouchEvent(a)||!mxEvent.isPopupTrigger(a))&&b.customLinkClicked(c)&&
|
|
|
|
|
mxEvent.consume(a);null!=f&&f(a,c)};l.call(this,a,c,d)};p.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(b.view.canvas.ownerSVGElement,null,!0);a.actions.get("print").funct=function(){a.showDialog((new PrintDialog(a)).container,360,null!=a.pages&&1<a.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");var m=b.getExportVariables;b.getExportVariables=function(){var b=m.apply(this,arguments);b.pagecount=null!=a.pages?a.pages.length:1;b.page=null!=
|
|
|
|
|
a.currentPage?a.currentPage.getName():"";b.pagenumber=null!=a.pages&&null!=a.currentPage?mxUtils.indexOf(a.pages,a.currentPage)+1:1;return b};var v=b.getGlobalVariable;b.getGlobalVariable=function(b){return"page"==b&&null!=a.currentPage?a.currentPage.getName():"pagenumber"==b?null!=a.currentPage&&null!=a.pages?mxUtils.indexOf(a.pages,a.currentPage)+1:1:"pagecount"==b?null!=a.pages?a.pages.length:1:v.apply(this,arguments)};var t=b.labelLinkClicked;b.labelLinkClicked=function(a,c,d){var f=c.getAttribute("href");
|
|
|
|
|
if(null==f||!b.isCustomLink(f)||!mxEvent.isTouchEvent(d)&&mxEvent.isPopupTrigger(d))t.apply(this,arguments);else{if(!b.isEnabled()||null!=a&&b.isCellLocked(a.cell))b.customLinkClicked(f),b.getRubberband().reset();mxEvent.consume(d)}};this.editor.getOrCreateFilename=function(){var b=a.defaultFilename,c=a.getCurrentFile();null!=c&&(b=null!=c.getTitle()?c.getTitle():b);return b};var z=this.actions.get("print");z.setEnabled(!mxClient.IS_IOS||!navigator.standalone);z.visible=z.isEnabled();if(!this.editor.chromeless||
|
|
|
|
|
this.editor.editable)this.keyHandler.bindAction(70,!0,"find"),this.keyHandler.bindAction(67,!0,"copyStyle",!0),this.keyHandler.bindAction(86,!0,"pasteStyle",!0),this.keyHandler.bindAction(77,!0,"editGeometry",!0),this.keyHandler.bindAction(88,!0,"insertText",!0),this.keyHandler.bindAction(75,!0,"insertRectangle"),this.keyHandler.bindAction(75,!0,"insertEllipse",!0),mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||(this.altShiftActions[83]="synchronize"),this.installImagePasteHandler(),this.installNativeClipboardHandler();
|
|
|
|
|
this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||0,document.documentElement.clientHeight||0)/2,24);Graph.fileSupport&&this.editor.graph.addListener(mxEvent.EDITING_STARTED,mxUtils.bind(this,function(a){var b=this.editor.graph,c=b.cellEditor.text2,d=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(a){null!=d&&(d.parentNode.removeChild(d),d=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(a){null==
|
|
|
|
|
d&&(!mxClient.IS_IE||10<document.documentMode)&&(d=this.highlightElement(c));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(a){null!=d&&(d.parentNode.removeChild(d),d=null);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,function(a,c,d,f,e,g){b.insertImage(a,e,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()},mxEvent.isControlDown(a));else if(0<=
|
|
|
|
|
mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")){var c=a.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(a){var d=Math.max(1,a.width);a=Math.max(1,a.height);var f=this.maxImageSize,f=Math.min(1,Math.min(f/Math.max(1,d)),f/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*f,a*f)})):document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,
|
|
|
|
|
"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));"undefined"!==typeof window.mxSettings&&(z=this.editor.graph.view,z.setUnit(mxSettings.getUnit()),z.addListener("unitChanged",function(a,b){mxSettings.setUnit(b.getProperty("unit"));mxSettings.save()}),this.ruler=!this.canvasSupported||9==
|
|
|
|
|
document.documentMode||"1"!=urlParams.ruler&&!mxSettings.isRulerOn()||this.editor.isChromelessView()&&!this.editor.editable?null:new mxDualRuler(this,z.unit),this.refresh());if("1"==urlParams.styledev){z=document.getElementById("geFooter");null!=z&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility=
|
|
|
|
|
"hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),z.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||
|
|
|
|
|
"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility="hidden"})));var x=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:x.apply(this,arguments)}}z=document.getElementById("geInfo");null!=z&&z.parentNode.removeChild(z);if(Graph.fileSupport&&(!this.editor.chromeless||this.editor.editable)){var B=null;mxEvent.addListener(b.container,"dragleave",function(a){b.isEnabled()&&(null!=B&&(B.parentNode.removeChild(B),
|
|
|
|
|
B=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(b.container,"dragover",mxUtils.bind(this,function(a){null==B&&(!mxClient.IS_IE||10<document.documentMode)&&(B=this.highlightElement(b.container));null!=this.sidebar&&this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()}));mxEvent.addListener(b.container,"drop",mxUtils.bind(this,function(a){null!=B&&(B.parentNode.removeChild(B),B=null);if(b.isEnabled()){var c=mxUtils.convertPoint(b.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),
|
|
|
|
|
d=b.view.translate,f=b.view.scale,e=c.x/f-d.x,g=c.y/f-d.y;mxEvent.isAltDown(a)&&(g=e=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,e,g,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(a),null,null,mxEvent.isShiftDown(a));else{var l=0<=mxUtils.indexOf(a.dataTransfer.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):null,c=this.extractGraphModelFromEvent(a,null!=this.pages);if(null!=c)b.setSelectionCells(this.importXml(c,e,g,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,
|
|
|
|
|
"text/html")){var k=a.dataTransfer.getData("text/html"),c=document.createElement("div");c.innerHTML=k;var n=null,d=c.getElementsByTagName("img");null!=d&&1==d.length?(k=d[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)||(n=!0)):(c=c.getElementsByTagName("a"),null!=c&&1==c.length&&(k=c[0].getAttribute("href")));var m=!0,q=mxUtils.bind(this,function(){b.setSelectionCells(this.insertTextAt(k,e,g,!0,n,null,m))});n&&k.length>this.resampleThreshold?this.confirmImageResize(function(a){m=
|
|
|
|
|
a;q()},mxEvent.isControlDown(a)):q()}else null!=l&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(l)?this.loadImage(decodeURIComponent(l),mxUtils.bind(this,function(a){var c=Math.max(1,a.width);a=Math.max(1,a.height);var d=this.maxImageSize,d=Math.min(1,Math.min(d/Math.max(1,c)),d/Math.max(1,a));b.setSelectionCell(b.insertVertex(null,null,"",e,g,c*d,a*d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+l+";"))}),mxUtils.bind(this,function(a){b.setSelectionCells(this.insertTextAt(l,
|
|
|
|
|
e,g,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&b.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),e,g,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();this.editUpdateListener=mxUtils.bind(this,function(a,b){var c=b.getProperty("edit");null!=c&&this.updateEditReferences(c)});this.editor.undoManager.addListener(mxEvent.BEFORE_UNDO,this.editUpdateListener);this.editor.undoManager.addListener(mxEvent.BEFORE_REDO,this.editUpdateListener);"1"==
|
|
|
|
|
urlParams.embed&&this.initializeEmbedMode();this.installSettings()};EditorUi.prototype.installImagePasteHandler=function(){if(!mxClient.IS_IE){var a=this.editor.graph;a.container.addEventListener("paste",mxUtils.bind(this,function(b){if(!mxEvent.isConsumed(b))try{for(var c=b.clipboardData||b.originalEvent.clipboardData,d=!1,f=0;f<c.types.length;f++)if("text/"===c.types[f].substring(0,5)){d=!0;break}if(!d){var e=c.items;for(index in e){var k=e[index];if("file"===k.kind){if(a.isEditing())this.importFiles([k.getAsFile()],
|
|
|
|
|
0,0,this.maxImageSize,function(b,c,d,f,e,g){a.insertImage(b,e,g)},function(){},function(a){return"image/"==a.type.substring(0,6)},function(a){for(var b=0;b<a.length;b++)a[b]()});else{var m=this.editor.graph.getInsertPoint();this.importFiles([k.getAsFile()],m.x,m.y,this.maxImageSize);mxEvent.consume(b)}break}}}}catch(t){}}),!1)}};EditorUi.prototype.installNativeClipboardHandler=function(){function a(){window.setTimeout(function(){d.innerHTML=" ";d.focus();document.execCommand("selectAll",!1,null)},
|
|
|
|
|
0)}var b=this.editor.graph,d=document.createElement("div");d.setAttribute("autocomplete","off");d.setAttribute("autocorrect","off");d.setAttribute("autocapitalize","off");d.setAttribute("spellcheck","false");d.style.position="absolute";d.style.whiteSpace="nowrap";d.style.overflow="hidden";d.style.display="block";d.contentEditable=!0;mxUtils.setOpacity(d,0);d.style.width="1px";d.style.height="1px";d.innerHTML=" ";var e=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,
|
|
|
|
|
null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,"keydown",mxUtils.bind(this,function(a){var c=mxEvent.getSource(a);null==b.container||!b.isEnabled()||b.isMouseDown||b.isEditing()||null!=this.dialog||"INPUT"==c.nodeName||"TEXTAREA"==c.nodeName||!(224==a.keyCode||!mxClient.IS_MAC&&17==a.keyCode||mxClient.IS_MAC&&91==a.keyCode)||e||(d.style.left=b.container.scrollLeft+10+"px",d.style.top=b.container.scrollTop+10+"px",b.container.appendChild(d),e=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){d.focus();
|
|
|
|
|
document.execCommand("selectAll",!1,null)},0):(d.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(a){var c=a.keyCode;window.setTimeout(mxUtils.bind(this,function(){!e||224!=c&&17!=c&&91!=c||(e=!1,b.isEditing()||null!=this.dialog||null==b.container||b.container.focus(),d.parentNode.removeChild(d),null==this.dialog&&mxUtils.clearSelection())}),0)}));mxEvent.addListener(d,"copy",mxUtils.bind(this,function(c){if(b.isEnabled())try{mxClipboard.copy(b),
|
|
|
|
|
this.copyCells(d),a()}catch(y){this.handleError(y)}}));mxEvent.addListener(d,"cut",mxUtils.bind(this,function(c){if(b.isEnabled())try{mxClipboard.copy(b),this.copyCells(d,!0),a()}catch(y){this.handleError(y)}}));mxEvent.addListener(d,"paste",mxUtils.bind(this,function(a){b.isEnabled()&&!b.isCellLocked(b.getDefaultParent())&&(d.innerHTML=" ",d.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,d);d.innerHTML=" "}),0))}),!0);var k=this.isSelectionAllowed;this.isSelectionAllowed=
|
|
|
|
|
function(a){return mxEvent.getSource(a)==d?!0:k.apply(this,arguments)}};EditorUi.prototype.getLinkTitle=function(a){var b=Graph.prototype.getLinkTitle.apply(this,arguments);if("data:page/id,"==a.substring(0,13)){var c=a.indexOf(",");0<c&&(b=this.getPageById(a.substring(c+1)),b=null!=b?b.getName():mxResources.get("pageNotFound"))}else"data:"==a.substring(0,5)&&(b=mxResources.get("action"));return b};EditorUi.prototype.handleCustomLink=function(a){if("data:page/id,"==a.substring(0,13)){var b=a.indexOf(",");
|
|
|
|
|
if(a=this.getPageById(a.substring(b+1)))this.selectPage(a);else throw Error(mxResources.get("pageNotFound")||"Page not found");}else this.editor.graph.handleCustomLink(a)};EditorUi.prototype.isSettingsEnabled=function(){return"undefined"!==typeof window.mxSettings&&(isLocalStorage||mxClient.IS_CHROMEAPP)};EditorUi.prototype.installSettings=function(){if(this.isSettingsEnabled()){ColorDialog.recentColors=mxSettings.getRecentColors();if(isLocalStorage)try{window.addEventListener("storage",mxUtils.bind(this,
|
|
|
|
|
function(a){a.key==mxSettings.key&&(mxSettings.load(),ColorDialog.recentColors=mxSettings.getRecentColors(),this.menus.customFonts=mxSettings.getCustomFonts())}),!1)}catch(c){}this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[]));this.menus.customFonts=mxSettings.getCustomFonts();this.addListener("customFontsChanged",mxUtils.bind(this,function(a,b){mxSettings.setCustomFonts(this.menus.customFonts);mxSettings.save()}));this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget());
|
|
|
|
|
this.fireEvent(new mxEventObject("copyConnectChanged"));this.addListener("copyConnectChanged",mxUtils.bind(this,function(a,b){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());mxSettings.save()}));this.editor.graph.pageFormat=mxSettings.getPageFormat();this.addListener("pageFormatChanged",mxUtils.bind(this,function(a,b){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()}));this.editor.graph.view.gridColor=mxSettings.getGridColor("dark"==uiTheme);
|
|
|
|
|
this.addListener("gridColorChanged",mxUtils.bind(this,function(a,b){console.log("gridColorChanged",this.editor.graph.view.gridColor);mxSettings.setGridColor(this.editor.graph.view.gridColor,"dark"==uiTheme);mxSettings.save()}));if(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)this.editor.addListener("autosaveChanged",mxUtils.bind(this,function(a,b){mxSettings.setAutosave(this.editor.autosave);mxSettings.save()})),this.editor.autosave=mxSettings.getAutosave();null!=this.sidebar&&this.sidebar.showPalette("search",
|
|
|
|
|
mxSettings.settings.search);this.editor.chromeless&&!this.editor.editable||null==this.sidebar||!(mxSettings.settings.isNew||8>=parseInt(mxSettings.settings.version||0))||(this.toggleScratchpad(),mxSettings.save());this.addListener("formatWidthChanged",function(){mxSettings.setFormatWidth(this.formatWidth);mxSettings.save()})}};EditorUi.prototype.copyCells=function(a,b){var c=this.editor.graph;if(c.isSelectionEmpty())a.innerHTML="";else{var d=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),
|
|
|
|
|
f=mxUtils.getXml(this.editor.graph.encodeCells(d));mxUtils.setTextContent(a,encodeURIComponent(f));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=f,c.pasteCounter=0);a.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(a,b){if(!mxEvent.isConsumed(a)){var c=b.getElementsByTagName("span");if(null!=c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var d=c[0].getAttribute("data-lucid-content");null!=d&&0<d.length&&
|
|
|
|
|
(this.convertLucidChart(d,mxUtils.bind(this,function(a){var b=this.editor.graph;b.setSelectionCells(this.importXml(a,0,0));b.scrollCellToVisible(b.getSelectionCell())}),mxUtils.bind(this,function(a){this.handleError(a)})),mxEvent.consume(a))}else{var d=this.editor.graph,f=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):b.textContent),e=!1;try{var k=f.lastIndexOf("%3E");0<=k&&k<f.length-3&&(f=f.substring(0,k+3))}catch(t){}try{var c=b.getElementsByTagName("span"),
|
|
|
|
|
m=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):decodeURIComponent(f);this.isCompatibleString(m)&&(e=!0,f=m)}catch(t){}d.lastPasteXml==f?d.pasteCounter++:(d.lastPasteXml=f,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=f&&0<f.length&&(e||this.isCompatibleString(f)?d.setSelectionCells(this.importXml(f,c,c)):(e=d.getInsertPoint(),d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==f&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(f,e.x+c,e.y+c,!0))),
|
|
|
|
|
!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=this.hoverIcons&&this.hoverIcons.update(d.view.getState(d.getSelectionCell()));try{mxEvent.consume(a)}catch(t){}}}}};EditorUi.prototype.addFileDropHandler=function(a){if(Graph.fileSupport)for(var b=null,c=0;c<a.length;c++)mxEvent.addListener(a[c],"dragleave",function(a){null!=b&&(b.parentNode.removeChild(b),b=null);a.stopPropagation();a.preventDefault()}),mxEvent.addListener(a[c],"dragover",mxUtils.bind(this,function(a){(this.editor.graph.isEnabled()||
|
|
|
|
|
"1"!=urlParams.embed)&&null==b&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(b=this.highlightElement());a.stopPropagation();a.preventDefault()})),mxEvent.addListener(a[c],"drop",mxUtils.bind(this,function(a){null!=b&&(b.parentNode.removeChild(b),b=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<a.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(a)&&
|
|
|
|
|
!mxEvent.isShiftDown(a)):this.openFiles(a.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(a);if(null==c){var d=null!=a.dataTransfer?a.dataTransfer:a.clipboardData;null!=d&&(10==document.documentMode||11==document.documentMode?c=d.getData("Text"):(c=null,c=0<=mxUtils.indexOf(d.types,"text/uri-list")?a.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(d.types,"text/html")?d.getData("text/html"):null,null!=c&&0<c.length?(d=document.createElement("div"),d.innerHTML=c,d=d.getElementsByTagName("img"),
|
|
|
|
|
0<d.length&&(c=d[0].getAttribute("src"))):0<=mxUtils.indexOf(d.types,"text/plain")&&(c=d.getData("text/plain"))),null!=c&&("data:image/png;base64,"==c.substring(0,22)?(c=this.extractGraphModelFromPng(c),null!=c&&0<c.length&&this.openLocalFile(c,null,!0)):!this.isOffline()&&this.isRemoteFileFormat(c)?(new mxXmlRequest(OPEN_URL,"format=xml&data="+encodeURIComponent(c))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()&&this.openLocalFile(a.getText(),null,!0)})):/^https?:\/\//.test(c)&&
|
|
|
|
|
(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?EditorUi.drawHost+"/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}a.stopPropagation();a.preventDefault()}))};EditorUi.prototype.highlightElement=function(a){var b=0,c=0,d,e;if(null==a){e=document.body;var l=document.documentElement;d=(e.clientWidth||l.clientWidth)-3;e=Math.max(e.clientHeight||0,l.clientHeight)-
|
|
|
|
|
3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,e=a.clientHeight;l=document.createElement("div");l.style.zIndex=mxPopupMenu.prototype.zIndex+2;l.style.border="3px dotted rgb(254, 137, 12)";l.style.pointerEvents="none";l.style.position="absolute";l.style.top=b+"px";l.style.left=c+"px";l.style.width=Math.max(0,d-3)+"px";l.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(l):document.body.appendChild(l);return l};EditorUi.prototype.stringToCells=
|
|
|
|
|
function(a){a=mxUtils.parseXml(a);var b=this.editor.extractGraphModel(a.documentElement);a=[];if(null!=b){var c=new mxCodec(b.ownerDocument),d=new mxGraphModel;c.decode(b,d);b=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(b);c++)a.push(d.getChildAt(b,c))}return a};EditorUi.prototype.openFiles=function(a,b){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=0;c<a.length;c++)mxUtils.bind(this,function(a){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){try{var d=
|
|
|
|
|
c.target.result,f=a.name;if(null!=f&&0<f.length){!this.useCanvasForExport&&/(\.png)$/i.test(f)&&(f=f.substring(0,f.length-4)+".drawio");var e=mxUtils.bind(this,function(a){f=0<=f.lastIndexOf(".")?f.substring(0,f.lastIndexOf("."))+".drawio":f+".drawio";if("<mxlibrary"==a.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,a,f))}catch(x){this.handleError(x,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,
|
|
|
|
|
f,b)});if(/(\.v(dx|sdx?))($|\?)/i.test(f)||/(\.vs(x|sx?))($|\?)/i.test(f))this.importVisio(a,mxUtils.bind(this,function(a){this.spinner.stop();e(a)}));else if(/(\.*<graphml )/.test(d))this.importGraphML(d,mxUtils.bind(this,function(a){this.spinner.stop();e(a)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,f))this.parseFile(a,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?e(a.responseText):this.handleError({message:mxResources.get(413==
|
|
|
|
|
a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))}));else if(this.isLucidChartData(d))/(\.json)$/i.test(f)&&(f=f.substring(0,f.length-5)+".drawio"),this.convertLucidChart(d,mxUtils.bind(this,function(a){this.spinner.stop();this.openLocalFile(a,f,b)}),mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a)}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,
|
|
|
|
|
this.defaultFilename,b);try{this.loadLibrary(new LocalLibrary(this,c.target.result,a.name))}catch(E){this.handleError(E,mxResources.get("errorLoadingFile"))}}else 0==d.indexOf("PK")?this.importZipFile(a,mxUtils.bind(this,function(a){this.spinner.stop();e(a)}),mxUtils.bind(this,function(){this.spinner.stop();this.openLocalFile(d,f,b)})):("image/png"==a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,f,b))}}catch(E){this.handleError(E)}});c.onerror=
|
|
|
|
|
mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a);window.openFile=null});"image"===a.type.substring(0,5)&&"image/svg"!==a.type.substring(0,9)?c.readAsDataURL(a):c.readAsText(a)})(a[c])};EditorUi.prototype.openLocalFile=function(a,b,d){var c=this.getCurrentFile(),f=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var c=mxUtils.parseXml(a);null!=c&&(this.editor.setGraphXml(c.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,
|
|
|
|
|
a,b||this.defaultFilename,d))});if(null!=a&&0<a.length)null==c||!c.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?f():(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&null!=c&&c.isModified()?this.confirm(mxResources.get("allChangesLost"),null,f,mxResources.get("cancel"),mxResources.get("discardChanges")):(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(a,b),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){null!=c&&c.isModified()?
|
|
|
|
|
this.confirm(mxResources.get("allChangesLost"),null,f,mxResources.get("cancel"),mxResources.get("discardChanges")):f()})));else throw Error(mxResources.get("notADiagramFile"));};EditorUi.prototype.getBasenames=function(){var a={};if(null!=this.pages)for(var b=0;b<this.pages.length;b++)this.updatePageRoot(this.pages[b]),this.addBasenamesForCell(this.pages[b].root,a);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),a);var b=[],d;for(d in a)b.push(d);return b};EditorUi.prototype.addBasenamesForCell=
|
|
|
|
|
function(a,b){function c(a){if(null!=a){var c=a.lastIndexOf(".");0<c&&(a=a.substring(c+1,a.length));null==b[a]&&(b[a]=!0)}}var d=this.editor.graph,f=d.getCellStyle(a);c(mxStencilRegistry.getBasenameForStencil(f[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(c(mxMarker.getPackageForType(f[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(f[mxConstants.STYLE_ENDARROW])));for(var f=d.model.getChildCount(a),e=0;e<f;e++)this.addBasenamesForCell(d.model.getChildAt(a,e),b)};EditorUi.prototype.setGraphEnabled=
|
|
|
|
|
function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=a?"":"none";this.sidebarContainer.style.display=a?"":"none";this.hsplit.style.display=a?"":"none";this.editor.graph.setEnabled(a);null!=this.ruler&&(this.ruler.hRuler.container.style.visibility=a?"":"hidden",this.ruler.vRuler.container.style.visibility=a?"":"hidden");null!=this.tabContainer&&(this.tabContainer.style.visibility=a?"":"hidden");
|
|
|
|
@ -3242,10 +3243,10 @@ k.postMessage(JSON.stringify({event:"draft",result:"discard",message:g}),"*")}),
|
|
|
|
|
message:g}),"*")}return}if("template"==g.action){this.spinner.stop();var l=1==g.enableRecent,m=1==g.enableSearch,n=1==g.enableCustomTemp,l=new NewDialog(this,!1,null!=g.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=g.callback?k.postMessage(JSON.stringify({event:"template",xml:b,blank:b==this.emptyDiagramXml,name:c}),"*"):(a(b,f,b!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}),null,null,null,null,null,null,null,l?mxUtils.bind(this,function(a){this.remoteInvoke("getRecentDiagrams",
|
|
|
|
|
null,null,a,function(){a(null,"Network Error!")})}):null,m?mxUtils.bind(this,function(a,b){this.remoteInvoke("searchDiagrams",[a],null,b,function(){b(null,"Network Error!")})}):null,mxUtils.bind(this,function(a,b,c){k.postMessage(JSON.stringify({event:"template",docUrl:a,info:b,name:c}),"*")}),null,null,n?mxUtils.bind(this,function(a){this.remoteInvoke("getCustomTemplates",null,null,a,function(){a({},0)})}):null);this.showDialog(l.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));
|
|
|
|
|
l.init();return}if("textContent"==g.action){l=this.getDiagramTextContent();k.postMessage(JSON.stringify({event:"textContent",data:l,message:g}),"*");return}if("status"==g.action){null!=g.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(g.messageKey))):null!=g.message&&this.editor.setStatus(mxUtils.htmlEntities(g.message));null!=g.modified&&(this.editor.modified=g.modified);return}if("spinner"==g.action){var p=null!=g.messageKey?mxResources.get(g.messageKey):g.message;null==g.show||
|
|
|
|
|
g.show?this.spinner.spin(document.body,p):this.spinner.stop();return}if("export"==g.action){if("png"==g.format||"xmlpng"==g.format){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){var q=null!=g.xml?g.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var v=this.editor.graph,x=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=g.format;b.message=
|
|
|
|
|
g;b.data=a;b.xml=encodeURIComponent(q);k.postMessage(JSON.stringify(b),"*")}),z=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==g.format&&(a=this.writeGraphModelToPng(a,"tEXt","mxfile",encodeURIComponent(q)));v!=this.editor.graph&&v.container.parentNode.removeChild(v.container);x(a)}),m=g.pageId||(null!=this.pages?this.pages[0].getId():null);if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage.getId()!=m){for(var C=v.getGlobalVariable,v=this.createTemporaryGraph(v.getStylesheet()),
|
|
|
|
|
g.show?this.spinner.spin(document.body,p):this.spinner.stop();return}if("export"==g.action){if("png"==g.format||"xmlpng"==g.format){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin)){var q=null!=g.xml?g.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var v=this.editor.graph,y=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=g.format;b.message=
|
|
|
|
|
g;b.data=a;b.xml=encodeURIComponent(q);k.postMessage(JSON.stringify(b),"*")}),z=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==g.format&&(a=this.writeGraphModelToPng(a,"tEXt","mxfile",encodeURIComponent(q)));v!=this.editor.graph&&v.container.parentNode.removeChild(v.container);y(a)}),m=g.pageId||(null!=this.pages?this.pages[0].getId():null);if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage.getId()!=m){for(var C=v.getGlobalVariable,v=this.createTemporaryGraph(v.getStylesheet()),
|
|
|
|
|
D,l=0;l<this.pages.length;l++)if(this.pages[l].getId()==m){D=this.updatePageRoot(this.pages[l]);break}v.getGlobalVariable=function(a){return"page"==a?D.getName():"pagenumber"==a?1:C.apply(this,arguments)};document.body.appendChild(v.container);v.model.setRoot(D.root)}if(null!=g.layerIds){for(var m=v.model,n=m.getChildCells(m.getRoot()),B={},l=0;l<g.layerIds.length;l++)B[g.layerIds[l]]=!0;for(l=0;l<n.length;l++)m.setVisible(n[l],B[n[l].id]||!1)}this.exportToCanvas(mxUtils.bind(this,function(a){z(a.toDataURL("image/png"))}),
|
|
|
|
|
null,null,null,mxUtils.bind(this,function(){z(null)}),null,null,g.scale,null,null,null,v)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==g.format?"1":"0")+(null!=m?"&pageId="+m:"")+(null!=g.layerIds?"&extras="+encodeURIComponent(JSON.stringify({layerIds:g.layerIds})):"")+(null!=g.scale?"&scale="+g.scale:"")+"&base64=1&xml="+encodeURIComponent(q))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?x("data:image/png;base64,"+a.getText()):z(null)}),mxUtils.bind(this,
|
|
|
|
|
null,null,null,mxUtils.bind(this,function(){z(null)}),null,null,g.scale,null,null,null,v)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==g.format?"1":"0")+(null!=m?"&pageId="+m:"")+(null!=g.layerIds?"&extras="+encodeURIComponent(JSON.stringify({layerIds:g.layerIds})):"")+(null!=g.scale?"&scale="+g.scale:"")+"&base64=1&xml="+encodeURIComponent(q))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?y("data:image/png;base64,"+a.getText()):z(null)}),mxUtils.bind(this,
|
|
|
|
|
function(){z(null)}))}}else{null!=g.xml&&0<g.xml.length&&this.setFileData(g.xml);p=this.createLoadMessage("export");if("html2"==g.format||"html"==g.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))l=this.getXmlFileData(),p.xml=mxUtils.getXml(l),p.data=this.getFileData(null,null,!0,null,null,null,l),p.format=g.format;else if("html"==g.format)q=this.editor.getGraphXml(),p.data=this.getHtml(q,this.editor.graph),p.xml=mxUtils.getXml(q),p.format=g.format;else{mxSvgCanvas2D.prototype.foAltText=
|
|
|
|
|
null;l=this.editor.graph.background;l==mxConstants.NONE&&(l=null);p.xml=this.getFileData(!0,null,null,null,null,null,null,null,null,!1);p.format="svg";if(g.embedImages||null==g.embedImages){if(null==g.spin&&null==g.spinKey||this.spinner.spin(document.body,null!=g.spinKey?mxResources.get(g.spinKey):g.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==g.format?this.getEmbeddedSvg(p.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();p.data=
|
|
|
|
|
this.createSvgDataUri(a);k.postMessage(JSON.stringify(p),"*")})):this.convertImages(this.editor.graph.getSvg(l),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();p.data=this.createSvgDataUri(mxUtils.getXml(a));k.postMessage(JSON.stringify(p),"*")}));return}l="xmlsvg"==g.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(l));p.data=this.createSvgDataUri(l)}k.postMessage(JSON.stringify(p),"*")}return}if("load"==
|
|
|
|
@ -3260,11 +3261,11 @@ mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndE
|
|
|
|
|
mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),b.className="geBigButton geBigStandardButton",b.style.marginLeft="6px",mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),a.appendChild(b)));b=document.createElement("a");mxUtils.write(b,mxResources.get("exit"));b.setAttribute("title",mxResources.get("exit"));b.className="geBigButton geBigStandardButton";b.style.marginLeft="6px";b.style.marginRight="20px";mxEvent.addListener(b,
|
|
|
|
|
"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()}));a.appendChild(b);this.toolbar.container.appendChild(a);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import"),this.isOffline()?
|
|
|
|
|
null:"https://about.draw.io/import-from-csv-to-drawio/"));this.showDialog(this.importCsvDialog.container,640,520,!0,!0,null,null,null,null,!0);this.importCsvDialog.init()};EditorUi.prototype.executeLayoutList=function(a,b){for(var c=this.editor.graph,d=c.getSelectionCells(),f=0;f<a.length;f++){var e=new window[a[f].layout](c);if(null!=a[f].config)for(var k in a[f].config)e[k]=a[f].config[k];this.executeLayout(function(){e.execute(c.getDefaultParent(),0==d.length?null:d)},f==a.length-1,b)}};EditorUi.prototype.importCsv=
|
|
|
|
|
function(a,b){try{var c=a.split("\n"),d=[],f=[],e={};if(0<c.length){var k={},m=null,p=null,v=null,y=null,z=null,u=null,A=null,B=null,Y="",H="auto",P="auto",D=null,K=null,O=40,Q=40,ba=100,W=0,G=this.editor.graph;G.getGraphBounds();for(var Z=function(){null!=b?b(fa):(G.setSelectionCells(fa),G.scrollCellToVisible(G.getSelectionCell()))},na=G.getFreeInsertPoint(),ja=na.x,ca=na.y,na=ca,ka=null,S="auto",B=null,V=[],pa=null,ga=null,R=0;R<c.length&&"#"==c[R].charAt(0);){a=c[R];for(R++;R<c.length&&"\\"==a.charAt(a.length-
|
|
|
|
|
1)&&"#"==c[R].charAt(0);)a=a.substring(0,a.length-1)+mxUtils.trim(c[R].substring(1)),R++;if("#"!=a.charAt(1)){var la=a.indexOf(":");if(0<la){var L=mxUtils.trim(a.substring(1,la)),I=mxUtils.trim(a.substring(la+1));"label"==L?ka=G.sanitizeHtml(I):"labelname"==L&&0<I.length&&"-"!=I?y=I:"labels"==L&&0<I.length&&"-"!=I?z=JSON.parse(I):"style"==L?m=I:"parentstyle"==L?u=I:"stylename"==L&&0<I.length&&"-"!=I?v=I:"styles"==L&&0<I.length&&"-"!=I?p=JSON.parse(I):"identity"==L&&0<I.length&&"-"!=I?A=I:"parent"==
|
|
|
|
|
function(a,b){try{var c=a.split("\n"),d=[],f=[],e={};if(0<c.length){var k={},m=null,p=null,v=null,x=null,z=null,u=null,A=null,B=null,Y="",H="auto",P="auto",D=null,K=null,O=40,Q=40,ba=100,W=0,G=this.editor.graph;G.getGraphBounds();for(var Z=function(){null!=b?b(fa):(G.setSelectionCells(fa),G.scrollCellToVisible(G.getSelectionCell()))},na=G.getFreeInsertPoint(),ja=na.x,ca=na.y,na=ca,ka=null,S="auto",B=null,V=[],pa=null,ga=null,R=0;R<c.length&&"#"==c[R].charAt(0);){a=c[R];for(R++;R<c.length&&"\\"==a.charAt(a.length-
|
|
|
|
|
1)&&"#"==c[R].charAt(0);)a=a.substring(0,a.length-1)+mxUtils.trim(c[R].substring(1)),R++;if("#"!=a.charAt(1)){var la=a.indexOf(":");if(0<la){var L=mxUtils.trim(a.substring(1,la)),I=mxUtils.trim(a.substring(la+1));"label"==L?ka=G.sanitizeHtml(I):"labelname"==L&&0<I.length&&"-"!=I?x=I:"labels"==L&&0<I.length&&"-"!=I?z=JSON.parse(I):"style"==L?m=I:"parentstyle"==L?u=I:"stylename"==L&&0<I.length&&"-"!=I?v=I:"styles"==L&&0<I.length&&"-"!=I?p=JSON.parse(I):"identity"==L&&0<I.length&&"-"!=I?A=I:"parent"==
|
|
|
|
|
L&&0<I.length&&"-"!=I?B=I:"namespace"==L&&0<I.length&&"-"!=I?Y=I:"width"==L?H=I:"height"==L?P=I:"left"==L&&0<I.length?D=I:"top"==L&&0<I.length?K=I:"ignore"==L?ga=I.split(","):"connect"==L?V.push(JSON.parse(I)):"link"==L?pa=I:"padding"==L?W=parseFloat(I):"edgespacing"==L?O=parseFloat(I):"nodespacing"==L?Q=parseFloat(I):"levelspacing"==L?ba=parseFloat(I):"layout"==L&&(S=I)}}}if(null==c[R])throw Error(mxResources.get("invalidOrMissingFile"));var ea=this.editor.csvToArray(c[R]),L=la=null;if(null!=A||
|
|
|
|
|
null!=B)for(var M=0;M<ea.length;M++)A==ea[M]&&(la=M),B==ea[M]&&(L=M);null==ka&&(ka="%"+ea[0]+"%");if(null!=V)for(var T=0;T<V.length;T++)null==k[V[T].to]&&(k[V[T].to]={});G.model.beginUpdate();try{for(M=R+1;M<c.length;M++){var ha=this.editor.csvToArray(c[M]);if(null==ha){var ia=40<c[M].length?c[M].substring(0,40)+"...":c[M];throw Error(M+" ("+ia+") "+mxResources.get("containsValidationErrors"));}if(ha.length==ea.length){var J=null,qa=null!=la?Y+ha[la]:null;null!=qa&&(J=G.model.getCell(qa));var A=null!=
|
|
|
|
|
J,aa=new mxCell(ka,new mxGeometry(ja,na,0,0),m||"whiteSpace=wrap;html=1;");aa.vertex=!0;aa.id=qa;for(var da=0;da<ha.length;da++)G.setAttributeForCell(aa,ea[da],ha[da]);if(null!=y&&null!=z){var Aa=z[aa.getAttribute(y)];null!=Aa&&G.labelChanged(aa,Aa)}if(null!=v&&null!=p){var wa=p[aa.getAttribute(v)];null!=wa&&(aa.style=wa)}G.setAttributeForCell(aa,"placeholders","1");aa.style=G.replacePlaceholders(aa,aa.style);A&&(G.model.setGeometry(J,aa.geometry),G.model.setStyle(J,aa.style),0>mxUtils.indexOf(f,
|
|
|
|
|
J,aa=new mxCell(ka,new mxGeometry(ja,na,0,0),m||"whiteSpace=wrap;html=1;");aa.vertex=!0;aa.id=qa;for(var da=0;da<ha.length;da++)G.setAttributeForCell(aa,ea[da],ha[da]);if(null!=x&&null!=z){var Aa=z[aa.getAttribute(x)];null!=Aa&&G.labelChanged(aa,Aa)}if(null!=v&&null!=p){var wa=p[aa.getAttribute(v)];null!=wa&&(aa.style=wa)}G.setAttributeForCell(aa,"placeholders","1");aa.style=G.replacePlaceholders(aa,aa.style);A&&(G.model.setGeometry(J,aa.geometry),G.model.setStyle(J,aa.style),0>mxUtils.indexOf(f,
|
|
|
|
|
J)&&f.push(J));J=aa;if(!A)for(T=0;T<V.length;T++)k[V[T].to][J.getAttribute(V[T].to)]=J;null!=pa&&"link"!=pa&&(G.setLinkForCell(J,J.getAttribute(pa)),G.setAttributeForCell(J,pa,null));G.fireEvent(new mxEventObject("cellsInserted","cells",[J]));var za=this.editor.graph.getPreferredSizeForCell(J);J.vertex&&(null!=D&&null!=J.getAttribute(D)&&(J.geometry.x=ja+parseFloat(J.getAttribute(D))),null!=K&&null!=J.getAttribute(K)&&(J.geometry.y=ca+parseFloat(J.getAttribute(K))),"@"==H.charAt(0)&&null!=J.getAttribute(H.substring(1))?
|
|
|
|
|
J.geometry.width=parseFloat(J.getAttribute(H.substring(1))):J.geometry.width="auto"==H?za.width+W:parseFloat(H),"@"==P.charAt(0)&&null!=J.getAttribute(P.substring(1))?J.geometry.height=parseFloat(J.getAttribute(P.substring(1))):J.geometry.height="auto"==P?za.height+W:parseFloat(P),na+=J.geometry.height+Q);A?(null==e[qa]&&(e[qa]=[]),e[qa].push(J)):(B=null!=L?G.model.getCell(Y+ha[L]):null,d.push(J),null!=B?(B.style=G.replacePlaceholders(B,u),G.addCell(J,B)):f.push(G.addCell(J)))}}for(var ma=f.slice(),
|
|
|
|
|
fa=f.slice(),T=0;T<V.length;T++)for(var sa=V[T],M=0;M<f.length;M++){var J=f[M],Ea=mxUtils.bind(this,function(a,b,c){var d=b.getAttribute(c.from);if(null!=d){G.setAttributeForCell(b,c.from,null);for(var d=d.split(","),f=0;f<d.length;f++){var e=k[c.to][d[f]];if(null!=e){var g=c.label;null!=c.fromlabel&&(g=(b.getAttribute(c.fromlabel)||"")+(g||""));null!=c.tolabel&&(g=(g||"")+(e.getAttribute(c.tolabel)||""));fa.push(G.insertEdge(null,null,g||"",c.invert?e:a,c.invert?a:e,c.style||G.createCurrentEdgeStyle()));
|
|
|
|
@ -3302,30 +3303,30 @@ mxResources.get("errorLoadingFile"))}}),mxUtils.bind(this,function(){a--;0==a&&t
|
|
|
|
|
[];EditorUi.prototype.remoteInvokeQueue=[];EditorUi.prototype.handleRemoteInvokeReady=function(a){this.remoteWin=a;for(var b=0;b<this.remoteInvokeQueue.length;b++)a.postMessage(this.remoteInvokeQueue[b],"*");this.remoteInvokeQueue=[]};EditorUi.prototype.handleRemoteInvokeResponse=function(a){var b=a.msgMarkers,c=this.remoteInvokeCallbacks[b.callbackId];a.error?c.error&&c.error(a.error.errResp):c.callback&&c.callback.apply(this,a.resp);this.remoteInvokeCallbacks[b.callbackId]=null};EditorUi.prototype.remoteInvoke=
|
|
|
|
|
function(a,b,d,e,k){var c=!0,f=window.setTimeout(mxUtils.bind(this,function(){c=!1;k({code:App.ERROR_TIMEOUT,message:mxResources.get("timeout")})}),this.timeout),g=mxUtils.bind(this,function(){window.clearTimeout(f);c&&e.apply(this,arguments)});d=d||{};d.callbackId=this.remoteInvokeCallbacks.length;this.remoteInvokeCallbacks.push({callback:g,error:k});a=JSON.stringify({event:"remoteInvoke",funtionName:a,functionArgs:b,msgMarkers:d});null!=this.remoteWin?this.remoteWin.postMessage(a,"*"):this.remoteInvokeQueue.push(a)};
|
|
|
|
|
EditorUi.prototype.handleRemoteInvoke=function(a){var b=mxUtils.bind(this,function(b,c){var d={event:"remoteInvokeResponse",msgMarkers:a.msgMarkers};null!=c?d.error={errResp:c}:null!=b&&(d.resp=b);this.remoteWin.postMessage(JSON.stringify(d),"*")});try{var c=a.funtionName,d=this.remoteInvokableFns[c];if(null!=d&&"function"===typeof this[c]){var e=a.functionArgs;Array.isArray(e)||(e=[]);if(d.isAsync)e.push(function(){b(Array.prototype.slice.apply(arguments))}),e.push(function(a){b(null,a||"Unkown Error")}),
|
|
|
|
|
this[c].apply(this,e);else{var l=this[c].apply(this,e);b([l])}}else b(null,"Invalid Call: "+c+" is not found.")}catch(x){b(null,"Invalid Call: An error occured, "+x.message)}};EditorUi.prototype.commentsSupported=function(){var a=this.getCurrentFile();return null!=a?a.commentsSupported():!1};EditorUi.prototype.commentsRefreshNeeded=function(){var a=this.getCurrentFile();return null!=a?a.commentsRefreshNeeded():!0};EditorUi.prototype.commentsSaveNeeded=function(){var a=this.getCurrentFile();return null!=
|
|
|
|
|
this[c].apply(this,e);else{var l=this[c].apply(this,e);b([l])}}else b(null,"Invalid Call: "+c+" is not found.")}catch(y){b(null,"Invalid Call: An error occured, "+y.message)}};EditorUi.prototype.commentsSupported=function(){var a=this.getCurrentFile();return null!=a?a.commentsSupported():!1};EditorUi.prototype.commentsRefreshNeeded=function(){var a=this.getCurrentFile();return null!=a?a.commentsRefreshNeeded():!0};EditorUi.prototype.commentsSaveNeeded=function(){var a=this.getCurrentFile();return null!=
|
|
|
|
|
a?a.commentsSaveNeeded():!1};EditorUi.prototype.getComments=function(a,b){var c=this.getCurrentFile();null!=c?c.getComments(a,b):a([])};EditorUi.prototype.addComment=function(a,b,d){var c=this.getCurrentFile();null!=c?c.addComment(a,b,d):b(Date.now())};EditorUi.prototype.canReplyToReplies=function(){var a=this.getCurrentFile();return null!=a?a.canReplyToReplies():!0};EditorUi.prototype.canComment=function(){var a=this.getCurrentFile();return null!=a?a.canComment():!0};EditorUi.prototype.newComment=
|
|
|
|
|
function(a,b){var c=this.getCurrentFile();return null!=c?c.newComment(a,b):new DrawioComment(this,null,a,Date.now(),Date.now(),!1,b)};EditorUi.prototype.isRevisionHistorySupported=function(){var a=this.getCurrentFile();return null!=a&&a.isRevisionHistorySupported()};EditorUi.prototype.getRevisions=function(a,b){var c=this.getCurrentFile();null!=c&&c.getRevisions?c.getRevisions(a,b):b({message:mxResources.get("unknownError")})};EditorUi.prototype.isRevisionHistoryEnabled=function(){var a=this.getCurrentFile();
|
|
|
|
|
return null!=a&&(a.constructor==DriveFile&&a.isEditable()||a.constructor==DropboxFile)};EditorUi.prototype.getServiceName=function(){return"draw.io"};EditorUi.prototype.addRemoteServiceSecurityCheck=function(a){a.setRequestHeader("Content-Language","da, mi, en, de-DE")}})();
|
|
|
|
|
var CommentsWindow=function(a,b,e,d,k,m){function p(){for(var a=t.getElementsByTagName("div"),b=0,c=0;c<a.length;c++)"none"!=a[c].style.display&&a[c].parentNode==t&&b++;E.style.display=0==b?"block":"none"}function v(a,b,c,d){function e(){b.removeChild(k);b.removeChild(m);g.style.display="block";f.style.display="block"}l={div:b,comment:a,saveCallback:c,deleteOnCancel:d};var f=b.querySelector(".geCommentTxt"),g=b.querySelector(".geCommentActionsList"),k=document.createElement("textarea");k.className=
|
|
|
|
|
"geCommentEditTxtArea";k.style.minHeight=f.offsetHeight+"px";k.value=a.content;b.insertBefore(k,f);var m=document.createElement("div");m.className="geCommentEditBtns";var n=mxUtils.button(mxResources.get("cancel"),function(){d?(b.parentNode.removeChild(b),p()):e();l=null});n.className="geCommentEditBtn";m.appendChild(n);var u=mxUtils.button(mxResources.get("save"),function(){f.innerHTML="";a.content=k.value;mxUtils.write(f,a.content);e();c(a);l=null});mxEvent.addListener(k,"keydown",mxUtils.bind(this,
|
|
|
|
|
function(a){mxEvent.isConsumed(a)||((mxEvent.isControlDown(a)||mxClient.IS_MAC&&mxEvent.isMetaDown(a))&&13==a.keyCode?(u.click(),mxEvent.consume(a)):27==a.keyCode&&(n.click(),mxEvent.consume(a)))}));u.focus();u.className="geCommentEditBtn gePrimaryBtn";m.appendChild(u);b.insertBefore(m,f);g.style.display="none";f.style.display="none";k.focus()}function z(b,c){c.innerHTML="";var d=new Date(b.modifiedDate),e=a.timeSince(d);null==e&&(e=mxResources.get("lessThanAMinute"));mxUtils.write(c,mxResources.get("timeAgo",
|
|
|
|
|
[e],"{1} ago"));c.setAttribute("title",d.toLocaleDateString()+" "+d.toLocaleTimeString())}function B(a){var b=document.createElement("img");b.className="geCommentBusyImg";b.src=IMAGE_PATH+"/spin.gif";a.appendChild(b);a.busyImg=b}function c(a){a.style.border="1px solid red";a.removeChild(a.busyImg)}function f(a){a.style.border="";a.removeChild(a.busyImg)}function g(b,d,e,k,m){function y(a,c,d){var e=document.createElement("li");e.className="geCommentAction";var f=document.createElement("a");f.className=
|
|
|
|
|
"geCommentActionLnk";mxUtils.write(f,a);e.appendChild(f);mxEvent.addListener(f,"click",function(a){c(a,b);a.preventDefault();mxEvent.consume(a)});O.appendChild(e);d&&(e.style.display="none")}function D(){function a(b){c.push(d);if(null!=b.replies)for(var e=0;e<b.replies.length;e++)d=d.nextSibling,a(b.replies[e])}var c=[],d=A;a(b);return{pdiv:d,replies:c}}function x(d,e,l,m,n){function p(){B(t);b.addReply(y,function(a){y.id=a;b.replies.push(y);f(t);l&&l()},function(b){u();c(t);a.handleError(b,null,
|
|
|
|
|
null,null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))},m,n)}function u(){v(y,t,function(a){p()},!0)}var q=D().pdiv,y=a.newComment(d,a.getCurrentUser());y.pCommentId=b.id;null==b.replies&&(b.replies=[]);var t=g(y,b.replies,q,k+1);e?u():p()}if(m||!b.isResolved){E.style.display="none";var A=document.createElement("div");A.className="geCommentContainer";A.setAttribute("data-commentId",b.id);A.style.marginLeft=20*k+5+"px";b.isResolved&&"dark"!=uiTheme&&(A.style.backgroundColor="ghostWhite");
|
|
|
|
|
[e],"{1} ago"));c.setAttribute("title",d.toLocaleDateString()+" "+d.toLocaleTimeString())}function B(a){var b=document.createElement("img");b.className="geCommentBusyImg";b.src=IMAGE_PATH+"/spin.gif";a.appendChild(b);a.busyImg=b}function c(a){a.style.border="1px solid red";a.removeChild(a.busyImg)}function f(a){a.style.border="";a.removeChild(a.busyImg)}function g(b,d,e,k,m){function x(a,c,d){var e=document.createElement("li");e.className="geCommentAction";var f=document.createElement("a");f.className=
|
|
|
|
|
"geCommentActionLnk";mxUtils.write(f,a);e.appendChild(f);mxEvent.addListener(f,"click",function(a){c(a,b);a.preventDefault();mxEvent.consume(a)});O.appendChild(e);d&&(e.style.display="none")}function D(){function a(b){c.push(d);if(null!=b.replies)for(var e=0;e<b.replies.length;e++)d=d.nextSibling,a(b.replies[e])}var c=[],d=A;a(b);return{pdiv:d,replies:c}}function y(d,e,l,m,n){function p(){B(x);b.addReply(t,function(a){t.id=a;b.replies.push(t);f(x);l&&l()},function(b){u();c(x);a.handleError(b,null,
|
|
|
|
|
null,null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))},m,n)}function u(){v(t,x,function(a){p()},!0)}var q=D().pdiv,t=a.newComment(d,a.getCurrentUser());t.pCommentId=b.id;null==b.replies&&(b.replies=[]);var x=g(t,b.replies,q,k+1);e?u():p()}if(m||!b.isResolved){E.style.display="none";var A=document.createElement("div");A.className="geCommentContainer";A.setAttribute("data-commentId",b.id);A.style.marginLeft=20*k+5+"px";b.isResolved&&"dark"!=uiTheme&&(A.style.backgroundColor="ghostWhite");
|
|
|
|
|
var C=document.createElement("div");C.className="geCommentHeader";var F=document.createElement("img");F.className="geCommentUserImg";F.src=b.user.pictureUrl||Editor.userImage;C.appendChild(F);F=document.createElement("div");F.className="geCommentHeaderTxt";C.appendChild(F);var K=document.createElement("div");K.className="geCommentUsername";mxUtils.write(K,b.user.displayName||"");F.appendChild(K);K=document.createElement("div");K.className="geCommentDate";K.setAttribute("data-commentId",b.id);z(b,
|
|
|
|
|
K);F.appendChild(K);A.appendChild(C);C=document.createElement("div");C.className="geCommentTxt";mxUtils.write(C,b.content||"");A.appendChild(C);C=document.createElement("div");C.className="geCommentActions";var O=document.createElement("ul");O.className="geCommentActionsList";C.appendChild(O);q||0!=k&&!n||y(mxResources.get("reply"),function(){x("",!0)},b.isResolved);F=a.getCurrentUser();null==F||F.id!=b.user.id||q||(y(mxResources.get("edit"),function(){function d(){v(b,A,function(){B(A);b.editComment(b.content,
|
|
|
|
|
function(){f(A)},function(b){c(A);d();a.handleError(b,null,null,null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))})})}d()},b.isResolved),y(mxResources.get("delete"),function(){a.confirm(mxResources.get("areYouSure"),function(){B(A);b.deleteComment(function(){for(var a=D(b).replies,c=0;c<a.length;c++)t.removeChild(a[c]);for(c=0;c<d.length;c++)if(d[c]==b){d.splice(c,1);break}E.style.display=0==t.getElementsByTagName("div").length?"block":"none"},function(b){c(A);a.handleError(b,null,null,
|
|
|
|
|
null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))})})},b.isResolved));q||0!=k||y(b.isResolved?mxResources.get("reopen"):mxResources.get("resolve"),function(a){function c(){var c=a.target;c.innerHTML="";b.isResolved=!b.isResolved;mxUtils.write(c,b.isResolved?mxResources.get("reopen"):mxResources.get("resolve"));for(var d=b.isResolved?"none":"",e=D(b).replies,f="dark"==uiTheme?"transparent":b.isResolved?"ghostWhite":"white",g=0;g<e.length;g++){e[g].style.backgroundColor=f;for(var l=e[g].querySelectorAll(".geCommentAction"),
|
|
|
|
|
k=0;k<l.length;k++)l[k]!=c.parentNode&&(l[k].style.display=d);u||(e[g].style.display="none")}p()}b.isResolved?x(mxResources.get("reOpened")+": ",!0,c,!1,!0):x(mxResources.get("markedAsResolved"),!1,c,!0)});A.appendChild(C);null!=e?t.insertBefore(A,e.nextSibling):t.appendChild(A);for(e=0;null!=b.replies&&e<b.replies.length;e++)C=b.replies[e],C.isResolved=b.isResolved,g(C,b.replies,null,k+1,m);null!=l&&(l.comment.id==b.id?(m=b.content,b.content=l.comment.content,v(b,A,l.saveCallback,l.deleteOnCancel),
|
|
|
|
|
b.content=m):null==l.comment.id&&l.comment.pCommentId==b.id&&(t.appendChild(l.div),v(l.comment,l.div,l.saveCallback,l.deleteOnCancel)));return A}}var q=!a.canComment(),n=a.canReplyToReplies(),l=null,x=document.createElement("div");x.className="geCommentsWin";x.style.background="white"==Dialog.backdropColor?"whiteSmoke":Dialog.backdropColor;var C=EditorUi.compactUi?"26px":"30px",t=document.createElement("div");t.className="geCommentsList";t.style.backgroundColor="white"==Dialog.backdropColor?"whiteSmoke":
|
|
|
|
|
Dialog.backdropColor;t.style.bottom=parseInt(C)+7+"px";x.appendChild(t);var E=document.createElement("span");E.style.cssText="display:none;padding-top:10px;text-align:center;";mxUtils.write(E,mxResources.get("noCommentsFound"));var y=document.createElement("div");y.className="geToolbarContainer geCommentsToolbar";y.style.height=C;y.style.padding=EditorUi.compactUi?"4px 0px 3px 0px":"1px";y.style.backgroundColor="white"==Dialog.backdropColor?"whiteSmoke":Dialog.backdropColor;mxClient.IS_QUIRKS&&(y.style.filter=
|
|
|
|
|
K);F.appendChild(K);A.appendChild(C);C=document.createElement("div");C.className="geCommentTxt";mxUtils.write(C,b.content||"");A.appendChild(C);C=document.createElement("div");C.className="geCommentActions";var O=document.createElement("ul");O.className="geCommentActionsList";C.appendChild(O);q||0!=k&&!n||x(mxResources.get("reply"),function(){y("",!0)},b.isResolved);F=a.getCurrentUser();null==F||F.id!=b.user.id||q||(x(mxResources.get("edit"),function(){function d(){v(b,A,function(){B(A);b.editComment(b.content,
|
|
|
|
|
function(){f(A)},function(b){c(A);d();a.handleError(b,null,null,null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))})})}d()},b.isResolved),x(mxResources.get("delete"),function(){a.confirm(mxResources.get("areYouSure"),function(){B(A);b.deleteComment(function(){for(var a=D(b).replies,c=0;c<a.length;c++)t.removeChild(a[c]);for(c=0;c<d.length;c++)if(d[c]==b){d.splice(c,1);break}E.style.display=0==t.getElementsByTagName("div").length?"block":"none"},function(b){c(A);a.handleError(b,null,null,
|
|
|
|
|
null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))})})},b.isResolved));q||0!=k||x(b.isResolved?mxResources.get("reopen"):mxResources.get("resolve"),function(a){function c(){var c=a.target;c.innerHTML="";b.isResolved=!b.isResolved;mxUtils.write(c,b.isResolved?mxResources.get("reopen"):mxResources.get("resolve"));for(var d=b.isResolved?"none":"",e=D(b).replies,f="dark"==uiTheme?"transparent":b.isResolved?"ghostWhite":"white",g=0;g<e.length;g++){e[g].style.backgroundColor=f;for(var l=e[g].querySelectorAll(".geCommentAction"),
|
|
|
|
|
k=0;k<l.length;k++)l[k]!=c.parentNode&&(l[k].style.display=d);u||(e[g].style.display="none")}p()}b.isResolved?y(mxResources.get("reOpened")+": ",!0,c,!1,!0):y(mxResources.get("markedAsResolved"),!1,c,!0)});A.appendChild(C);null!=e?t.insertBefore(A,e.nextSibling):t.appendChild(A);for(e=0;null!=b.replies&&e<b.replies.length;e++)C=b.replies[e],C.isResolved=b.isResolved,g(C,b.replies,null,k+1,m);null!=l&&(l.comment.id==b.id?(m=b.content,b.content=l.comment.content,v(b,A,l.saveCallback,l.deleteOnCancel),
|
|
|
|
|
b.content=m):null==l.comment.id&&l.comment.pCommentId==b.id&&(t.appendChild(l.div),v(l.comment,l.div,l.saveCallback,l.deleteOnCancel)));return A}}var q=!a.canComment(),n=a.canReplyToReplies(),l=null,y=document.createElement("div");y.className="geCommentsWin";y.style.background="white"==Dialog.backdropColor?"whiteSmoke":Dialog.backdropColor;var C=EditorUi.compactUi?"26px":"30px",t=document.createElement("div");t.className="geCommentsList";t.style.backgroundColor="white"==Dialog.backdropColor?"whiteSmoke":
|
|
|
|
|
Dialog.backdropColor;t.style.bottom=parseInt(C)+7+"px";y.appendChild(t);var E=document.createElement("span");E.style.cssText="display:none;padding-top:10px;text-align:center;";mxUtils.write(E,mxResources.get("noCommentsFound"));var x=document.createElement("div");x.className="geToolbarContainer geCommentsToolbar";x.style.height=C;x.style.padding=EditorUi.compactUi?"4px 0px 3px 0px":"1px";x.style.backgroundColor="white"==Dialog.backdropColor?"whiteSmoke":Dialog.backdropColor;mxClient.IS_QUIRKS&&(x.style.filter=
|
|
|
|
|
"none");C=document.createElement("a");C.className="geButton";mxClient.IS_QUIRKS&&(C.style.filter="none");if(!q){var F=C.cloneNode();F.innerHTML='<div class="geSprite geSprite-plus" style="display:inline-block;"></div>';F.setAttribute("title",mxResources.get("create")+"...");mxEvent.addListener(F,"click",function(b){function d(){v(e,l,function(b){B(l);a.addComment(b,function(a){b.id=a;A.push(b);f(l)},function(b){c(l);d();a.handleError(b,null,null,null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))})},
|
|
|
|
|
!0)}var e=a.newComment("",a.getCurrentUser()),l=g(e,A,null,0);d();b.preventDefault();mxEvent.consume(b)});y.appendChild(F)}F=C.cloneNode();F.innerHTML='<img src="'+IMAGE_PATH+'/check.png" style="width: 16px; padding: 2px;">';F.setAttribute("title",mxResources.get("showResolved"));var u=!1;"dark"==uiTheme&&(F.style.filter="invert(100%)");mxEvent.addListener(F,"click",function(a){this.className=(u=!u)?"geButton geCheckedBtn":"geButton";N();a.preventDefault();mxEvent.consume(a)});y.appendChild(F);a.commentsRefreshNeeded()&&
|
|
|
|
|
(F=C.cloneNode(),F.innerHTML='<img src="'+IMAGE_PATH+'/update16.png" style="width: 16px; padding: 2px;">',F.setAttribute("title",mxResources.get("refresh")),"dark"==uiTheme&&(F.style.filter="invert(100%)"),mxEvent.addListener(F,"click",function(a){N();a.preventDefault();mxEvent.consume(a)}),y.appendChild(F));a.commentsSaveNeeded()&&(C=C.cloneNode(),C.innerHTML='<img src="'+IMAGE_PATH+'/save.png" style="width: 20px; padding: 2px;">',C.setAttribute("title",mxResources.get("save")),"dark"==uiTheme&&
|
|
|
|
|
(C.style.filter="invert(100%)"),mxEvent.addListener(C,"click",function(a){m();a.preventDefault();mxEvent.consume(a)}),y.appendChild(C));x.appendChild(y);var A=[],N=mxUtils.bind(this,function(){this.hasError=!1;if(null!=l){l.div=l.div.cloneNode(!0);var b=l.div.querySelector(".geCommentEditTxtArea"),c=l.div.querySelector(".geCommentEditBtns");l.comment.content=b.value;b.parentNode.removeChild(b);c.parentNode.removeChild(c)}t.innerHTML='<div style="padding-top:10px;text-align:center;"><img src="'+IMAGE_PATH+
|
|
|
|
|
!0)}var e=a.newComment("",a.getCurrentUser()),l=g(e,A,null,0);d();b.preventDefault();mxEvent.consume(b)});x.appendChild(F)}F=C.cloneNode();F.innerHTML='<img src="'+IMAGE_PATH+'/check.png" style="width: 16px; padding: 2px;">';F.setAttribute("title",mxResources.get("showResolved"));var u=!1;"dark"==uiTheme&&(F.style.filter="invert(100%)");mxEvent.addListener(F,"click",function(a){this.className=(u=!u)?"geButton geCheckedBtn":"geButton";N();a.preventDefault();mxEvent.consume(a)});x.appendChild(F);a.commentsRefreshNeeded()&&
|
|
|
|
|
(F=C.cloneNode(),F.innerHTML='<img src="'+IMAGE_PATH+'/update16.png" style="width: 16px; padding: 2px;">',F.setAttribute("title",mxResources.get("refresh")),"dark"==uiTheme&&(F.style.filter="invert(100%)"),mxEvent.addListener(F,"click",function(a){N();a.preventDefault();mxEvent.consume(a)}),x.appendChild(F));a.commentsSaveNeeded()&&(C=C.cloneNode(),C.innerHTML='<img src="'+IMAGE_PATH+'/save.png" style="width: 20px; padding: 2px;">',C.setAttribute("title",mxResources.get("save")),"dark"==uiTheme&&
|
|
|
|
|
(C.style.filter="invert(100%)"),mxEvent.addListener(C,"click",function(a){m();a.preventDefault();mxEvent.consume(a)}),x.appendChild(C));y.appendChild(x);var A=[],N=mxUtils.bind(this,function(){this.hasError=!1;if(null!=l){l.div=l.div.cloneNode(!0);var b=l.div.querySelector(".geCommentEditTxtArea"),c=l.div.querySelector(".geCommentEditBtns");l.comment.content=b.value;b.parentNode.removeChild(b);c.parentNode.removeChild(c)}t.innerHTML='<div style="padding-top:10px;text-align:center;"><img src="'+IMAGE_PATH+
|
|
|
|
|
'/spin.gif" valign="middle"> '+mxUtils.htmlEntities(mxResources.get("loading"))+"...</div>";n=a.canReplyToReplies();a.commentsSupported()?a.getComments(function(a){function b(a){if(null!=a){a.sort(function(a,b){return new Date(a.modifiedDate)-new Date(b.modifiedDate)});for(var c=0;c<a.length;c++)b(a[c].replies)}}a.sort(function(a,b){return new Date(a.modifiedDate)-new Date(b.modifiedDate)});t.innerHTML="";t.appendChild(E);E.style.display="block";A=a;for(a=0;a<A.length;a++)b(A[a].replies),g(A[a],A,
|
|
|
|
|
null,0,u);null!=l&&null==l.comment.id&&null==l.comment.pCommentId&&(t.appendChild(l.div),v(l.comment,l.div,l.saveCallback,l.deleteOnCancel))},mxUtils.bind(this,function(a){t.innerHTML=mxUtils.htmlEntities(mxResources.get("error")+(a&&a.message?": "+a.message:""));this.hasError=!0})):t.innerHTML=mxUtils.htmlEntities(mxResources.get("error"))});N();this.refreshComments=N;y=mxUtils.bind(this,function(){function a(b){var d=c[b.id];if(null!=d)for(z(b,d),d=0;null!=b.replies&&d<b.replies.length;d++)a(b.replies[d])}
|
|
|
|
|
if(this.window.isVisible()){for(var b=t.querySelectorAll(".geCommentDate"),c={},d=0;d<b.length;d++){var e=b[d];c[e.getAttribute("data-commentId")]=e}for(d=0;d<A.length;d++)a(A[d])}});setInterval(y,6E4);this.refreshCommentsTime=y;this.window=new mxWindow(mxResources.get("comments"),x,b,e,d,k,!0,!0);this.window.minimumSize=new mxRectangle(0,0,300,200);this.window.destroyOnClose=!1;this.window.setMaximizable(!1);this.window.setResizable(!0);this.window.setClosable(!0);this.window.setVisible(!0);this.window.addListener(mxEvent.SHOW,
|
|
|
|
|
null,0,u);null!=l&&null==l.comment.id&&null==l.comment.pCommentId&&(t.appendChild(l.div),v(l.comment,l.div,l.saveCallback,l.deleteOnCancel))},mxUtils.bind(this,function(a){t.innerHTML=mxUtils.htmlEntities(mxResources.get("error")+(a&&a.message?": "+a.message:""));this.hasError=!0})):t.innerHTML=mxUtils.htmlEntities(mxResources.get("error"))});N();this.refreshComments=N;x=mxUtils.bind(this,function(){function a(b){var d=c[b.id];if(null!=d)for(z(b,d),d=0;null!=b.replies&&d<b.replies.length;d++)a(b.replies[d])}
|
|
|
|
|
if(this.window.isVisible()){for(var b=t.querySelectorAll(".geCommentDate"),c={},d=0;d<b.length;d++){var e=b[d];c[e.getAttribute("data-commentId")]=e}for(d=0;d<A.length;d++)a(A[d])}});setInterval(x,6E4);this.refreshCommentsTime=x;this.window=new mxWindow(mxResources.get("comments"),y,b,e,d,k,!0,!0);this.window.minimumSize=new mxRectangle(0,0,300,200);this.window.destroyOnClose=!1;this.window.setMaximizable(!1);this.window.setResizable(!0);this.window.setClosable(!0);this.window.setVisible(!0);this.window.addListener(mxEvent.SHOW,
|
|
|
|
|
mxUtils.bind(this,function(){this.window.fit()}));this.window.setLocation=function(a,b){var c=window.innerHeight||document.body.clientHeight||document.documentElement.clientHeight;a=Math.max(0,Math.min(a,(window.innerWidth||document.body.clientWidth||document.documentElement.clientWidth)-this.table.clientWidth));b=Math.max(0,Math.min(b,c-this.table.clientHeight-48));this.getX()==a&&this.getY()==b||mxWindow.prototype.setLocation.apply(this,arguments)};var Y=mxUtils.bind(this,function(){var a=this.window.getX(),
|
|
|
|
|
b=this.window.getY();this.window.setLocation(a,b)});mxEvent.addListener(window,"resize",Y);this.destroy=function(){mxEvent.removeListener(window,"resize",Y);this.window.destroy()}},ConfirmDialog=function(a,b,e,d,k,m,p,v,z,B,c){var f=document.createElement("div");f.style.textAlign="center";c=null!=c?c:44;var g=document.createElement("div");g.style.padding="6px";g.style.overflow="auto";g.style.maxHeight=c+"px";g.style.lineHeight="1.2em";mxClient.IS_QUIRKS&&(g.style.height="60px");mxUtils.write(g,b);
|
|
|
|
|
f.appendChild(g);null!=B&&(g=document.createElement("div"),g.style.padding="6px 0 6px 0",b=document.createElement("img"),b.setAttribute("src",B),g.appendChild(b),f.appendChild(g));B=document.createElement("div");B.style.textAlign="center";B.style.whiteSpace="nowrap";var q=document.createElement("input");q.setAttribute("type","checkbox");m=mxUtils.button(m||mxResources.get("cancel"),function(){a.hideDialog();null!=d&&d(q.checked)});m.className="geBtn";null!=v&&(m.innerHTML=v+"<br>"+m.innerHTML,m.style.paddingBottom=
|
|
|
|
@ -3389,24 +3390,24 @@ mxResources.get("copyOf",[a.getName()]))}),d)})};(function(){var a=EditorUi.prot
|
|
|
|
|
a)?d:void 0})),null!=d.relatedPage.root&&a.encodeCell(d.relatedPage.root,k));return k};a.beforeDecode=function(a,b,k){k.ui=a.ui;k.relatedPage=k.ui.getPageById(b.getAttribute("relatedPage"));if(null==k.relatedPage){var d=b.ownerDocument.createElement("diagram");d.setAttribute("id",b.getAttribute("relatedPage"));d.setAttribute("name",b.getAttribute("name"));k.relatedPage=new DiagramPage(d);d=b.getAttribute("viewState");null!=d&&(k.relatedPage.viewState=JSON.parse(d),b.removeAttribute("viewState"));
|
|
|
|
|
b=b.cloneNode(!0);d=b.firstChild;if(null!=d)for(k.relatedPage.root=a.decodeCell(d,!1),k=d.nextSibling,d.parentNode.removeChild(d),d=k;null!=d;){k=d.nextSibling;if(d.nodeType==mxConstants.NODETYPE_ELEMENT){var e=d.getAttribute("id");null==a.lookup(e)&&a.decodeCell(d)}d.parentNode.removeChild(d);d=k}}return b};a.afterDecode=function(a,b,k){k.index=k.previousIndex;return k};mxCodecRegistry.register(a)})();(function(){var a=mxClient.IS_SVG?"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAASCAMAAABhEH5lAAAASFBMVEUAAAAAAAB/f3/9/f319fUfHx/7+/s+Pj69vb0AAAAAAAAAAAAAAAAAAAAAAAAAAAB2dnZ1dXUAAAAAAAAVFRX///8ZGRkGBgbOcI1hAAAAE3RSTlMA+vr9/f38+fb1893Bo00u+/tFvPJUBQAAAIRJREFUGNM0jEcSxCAQAxlydGqD///TNWxZBx1aXVIrWysplbapL3sFxgDq/idXBnHgBPK1nIxwc55vCXl6dRFtrV6svs/A/UjsPcpzA5tqyByD92HqQlMFh45BG6ND1DiKSoPDdm96N77bg5F+wyaEqRGb8ZiOwHQqdg9hehszcLAEIQB2lQ4p/sEpnAAAAABJRU5ErkJggg==":IMAGE_PATH+"/move.png";EditorUi.prototype.altShiftActions[68]=
|
|
|
|
|
"selectDescendants";var b=Graph.prototype.foldCells;Graph.prototype.foldCells=function(a,d,e,v,z){d=null!=d?d:!1;null==e&&(e=this.getFoldableCells(this.getSelectionCells(),a));this.stopEditing();this.model.beginUpdate();try{for(var k=e.slice(),c=[],f=0;f<e.length;f++){var g=this.view.getState(e[f]),m=null!=g?g.style:this.getCellStyle(e[f]);"1"==mxUtils.getValue(m,"treeFolding","0")&&(this.traverse(e[f],!0,mxUtils.bind(this,function(a,b){null!=b&&c.push(b);a!=e[f]&&c.push(a);return a==e[f]||!this.model.isCollapsed(a)})),
|
|
|
|
|
this.model.setCollapsed(e[f],a))}for(f=0;f<c.length;f++)this.model.setVisible(c[f],!a);e=k;e=b.apply(this,arguments)}finally{this.model.endUpdate()}return e};var e=EditorUi.prototype.init;EditorUi.prototype.init=function(){e.apply(this,arguments);this.editor.isChromelessView()&&!this.editor.editable||this.addTrees()};EditorUi.prototype.addTrees=function(){function b(a){return x.isVertex(a)&&e(a)}function d(a){var b=!1;null!=a&&(b=l.view.getState(a),b="1"==(null!=b?b.style:l.getCellStyle(a)).treeMoving);
|
|
|
|
|
return b}function e(a){var b=!1;null!=a&&(a=x.getParent(a),b=l.view.getState(a),b="tree"==(null!=b?b.style:l.getCellStyle(a)).containerType);return b}function v(a){var b=!1;null!=a&&(a=x.getParent(a),b=l.view.getState(a),l.view.getState(a),b=null!=(null!=b?b.style:l.getCellStyle(a)).childLayout);return b}function z(a){a=l.view.getState(a);if(null!=a){var b=l.getIncomingEdges(a.cell);if(0<b.length&&(b=l.view.getState(b[0]),null!=b&&(b=b.absolutePoints,null!=b&&0<b.length&&(b=b[b.length-1],null!=b)))){if(b.y==
|
|
|
|
|
this.model.setCollapsed(e[f],a))}for(f=0;f<c.length;f++)this.model.setVisible(c[f],!a);e=k;e=b.apply(this,arguments)}finally{this.model.endUpdate()}return e};var e=EditorUi.prototype.init;EditorUi.prototype.init=function(){e.apply(this,arguments);this.editor.isChromelessView()&&!this.editor.editable||this.addTrees()};EditorUi.prototype.addTrees=function(){function b(a){return y.isVertex(a)&&e(a)}function d(a){var b=!1;null!=a&&(b=l.view.getState(a),b="1"==(null!=b?b.style:l.getCellStyle(a)).treeMoving);
|
|
|
|
|
return b}function e(a){var b=!1;null!=a&&(a=y.getParent(a),b=l.view.getState(a),b="tree"==(null!=b?b.style:l.getCellStyle(a)).containerType);return b}function v(a){var b=!1;null!=a&&(a=y.getParent(a),b=l.view.getState(a),l.view.getState(a),b=null!=(null!=b?b.style:l.getCellStyle(a)).childLayout);return b}function z(a){a=l.view.getState(a);if(null!=a){var b=l.getIncomingEdges(a.cell);if(0<b.length&&(b=l.view.getState(b[0]),null!=b&&(b=b.absolutePoints,null!=b&&0<b.length&&(b=b[b.length-1],null!=b)))){if(b.y==
|
|
|
|
|
a.y&&Math.abs(b.x-a.getCenterX())<a.width/2)return mxConstants.DIRECTION_SOUTH;if(b.y==a.y+a.height&&Math.abs(b.x-a.getCenterX())<a.width/2)return mxConstants.DIRECTION_NORTH;if(b.x>a.getCenterX())return mxConstants.DIRECTION_WEST}}return mxConstants.DIRECTION_EAST}function B(a,b){b=null!=b?b:!0;l.model.beginUpdate();try{var c=l.model.getParent(a),d=l.getIncomingEdges(a),e=l.cloneCells([d[0],a]);l.model.setTerminal(e[0],l.model.getTerminal(d[0],!0),!0);var f=z(a),g=c.geometry;f==mxConstants.DIRECTION_SOUTH||
|
|
|
|
|
f==mxConstants.DIRECTION_NORTH?e[1].geometry.x+=b?a.geometry.width+10:-e[1].geometry.width-10:e[1].geometry.y+=b?a.geometry.height+10:-e[1].geometry.height-10;l.view.currentRoot!=c&&(e[1].geometry.x-=g.x,e[1].geometry.y-=g.y);var k=l.view.getState(a),m=l.view.scale;if(null!=k){var n=mxRectangle.fromRectangle(k);f==mxConstants.DIRECTION_SOUTH||f==mxConstants.DIRECTION_NORTH?n.x+=(b?a.geometry.width+10:-e[1].geometry.width-10)*m:n.y+=(b?a.geometry.height+10:-e[1].geometry.height-10)*m;var p=l.getOutgoingEdges(l.model.getTerminal(d[0],
|
|
|
|
|
!0));if(null!=p){for(var u=f==mxConstants.DIRECTION_SOUTH||f==mxConstants.DIRECTION_NORTH,q=g=d=0;q<p.length;q++){var y=l.model.getTerminal(p[q],!1);if(f==z(y)){var t=l.view.getState(y);y!=a&&null!=t&&(u&&b!=t.getCenterX()<k.getCenterX()||!u&&b!=t.getCenterY()<k.getCenterY())&&mxUtils.intersects(n,t)&&(d=10+Math.max(d,(Math.min(n.x+n.width,t.x+t.width)-Math.max(n.x,t.x))/m),g=10+Math.max(g,(Math.min(n.y+n.height,t.y+t.height)-Math.max(n.y,t.y))/m))}}u?g=0:d=0;for(q=0;q<p.length;q++)if(y=l.model.getTerminal(p[q],
|
|
|
|
|
!1),f==z(y)&&(t=l.view.getState(y),y!=a&&null!=t&&(u&&b!=t.getCenterX()<k.getCenterX()||!u&&b!=t.getCenterY()<k.getCenterY()))){var v=[];l.traverse(t.cell,!0,function(a,b){null!=b&&v.push(b);v.push(a);return!0});l.moveCells(v,(b?1:-1)*d,(b?1:-1)*g)}}}return l.addCells(e,c)}finally{l.model.endUpdate()}}function c(a){l.model.beginUpdate();try{var b=z(a),c=l.getIncomingEdges(a),d=l.cloneCells([c[0],a]);l.model.setTerminal(c[0],d[1],!1);l.model.setTerminal(d[0],d[1],!0);l.model.setTerminal(d[0],a,!1);
|
|
|
|
|
!0));if(null!=p){for(var u=f==mxConstants.DIRECTION_SOUTH||f==mxConstants.DIRECTION_NORTH,q=g=d=0;q<p.length;q++){var t=l.model.getTerminal(p[q],!1);if(f==z(t)){var x=l.view.getState(t);t!=a&&null!=x&&(u&&b!=x.getCenterX()<k.getCenterX()||!u&&b!=x.getCenterY()<k.getCenterY())&&mxUtils.intersects(n,x)&&(d=10+Math.max(d,(Math.min(n.x+n.width,x.x+x.width)-Math.max(n.x,x.x))/m),g=10+Math.max(g,(Math.min(n.y+n.height,x.y+x.height)-Math.max(n.y,x.y))/m))}}u?g=0:d=0;for(q=0;q<p.length;q++)if(t=l.model.getTerminal(p[q],
|
|
|
|
|
!1),f==z(t)&&(x=l.view.getState(t),t!=a&&null!=x&&(u&&b!=x.getCenterX()<k.getCenterX()||!u&&b!=x.getCenterY()<k.getCenterY()))){var v=[];l.traverse(x.cell,!0,function(a,b){null!=b&&v.push(b);v.push(a);return!0});l.moveCells(v,(b?1:-1)*d,(b?1:-1)*g)}}}return l.addCells(e,c)}finally{l.model.endUpdate()}}function c(a){l.model.beginUpdate();try{var b=z(a),c=l.getIncomingEdges(a),d=l.cloneCells([c[0],a]);l.model.setTerminal(c[0],d[1],!1);l.model.setTerminal(d[0],d[1],!0);l.model.setTerminal(d[0],a,!1);
|
|
|
|
|
var e=l.model.getParent(a),f=e.geometry,g=[];l.view.currentRoot!=e&&(d[1].geometry.x-=f.x,d[1].geometry.y-=f.y);l.traverse(a,!0,function(a,b){null!=b&&g.push(b);g.push(a);return!0});var k=a.geometry.width+40,m=a.geometry.height+40;b==mxConstants.DIRECTION_SOUTH?k=0:b==mxConstants.DIRECTION_NORTH?(k=0,m=-m):b==mxConstants.DIRECTION_WEST?(k=-k,m=0):b==mxConstants.DIRECTION_EAST&&(m=0);l.moveCells(g,k,m);return l.addCells(d,e)}finally{l.model.endUpdate()}}function f(a){l.model.beginUpdate();try{var b=
|
|
|
|
|
l.model.getParent(a),c=l.getIncomingEdges(a),d=l.cloneCells([c[0],a]);l.model.setTerminal(d[0],a,!0);var c=l.getOutgoingEdges(a),e=b.geometry,f=[];l.view.currentRoot==b&&(e=new mxRectangle);for(var g=0;g<c.length;g++){var k=l.model.getTerminal(c[g],!1);null!=k&&f.push(k)}var m=l.view.getBounds(f),n=z(a),p=l.view.translate,u=l.view.scale;n==mxConstants.DIRECTION_SOUTH?(d[1].geometry.x=null==m?a.geometry.x+(a.geometry.width-d[1].geometry.width)/2:(m.x+m.width)/u-p.x-e.x+10,d[1].geometry.y+=d[1].geometry.height-
|
|
|
|
|
e.y+40):n==mxConstants.DIRECTION_NORTH?(d[1].geometry.x=null==m?a.geometry.x+(a.geometry.width-d[1].geometry.width)/2:(m.x+m.width)/u-p.x+-e.x+10,d[1].geometry.y-=d[1].geometry.height+e.y+40):(d[1].geometry.x=n==mxConstants.DIRECTION_WEST?d[1].geometry.x-(d[1].geometry.width+e.x+40):d[1].geometry.x+(d[1].geometry.width-e.x+40),d[1].geometry.y=null==m?a.geometry.y+(a.geometry.height-d[1].geometry.height)/2:(m.y+m.height)/u-p.y+-e.y+10);return l.addCells(d,b)}finally{l.model.endUpdate()}}function g(a,
|
|
|
|
|
b,c){a=l.getOutgoingEdges(a);c=l.view.getState(c);var d=[];if(null!=c&&null!=a){for(var e=0;e<a.length;e++){var f=l.view.getState(l.model.getTerminal(a[e],!1));null!=f&&(!b&&Math.min(f.x+f.width,c.x+c.width)>=Math.max(f.x,c.x)||b&&Math.min(f.y+f.height,c.y+c.height)>=Math.max(f.y,c.y))&&d.push(f)}d.sort(function(a,c){return b?a.x+a.width-c.x-c.width:a.y+a.height-c.y-c.height})}return d}function q(a,b){var c=z(a),d=b==mxConstants.DIRECTION_EAST||b==mxConstants.DIRECTION_WEST;(c==mxConstants.DIRECTION_EAST||
|
|
|
|
|
c==mxConstants.DIRECTION_WEST)==d&&c!=b?n.actions.get("selectParent").funct():c==b?(d=l.getOutgoingEdges(a),null!=d&&0<d.length&&l.setSelectionCell(l.model.getTerminal(d[0],!1))):(c=l.getIncomingEdges(a),null!=c&&0<c.length&&(d=g(l.model.getTerminal(c[0],!0),d,a),c=l.view.getState(a),null!=c&&(c=mxUtils.indexOf(d,c),0<=c&&(c+=b==mxConstants.DIRECTION_NORTH||b==mxConstants.DIRECTION_WEST?-1:1,0<=c&&c<=d.length-1&&l.setSelectionCell(d[c].cell)))))}var n=this,l=n.editor.graph,x=l.getModel(),C=n.menus.createPopupMenu;
|
|
|
|
|
c==mxConstants.DIRECTION_WEST)==d&&c!=b?n.actions.get("selectParent").funct():c==b?(d=l.getOutgoingEdges(a),null!=d&&0<d.length&&l.setSelectionCell(l.model.getTerminal(d[0],!1))):(c=l.getIncomingEdges(a),null!=c&&0<c.length&&(d=g(l.model.getTerminal(c[0],!0),d,a),c=l.view.getState(a),null!=c&&(c=mxUtils.indexOf(d,c),0<=c&&(c+=b==mxConstants.DIRECTION_NORTH||b==mxConstants.DIRECTION_WEST?-1:1,0<=c&&c<=d.length-1&&l.setSelectionCell(d[c].cell)))))}var n=this,l=n.editor.graph,y=l.getModel(),C=n.menus.createPopupMenu;
|
|
|
|
|
n.menus.createPopupMenu=function(a,c,d){C.apply(this,arguments);if(1==l.getSelectionCount()){c=l.getSelectionCell();var e=l.getOutgoingEdges(c);a.addSeparator();null!=e&&0<e.length&&(b(l.getSelectionCell())&&this.addMenuItems(a,["selectChildren"],null,d),this.addMenuItems(a,["selectDescendants"],null,d));b(l.getSelectionCell())&&(a.addSeparator(),0<l.getIncomingEdges(c).length&&this.addMenuItems(a,["selectSiblings","selectParent"],null,d))}};n.actions.addAction("selectChildren",function(){if(l.isEnabled()&&
|
|
|
|
|
1==l.getSelectionCount()){var a=l.getSelectionCell(),a=l.getOutgoingEdges(a);if(null!=a){for(var b=[],c=0;c<a.length;c++)b.push(l.model.getTerminal(a[c],!1));l.setSelectionCells(b)}}},null,null,"Alt+Shift+X");n.actions.addAction("selectSiblings",function(){if(l.isEnabled()&&1==l.getSelectionCount()){var a=l.getSelectionCell(),a=l.getIncomingEdges(a);if(null!=a&&0<a.length&&(a=l.getOutgoingEdges(l.model.getTerminal(a[0],!0)),null!=a)){for(var b=[],c=0;c<a.length;c++)b.push(l.model.getTerminal(a[c],
|
|
|
|
|
!1));l.setSelectionCells(b)}}},null,null,"Alt+Shift+S");n.actions.addAction("selectParent",function(){if(l.isEnabled()&&1==l.getSelectionCount()){var a=l.getSelectionCell(),a=l.getIncomingEdges(a);null!=a&&0<a.length&&l.setSelectionCell(l.model.getTerminal(a[0],!0))}},null,null,"Alt+Shift+P");n.actions.addAction("selectDescendants",function(){if(l.isEnabled()&&1==l.getSelectionCount()){var a=l.getSelectionCell(),b=[];l.traverse(a,!0,function(a,c){null!=c&&b.push(c);b.push(a);return!0});l.setSelectionCells(b)}},
|
|
|
|
|
null,null,"Alt+Shift+D");var t=l.removeCells;l.removeCells=function(a,c){c=null!=c?c:!0;null==a&&(a=this.getDeletableCells(this.getSelectionCells()));c&&(a=this.getDeletableCells(this.addAllEdges(a)));for(var d=[],f=0;f<a.length;f++){var g=a[f];x.isEdge(g)&&e(g)&&(d.push(g),g=x.getTerminal(g,!1));b(g)?(l.traverse(g,!0,function(a,b){null!=b&&d.push(b);d.push(a);return!0}),g=l.getIncomingEdges(a[f]),a=a.concat(g)):d.push(a[f])}a=d;return t.apply(this,arguments)};n.hoverIcons.getStateAt=function(a,c,
|
|
|
|
|
null,null,"Alt+Shift+D");var t=l.removeCells;l.removeCells=function(a,c){c=null!=c?c:!0;null==a&&(a=this.getDeletableCells(this.getSelectionCells()));c&&(a=this.getDeletableCells(this.addAllEdges(a)));for(var d=[],f=0;f<a.length;f++){var g=a[f];y.isEdge(g)&&e(g)&&(d.push(g),g=y.getTerminal(g,!1));b(g)?(l.traverse(g,!0,function(a,b){null!=b&&d.push(b);d.push(a);return!0}),g=l.getIncomingEdges(a[f]),a=a.concat(g)):d.push(a[f])}a=d;return t.apply(this,arguments)};n.hoverIcons.getStateAt=function(a,c,
|
|
|
|
|
d){return b(a.cell)?null:this.graph.view.getState(this.graph.getCellAt(c,d))};var E=l.duplicateCells;l.duplicateCells=function(a,c){a=null!=a?a:this.getSelectionCells();for(var d=a.slice(0),e=0;e<d.length;e++){var f=l.view.getState(d[e]);if(null!=f&&b(f.cell))for(var g=l.getIncomingEdges(f.cell),f=0;f<g.length;f++)mxUtils.remove(g[f],a)}this.model.beginUpdate();try{var k=E.call(this,a,c);if(k.length==a.length)for(e=0;e<a.length;e++)if(b(a[e])){var m=l.getIncomingEdges(k[e]),g=l.getIncomingEdges(a[e]);
|
|
|
|
|
if(0==m.length&&0<g.length){var n=this.cloneCell(g[0]);this.addEdge(n,l.getDefaultParent(),this.model.getTerminal(g[0],!0),k[e])}}}finally{this.model.endUpdate()}return k};var y=l.moveCells;l.moveCells=function(a,c,d,e,f,g,k){var m=null;this.model.beginUpdate();try{var n=f,p=this.view.getState(f),u=null!=p?p.style:this.getCellStyle(f);if(null!=a&&b(f)&&"1"==mxUtils.getValue(u,"treeFolding","0")){for(var q=0;q<a.length;q++)if(b(a[q])||l.model.isEdge(a[q])&&null==l.model.getTerminal(a[q],!0)){f=l.model.getParent(a[q]);
|
|
|
|
|
break}if(null!=n&&f!=n&&null!=this.view.getState(a[0])){var t=l.getIncomingEdges(a[0]);if(0<t.length){var v=l.view.getState(l.model.getTerminal(t[0],!0));if(null!=v){var x=l.view.getState(n);null!=x&&(c=(x.getCenterX()-v.getCenterX())/l.view.scale,d=(x.getCenterY()-v.getCenterY())/l.view.scale)}}}}m=y.apply(this,arguments);if(null!=m&&null!=a&&m.length==a.length)for(q=0;q<m.length;q++)if(this.model.isEdge(m[q]))b(n)&&0>mxUtils.indexOf(m,this.model.getTerminal(m[q],!0))&&this.model.setTerminal(m[q],
|
|
|
|
|
if(0==m.length&&0<g.length){var n=this.cloneCell(g[0]);this.addEdge(n,l.getDefaultParent(),this.model.getTerminal(g[0],!0),k[e])}}}finally{this.model.endUpdate()}return k};var x=l.moveCells;l.moveCells=function(a,c,d,e,f,g,k){var m=null;this.model.beginUpdate();try{var n=f,p=this.view.getState(f),u=null!=p?p.style:this.getCellStyle(f);if(null!=a&&b(f)&&"1"==mxUtils.getValue(u,"treeFolding","0")){for(var q=0;q<a.length;q++)if(b(a[q])||l.model.isEdge(a[q])&&null==l.model.getTerminal(a[q],!0)){f=l.model.getParent(a[q]);
|
|
|
|
|
break}if(null!=n&&f!=n&&null!=this.view.getState(a[0])){var t=l.getIncomingEdges(a[0]);if(0<t.length){var v=l.view.getState(l.model.getTerminal(t[0],!0));if(null!=v){var y=l.view.getState(n);null!=y&&(c=(y.getCenterX()-v.getCenterX())/l.view.scale,d=(y.getCenterY()-v.getCenterY())/l.view.scale)}}}}m=x.apply(this,arguments);if(null!=m&&null!=a&&m.length==a.length)for(q=0;q<m.length;q++)if(this.model.isEdge(m[q]))b(n)&&0>mxUtils.indexOf(m,this.model.getTerminal(m[q],!0))&&this.model.setTerminal(m[q],
|
|
|
|
|
n,!0);else if(b(a[q])&&(t=l.getIncomingEdges(a[q]),0<t.length))if(!e)b(n)&&0>mxUtils.indexOf(a,this.model.getTerminal(t[0],!0))&&this.model.setTerminal(t[0],n,!0);else if(0==l.getIncomingEdges(m[q]).length){p=n;if(null==p||p==l.model.getParent(a[q]))p=l.model.getTerminal(t[0],!0);e=this.cloneCell(t[0]);this.addEdge(e,l.getDefaultParent(),p,m[q])}}finally{this.model.endUpdate()}return m};if(null!=n.sidebar){var F=n.sidebar.dropAndConnect;n.sidebar.dropAndConnect=function(a,c,d,e){var f=l.model,g=null;
|
|
|
|
|
f.beginUpdate();try{if(g=F.apply(this,arguments),b(a))for(var k=0;k<g.length;k++)if(f.isEdge(g[k])&&null==f.getTerminal(g[k],!0)){f.setTerminal(g[k],a,!0);var m=l.getCellGeometry(g[k]);m.points=null;null!=m.getTerminalPoint(!0)&&m.setTerminalPoint(null,!0)}}finally{f.endUpdate()}return g}}var u={88:n.actions.get("selectChildren"),84:n.actions.get("selectSubtree"),80:n.actions.get("selectParent"),83:n.actions.get("selectSiblings")},A=n.onKeyDown;n.onKeyDown=function(a){try{if(l.isEnabled()&&!l.isEditing()&&
|
|
|
|
|
b(l.getSelectionCell())&&1==l.getSelectionCount()){var d=null;0<l.getIncomingEdges(l.getSelectionCell()).length&&(9==a.which?d=mxEvent.isShiftDown(a)?c(l.getSelectionCell()):f(l.getSelectionCell()):13==a.which&&(d=B(l.getSelectionCell(),!mxEvent.isShiftDown(a))));if(null!=d&&0<d.length)1==d.length&&l.model.isEdge(d[0])?l.setSelectionCell(l.model.getTerminal(d[0],!1)):l.setSelectionCell(d[d.length-1]),null!=n.hoverIcons&&n.hoverIcons.update(l.view.getState(l.getSelectionCell())),l.startEditingAtCell(l.getSelectionCell()),
|
|
|
|
@ -3522,8 +3523,8 @@ e.style.whiteSpace="nowrap";e.style.textAlign="left";e.style.zIndex=this.toolbar
|
|
|
|
|
function(){mxUtils.setOpacity(e,0);d=null;k=window.setTimeout(mxUtils.bind(this,function(){e.style.display="none";k=null}),100)}),a||200)}),p=mxUtils.bind(this,function(a){null!=d&&(window.clearTimeout(d),fadeThead=null);null!=k&&(window.clearTimeout(k),fadeThead2=null);e.style.display="";mxUtils.setOpacity(e,a||30)});mxEvent.addListener(this.graph.container,mxClient.IS_POINTER?"pointermove":"mousemove",mxUtils.bind(this,function(a){mxEvent.isTouchEvent(a)||(p(30),m())}));mxEvent.addListener(e,mxClient.IS_POINTER?
|
|
|
|
|
"pointermove":"mousemove",function(a){mxEvent.consume(a)});mxEvent.addListener(e,"mouseenter",mxUtils.bind(this,function(a){p(100)}));mxEvent.addListener(e,"mousemove",mxUtils.bind(this,function(a){p(100);mxEvent.consume(a)}));mxEvent.addListener(e,"mouseleave",mxUtils.bind(this,function(a){mxEvent.isTouchEvent(a)||p(30)}));var v=this.graph,z=v.getTolerance();v.addMouseListener({startX:0,startY:0,scrollLeft:0,scrollTop:0,mouseDown:function(a,b){this.startX=b.getGraphX();this.startY=b.getGraphY();
|
|
|
|
|
this.scrollLeft=v.container.scrollLeft;this.scrollTop=v.container.scrollTop},mouseMove:function(a,b){},mouseUp:function(a,b){mxEvent.isTouchEvent(b.getEvent())&&Math.abs(this.scrollLeft-v.container.scrollLeft)<z&&Math.abs(this.scrollTop-v.container.scrollTop)<z&&Math.abs(this.startX-b.getGraphX())<z&&Math.abs(this.startY-b.getGraphY())<z&&(0<parseFloat(e.style.opacity||0)?m():p(30))}})}for(var B=this.toolbarItems,c=0,f=null,g=null,q=0;q<B.length;q++){var n=B[q];if("pages"==n){g=b.ownerDocument.createElement("div");
|
|
|
|
|
g.style.cssText="display:inline-block;position:relative;padding:3px 4px 0 4px;vertical-align:top;font-family:Helvetica,Arial;font-size:12px;top:4px;cursor:default;";mxUtils.setOpacity(g,70);var l=a(mxUtils.bind(this,function(){this.selectPage(this.currentPage-1)}),Editor.previousImage,mxResources.get("previousPage")||"Previous Page");l.style.borderRightStyle="none";l.style.paddingLeft="0px";l.style.paddingRight="0px";e.appendChild(g);var x=a(mxUtils.bind(this,function(){this.selectPage(this.currentPage+
|
|
|
|
|
1)}),Editor.nextImage,mxResources.get("nextPage")||"Next Page");x.style.paddingLeft="0px";x.style.paddingRight="0px";n=mxUtils.bind(this,function(){g.innerHTML="";mxUtils.write(g,this.currentPage+1+" / "+this.diagrams.length);g.style.display=1<this.diagrams.length?"inline-block":"none";l.style.display=g.style.display;x.style.display=g.style.display});this.addListener("graphChanged",n);n()}else if("zoom"==n)this.zoomEnabled&&(a(mxUtils.bind(this,function(){this.graph.zoomOut()}),Editor.zoomOutImage,
|
|
|
|
|
g.style.cssText="display:inline-block;position:relative;padding:3px 4px 0 4px;vertical-align:top;font-family:Helvetica,Arial;font-size:12px;top:4px;cursor:default;";mxUtils.setOpacity(g,70);var l=a(mxUtils.bind(this,function(){this.selectPage(this.currentPage-1)}),Editor.previousImage,mxResources.get("previousPage")||"Previous Page");l.style.borderRightStyle="none";l.style.paddingLeft="0px";l.style.paddingRight="0px";e.appendChild(g);var y=a(mxUtils.bind(this,function(){this.selectPage(this.currentPage+
|
|
|
|
|
1)}),Editor.nextImage,mxResources.get("nextPage")||"Next Page");y.style.paddingLeft="0px";y.style.paddingRight="0px";n=mxUtils.bind(this,function(){g.innerHTML="";mxUtils.write(g,this.currentPage+1+" / "+this.diagrams.length);g.style.display=1<this.diagrams.length?"inline-block":"none";l.style.display=g.style.display;y.style.display=g.style.display});this.addListener("graphChanged",n);n()}else if("zoom"==n)this.zoomEnabled&&(a(mxUtils.bind(this,function(){this.graph.zoomOut()}),Editor.zoomOutImage,
|
|
|
|
|
mxResources.get("zoomOut")||"Zoom Out"),a(mxUtils.bind(this,function(){this.graph.zoomIn()}),Editor.zoomInImage,mxResources.get("zoomIn")||"Zoom In"),a(mxUtils.bind(this,function(){this.graph.view.scaleAndTranslate(this.graph.initialViewState.scale,this.graph.initialViewState.translate.x,this.graph.initialViewState.translate.y)}),Editor.zoomFitImage,mxResources.get("fit")||"Fit"));else if("layers"==n){if(this.layersEnabled){var C=this.graph.getModel(),t=a(mxUtils.bind(this,function(a){if(null!=f)f.parentNode.removeChild(f),
|
|
|
|
|
f=null;else{f=this.graph.createLayersDialog();mxEvent.addListener(f,"mouseleave",function(){f.parentNode.removeChild(f);f=null});a=t.getBoundingClientRect();f.style.width="140px";f.style.padding="2px 0px 2px 0px";f.style.border="1px solid #d0d0d0";f.style.backgroundColor="#eee";f.style.fontFamily="Helvetica Neue,Helvetica,Arial Unicode MS,Arial";f.style.fontSize="11px";f.style.zIndex=this.toolbarZIndex+1;mxUtils.setOpacity(f,80);var b=mxUtils.getDocumentScrollOrigin(document);f.style.left=b.x+a.left+
|
|
|
|
|
"px";f.style.top=b.y+a.bottom+"px";document.body.appendChild(f)}}),Editor.layersImage,mxResources.get("layers")||"Layers");C.addListener(mxEvent.CHANGE,function(){t.style.display=1<C.getChildCount(C.root)?"inline-block":"none"});t.style.display=1<C.getChildCount(C.root)?"inline-block":"none"}}else"lightbox"==n?this.lightboxEnabled&&a(mxUtils.bind(this,function(){this.showLightbox()}),Editor.maximizeImage,mxResources.get("show")||"Show"):null!=this.graphConfig["toolbar-buttons"]&&(n=this.graphConfig["toolbar-buttons"][n],
|
|
|
|
@ -3550,7 +3551,7 @@ GraphViewer.initCss=function(){try{var a=document.createElement("style");a.type=
|
|
|
|
|
GraphViewer.cachedUrls={};GraphViewer.getUrl=function(a,b,e){if(null!=GraphViewer.cachedUrls[a])b(GraphViewer.cachedUrls[a]);else{var d=0<navigator.userAgent.indexOf("MSIE 9")?new XDomainRequest:new XMLHttpRequest;d.open("GET",a);d.onload=function(){b(null!=d.getText?d.getText():d.responseText)};d.onerror=e;d.send()}};GraphViewer.resizeSensorEnabled=!0;GraphViewer.useResizeSensor=!0;
|
|
|
|
|
(function(){var a=window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(a){return window.setTimeout(a,20)},b=function(e,d){function k(){this.q=[];this.add=function(a){this.q.push(a)};var a,b;this.call=function(){a=0;for(b=this.q.length;a<b;a++)this.q[a].call()}}function m(a,b){return a.currentStyle?a.currentStyle[b]:window.getComputedStyle?window.getComputedStyle(a,null).getPropertyValue(b):a.style[b]}function p(b,c){if(!b.resizedAttached)b.resizedAttached=
|
|
|
|
|
new k,b.resizedAttached.add(c);else if(b.resizedAttached){b.resizedAttached.add(c);return}b.resizeSensor=document.createElement("div");b.resizeSensor.className="resize-sensor";b.resizeSensor.style.cssText="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;";b.resizeSensor.innerHTML='<div class="resize-sensor-expand" style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;"><div style="position: absolute; left: 0; top: 0; transition: 0s;"></div></div><div class="resize-sensor-shrink" style="position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden; z-index: -1; visibility: hidden;"><div style="position: absolute; left: 0; top: 0; transition: 0s; width: 200%; height: 200%"></div></div>';
|
|
|
|
|
b.appendChild(b.resizeSensor);"static"==m(b,"position")&&(b.style.position="relative");var d=b.resizeSensor.childNodes[0],e=d.childNodes[0],f=b.resizeSensor.childNodes[1],g=function(){e.style.width="100000px";e.style.height="100000px";d.scrollLeft=1E5;d.scrollTop=1E5;f.scrollLeft=1E5;f.scrollTop=1E5};g();var p=!1,t=function(){b.resizedAttached&&(p&&(b.resizedAttached.call(),p=!1),a(t))};a(t);var v,y,z,u,A=function(){if((z=b.offsetWidth)!=v||(u=b.offsetHeight)!=y)p=!0,v=z,y=u;g()},B=function(a,b,c){a.attachEvent?
|
|
|
|
|
b.appendChild(b.resizeSensor);"static"==m(b,"position")&&(b.style.position="relative");var d=b.resizeSensor.childNodes[0],e=d.childNodes[0],f=b.resizeSensor.childNodes[1],g=function(){e.style.width="100000px";e.style.height="100000px";d.scrollLeft=1E5;d.scrollTop=1E5;f.scrollLeft=1E5;f.scrollTop=1E5};g();var p=!1,t=function(){b.resizedAttached&&(p&&(b.resizedAttached.call(),p=!1),a(t))};a(t);var v,x,z,u,A=function(){if((z=b.offsetWidth)!=v||(u=b.offsetHeight)!=x)p=!0,v=z,x=u;g()},B=function(a,b,c){a.attachEvent?
|
|
|
|
|
a.attachEvent("on"+b,c):a.addEventListener(b,c)};B(d,"scroll",A);B(f,"scroll",A)}var v=function(){GraphViewer.resizeSensorEnabled&&d()},z=Object.prototype.toString.call(e),B="[object Array]"===z||"[object NodeList]"===z||"[object HTMLCollection]"===z||"undefined"!==typeof jQuery&&e instanceof jQuery||"undefined"!==typeof Elements&&e instanceof Elements;if(B)for(var z=0,c=e.length;z<c;z++)p(e[z],v);else p(e,v);this.detach=function(){if(B)for(var a=0,c=e.length;a<c;a++)b.detach(e[a]);else b.detach(e)}};
|
|
|
|
|
b.detach=function(a){a.resizeSensor&&(a.removeChild(a.resizeSensor),delete a.resizeSensor,delete a.resizedAttached)};window.ResizeSensor=b})();
|
|
|
|
|
(function(){Editor.initMath();GraphViewer.initCss();if(null!=window.onDrawioViewerLoad)window.onDrawioViewerLoad();else GraphViewer.processElements()})();
|
|
|
|
|