|
|
|
@ -8349,19 +8349,19 @@ c?b.push(c.replace(/\\'/g,"'")):void 0!==f?b.push(f.replace(/\\"/g,'"')):void 0!
|
|
|
|
|
19)||/^https?:\/\/[^\/]*\.blob.core.windows.net\//.test(a)||/^https?:\/\/[^\/]*\.iconfinder.com\//.test(a)||/^https?:\/\/[^\/]*\.draw\.io\/proxy/.test(a)||/^https?:\/\/[^\/]*\.github\.io\//.test(a)};Editor.prototype.createImageUrlConverter=function(){var a=new mxUrlConverter;a.updateBaseUrl();var b=a.convert,c=this;a.convert=function(f){if(null!=f){var d="http://"==f.substring(0,7)||"https://"==f.substring(0,8);d&&!navigator.onLine?f=EditorUi.prototype.svgBrokenImage.src:!d||f.substring(0,a.baseUrl.length)==
|
|
|
|
|
a.baseUrl||EditorUi.prototype.crossOriginImages&&c.isCorsEnabledForUrl(f)?"chrome-extension://"!=f.substring(0,19)&&(f=b.apply(this,arguments)):f=PROXY_URL+"?url="+encodeURIComponent(f)}return f};return a};Editor.prototype.createSvgDataUri=function(a){return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(a)))};Editor.prototype.convertImageToDataUri=function(a,b){if(/(\.svg)$/i.test(a))mxUtils.get(a,mxUtils.bind(this,function(a){b(this.createSvgDataUri(a.getText()))}),function(){b(EditorUi.prototype.svgBrokenImage.src)});
|
|
|
|
|
else{var c=new Image;EditorUi.prototype.crossOriginImages&&(c.crossOrigin="anonymous");c.onload=function(){var a=document.createElement("canvas"),f=a.getContext("2d");a.height=c.height;a.width=c.width;f.drawImage(c,0,0);try{b(a.toDataURL())}catch(I){b(EditorUi.prototype.svgBrokenImage.src)}};c.onerror=function(){b(EditorUi.prototype.svgBrokenImage.src)};c.src=a}};Editor.prototype.convertImages=function(a,b,c,f){null==f&&(f=this.createImageUrlConverter());var d=0,l=c||{};c=mxUtils.bind(this,function(c,
|
|
|
|
|
e){for(var p=a.getElementsByTagName(c),g=0;g<p.length;g++)mxUtils.bind(this,function(c){var p=f.convert(c.getAttribute(e));if(null!=p&&"data:"!=p.substring(0,5)){var g=l[p];null==g?(d++,this.convertImageToDataUri(p,function(f){null!=f&&(l[p]=f,c.setAttribute(e,f));d--;0==d&&b(a)})):c.setAttribute(e,g)}else null!=p&&c.setAttribute(e,p)})(p[g])});c("image","xlink:href");c("img","src");0==d&&b(a)};Editor.prototype.base64Encode=function(a){for(var b="",c=0,f=a.length,d,l,e;c<f;){d=a.charCodeAt(c++)&255;
|
|
|
|
|
if(c==f){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(d>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((d&3)<<4);b+="==";break}l=a.charCodeAt(c++);if(c==f){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(d>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((d&3)<<4|(l&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((l&15)<<2);b+="=";break}e=
|
|
|
|
|
a.charCodeAt(c++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(d>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((d&3)<<4|(l&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((l&15)<<2|(e&192)>>6);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e&63)}return b};Editor.prototype.loadUrl=function(a,b,c,f,d,l){try{var e=f||/(\.png)($|\?)/i.test(a)||/(\.jpe?g)($|\?)/i.test(a)||
|
|
|
|
|
/(\.gif)($|\?)/i.test(a);d=null!=d?d:!0;var p=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(e){if((9==document.documentMode||10==document.documentMode)&&"undefined"!==typeof window.mxUtilsBinaryToArray){a=mxUtilsBinaryToArray(a.request.responseBody).toArray();for(var f=Array(a.length),d=0;d<a.length;d++)f[d]=String.fromCharCode(a[d]);f=f.join("")}l=null!=l?l:"data:image/png;base64,";f=l+this.base64Encode(f)}b(f)}}else null!=
|
|
|
|
|
c&&c({code:App.ERROR_UNKNOWN},a)}),function(){null!=c&&c({code:App.ERROR_UNKNOWN})},e,this.timeout,function(){d&&null!=c&&c({code:App.ERROR_TIMEOUT,retry:p})})});p()}catch(K){null!=c&&c(K)}};Editor.prototype.loadFonts=function(a){if(null!=this.fontCss&&null==this.resolvedFontCss){var b=function(a){return a.replace(RegExp("^[\\s\"']+","g"),"").replace(RegExp("[\\s\"']+$","g"),"")},c=this.fontCss.split("url("),f=0,d={},l=mxUtils.bind(this,function(){if(0==f){for(var l=[c[0]],e=1;e<c.length;e++){var p=
|
|
|
|
|
c[e].indexOf(")");l.push('url("');l.push(d[b(c[e].substring(0,p))]);l.push('"'+c[e].substring(p))}this.resolvedFontCss=l.join("");a()}});if(0<c.length)for(var e=1;e<c.length;e++){var p=c[e].indexOf(")"),g=null,k=c[e].indexOf("format(",p);0<k&&(g=b(c[e].substring(k+7,c[e].indexOf(")",k))));mxUtils.bind(this,function(a){if(null==d[a]){d[a]=a;f++;var b="application/x-font-ttf";if("svg"==g||/(\.svg)($|\?)/i.test(a))b="image/svg+xml";else if("otf"==g||"embedded-opentype"==g||/(\.otf)($|\?)/i.test(a))b=
|
|
|
|
|
e){for(var p=a.getElementsByTagName(c),g=0;g<p.length;g++)mxUtils.bind(this,function(c){var p=f.convert(c.getAttribute(e));if(null!=p&&"data:"!=p.substring(0,5)){var g=l[p];null==g?(d++,this.convertImageToDataUri(p,function(f){null!=f&&(l[p]=f,c.setAttribute(e,f));d--;0==d&&b(a)})):c.setAttribute(e,g)}else null!=p&&c.setAttribute(e,p)})(p[g])});c("image","xlink:href");c("img","src");0==d&&b(a)};Editor.prototype.base64Encode=function(a){for(var b="",c=0,f=a.length,d,l,p;c<f;){d=a.charCodeAt(c++)&255;
|
|
|
|
|
if(c==f){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(d>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((d&3)<<4);b+="==";break}l=a.charCodeAt(c++);if(c==f){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(d>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((d&3)<<4|(l&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((l&15)<<2);b+="=";break}p=
|
|
|
|
|
a.charCodeAt(c++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(d>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((d&3)<<4|(l&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((l&15)<<2|(p&192)>>6);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(p&63)}return b};Editor.prototype.loadUrl=function(a,b,c,f,d,l){try{var p=f||/(\.png)($|\?)/i.test(a)||/(\.jpe?g)($|\?)/i.test(a)||
|
|
|
|
|
/(\.gif)($|\?)/i.test(a);d=null!=d?d:!0;var e=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(p){if((9==document.documentMode||10==document.documentMode)&&"undefined"!==typeof window.mxUtilsBinaryToArray){a=mxUtilsBinaryToArray(a.request.responseBody).toArray();for(var f=Array(a.length),d=0;d<a.length;d++)f[d]=String.fromCharCode(a[d]);f=f.join("")}l=null!=l?l:"data:image/png;base64,";f=l+this.base64Encode(f)}b(f)}}else null!=
|
|
|
|
|
c&&c({code:App.ERROR_UNKNOWN},a)}),function(){null!=c&&c({code:App.ERROR_UNKNOWN})},p,this.timeout,function(){d&&null!=c&&c({code:App.ERROR_TIMEOUT,retry:e})})});e()}catch(K){null!=c&&c(K)}};Editor.prototype.loadFonts=function(a){if(null!=this.fontCss&&null==this.resolvedFontCss){var b=function(a){return a.replace(RegExp("^[\\s\"']+","g"),"").replace(RegExp("[\\s\"']+$","g"),"")},c=this.fontCss.split("url("),f=0,d={},l=mxUtils.bind(this,function(){if(0==f){for(var l=[c[0]],p=1;p<c.length;p++){var e=
|
|
|
|
|
c[p].indexOf(")");l.push('url("');l.push(d[b(c[p].substring(0,e))]);l.push('"'+c[p].substring(e))}this.resolvedFontCss=l.join("");a()}});if(0<c.length)for(var p=1;p<c.length;p++){var e=c[p].indexOf(")"),g=null,k=c[p].indexOf("format(",e);0<k&&(g=b(c[p].substring(k+7,c[p].indexOf(")",k))));mxUtils.bind(this,function(a){if(null==d[a]){d[a]=a;f++;var b="application/x-font-ttf";if("svg"==g||/(\.svg)($|\?)/i.test(a))b="image/svg+xml";else if("otf"==g||"embedded-opentype"==g||/(\.otf)($|\?)/i.test(a))b=
|
|
|
|
|
"application/x-font-opentype";else if("woff"==g||/(\.woff)($|\?)/i.test(a))b="application/font-woff";else if("woff2"==g||/(\.woff2)($|\?)/i.test(a))b="application/font-woff2";else if("eot"==g||/(\.eot)($|\?)/i.test(a))b="application/vnd.ms-fontobject";else if("sfnt"==g||/(\.sfnt)($|\?)/i.test(a))b="application/font-sfnt";var c=a;/^https?:\/\//.test(c)&&!this.isCorsEnabledForUrl(c)&&(c=PROXY_URL+"?url="+encodeURIComponent(a));this.loadUrl(c,mxUtils.bind(this,function(b){d[a]=b;f--;l()}),mxUtils.bind(this,
|
|
|
|
|
function(a){f--;l()}),!0,null,"data:"+b+";charset=utf-8;base64,")}})(b(c[e].substring(0,p)),g)}}else a()};Editor.prototype.convertMath=function(a,b,c,f){a.mathEnabled&&"undefined"!==typeof MathJax&&"undefined"!==typeof MathJax.Hub?(Editor.MathJaxRender(b),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,b,c,f,d,l,e,p,g,k,t,v,u,B){l=null!=l?l:!0;v=null!=v?v:this.graph;u=null!=u?u:0;var y=g?null:v.background;y==mxConstants.NONE&&(y=null);null==y&&(y=f);null==y&&0==g&&(y=this.graph.defaultPageBackgroundColor);this.convertImages(v.getSvg(y,null,null,B,null,null!=e?e:!0,null,null,null,k),mxUtils.bind(this,function(c){var f=new Image;f.onload=mxUtils.bind(this,function(){try{var e=document.createElement("canvas"),g=parseInt(c.getAttribute("width")),k=parseInt(c.getAttribute("height"));p=null!=
|
|
|
|
|
p?p:1;null!=b&&(p=l?Math.min(1,Math.min(3*b/(4*k),b/g)):b/g);g=Math.ceil(p*g)+2*u;k=Math.ceil(p*k)+2*u;e.setAttribute("width",g);e.setAttribute("height",k);var t=e.getContext("2d");null!=y&&(t.beginPath(),t.rect(0,0,g,k),t.fillStyle=y,t.fill());t.scale(p,p);mxClient.IS_SF?window.setTimeout(function(){t.drawImage(f,u/p,u/p);a(e)},0):(t.drawImage(f,u/p,u/p),a(e))}catch(X){null!=d&&d(X)}});f.onerror=function(a){null!=d&&d(a)};try{k&&this.graph.addSvgShadow(c);var e=mxUtils.bind(this,function(){if(null!=
|
|
|
|
|
this.resolvedFontCss){var a=document.createElement("style");a.setAttribute("type","text/css");a.innerHTML=this.resolvedFontCss;c.getElementsByTagName("defs")[0].appendChild(a)}this.convertMath(v,c,!0,mxUtils.bind(this,function(){f.src=this.createSvgDataUri(mxUtils.getXml(c))}))});this.loadFonts(e)}catch(U){null!=d&&d(U)}}),c,t)};Editor.prototype.writeGraphModelToPng=function(a,b,c,f,d){function l(a,b){var c=g;g+=b;return a.substring(c,g)}function e(a){a=l(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<
|
|
|
|
|
8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function p(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 g=0;if(l(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=d&&d();else if(l(a,4),"IHDR"!=l(a,4))null!=d&&d();else{l(a,17);d=a.substring(0,g);do{var k=e(a);if("IDAT"==l(a,4)){d=a.substring(0,g-8);c=c+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+f;f=4294967295;
|
|
|
|
|
f=EditorUi.prototype.updateCRC(f,b,0,4);f=EditorUi.prototype.updateCRC(f,c,0,c.length);d+=p(c.length)+b+c+p(f^4294967295);d+=a.substring(g-8,a.length);break}d+=a.substring(g-8,g-4+k);l(a,k);l(a,4)}while(k);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 g=ColorDialog.addRecentColor;ColorDialog.addRecentColor=function(a,b){g.apply(this,arguments);mxSettings.setRecentColors(ColorDialog.recentColors);
|
|
|
|
|
function(a){f--;l()}),!0,null,"data:"+b+";charset=utf-8;base64,")}})(b(c[p].substring(0,e)),g)}}else a()};Editor.prototype.convertMath=function(a,b,c,f){a.mathEnabled&&"undefined"!==typeof MathJax&&"undefined"!==typeof MathJax.Hub?(Editor.MathJaxRender(b),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,b,c,f,d,l,p,e,g,k,t,v,u,B){l=null!=l?l:!0;v=null!=v?v:this.graph;u=null!=u?u:0;var y=g?null:v.background;y==mxConstants.NONE&&(y=null);null==y&&(y=f);null==y&&0==g&&(y=this.graph.defaultPageBackgroundColor);this.convertImages(v.getSvg(y,null,null,B,null,null!=p?p:!0,null,null,null,k),mxUtils.bind(this,function(c){var f=new Image;f.onload=mxUtils.bind(this,function(){try{var p=document.createElement("canvas"),g=parseInt(c.getAttribute("width")),k=parseInt(c.getAttribute("height"));e=null!=
|
|
|
|
|
e?e:1;null!=b&&(e=l?Math.min(1,Math.min(3*b/(4*k),b/g)):b/g);g=Math.ceil(e*g)+2*u;k=Math.ceil(e*k)+2*u;p.setAttribute("width",g);p.setAttribute("height",k);var t=p.getContext("2d");null!=y&&(t.beginPath(),t.rect(0,0,g,k),t.fillStyle=y,t.fill());t.scale(e,e);mxClient.IS_SF?window.setTimeout(function(){t.drawImage(f,u/e,u/e);a(p)},0):(t.drawImage(f,u/e,u/e),a(p))}catch(X){null!=d&&d(X)}});f.onerror=function(a){null!=d&&d(a)};try{k&&this.graph.addSvgShadow(c);var p=mxUtils.bind(this,function(){if(null!=
|
|
|
|
|
this.resolvedFontCss){var a=document.createElement("style");a.setAttribute("type","text/css");a.innerHTML=this.resolvedFontCss;c.getElementsByTagName("defs")[0].appendChild(a)}this.convertMath(v,c,!0,mxUtils.bind(this,function(){f.src=this.createSvgDataUri(mxUtils.getXml(c))}))});this.loadFonts(p)}catch(U){null!=d&&d(U)}}),c,t)};Editor.prototype.writeGraphModelToPng=function(a,b,c,f,d){function l(a,b){var c=g;g+=b;return a.substring(c,g)}function p(a){a=l(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<
|
|
|
|
|
8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function e(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 g=0;if(l(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=d&&d();else if(l(a,4),"IHDR"!=l(a,4))null!=d&&d();else{l(a,17);d=a.substring(0,g);do{var k=p(a);if("IDAT"==l(a,4)){d=a.substring(0,g-8);c=c+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+f;f=4294967295;
|
|
|
|
|
f=EditorUi.prototype.updateCRC(f,b,0,4);f=EditorUi.prototype.updateCRC(f,c,0,c.length);d+=e(c.length)+b+c+e(f^4294967295);d+=a.substring(g-8,a.length);break}d+=a.substring(g-8,g-4+k);l(a,k);l(a,4)}while(k);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 g=ColorDialog.addRecentColor;ColorDialog.addRecentColor=function(a,b){g.apply(this,arguments);mxSettings.setRecentColors(ColorDialog.recentColors);
|
|
|
|
|
mxSettings.save()};var e=ColorDialog.resetRecentColors;ColorDialog.resetRecentColors=function(){e.apply(this,arguments);mxSettings.setRecentColors(ColorDialog.recentColors);mxSettings.save()}}window.EditDataDialog&&(EditDataDialog.getDisplayIdForCell=function(a,b){var c=null;null!=a.editor.graph.getModel().getParent(b)?c=b.getId():null!=a.currentPage&&(c=a.currentPage.getId());return c});if(null!=window.StyleFormatPanel){var k=Format.prototype.init;Format.prototype.init=function(){k.apply(this,arguments);
|
|
|
|
|
this.editorUi.editor.addListener("fileLoaded",this.update)};var m=Format.prototype.refresh;Format.prototype.refresh=function(){null!=this.editorUi.getCurrentFile()||"1"==urlParams.embed||this.editorUi.editor.chromeless?m.apply(this,arguments):this.clear()};DiagramFormatPanel.prototype.isShadowOptionVisible=function(){var a=this.editorUi.getCurrentFile();return"1"==urlParams.embed||null!=a&&a.isEditable()};DiagramFormatPanel.prototype.isMathOptionVisible=function(a){return!1};var n=DiagramFormatPanel.prototype.addView;
|
|
|
|
|
DiagramFormatPanel.prototype.addView=function(a){a=n.apply(this,arguments);this.editorUi.getCurrentFile();if(mxClient.IS_SVG&&this.isShadowOptionVisible()){var b=this.editorUi,c=b.editor.graph,f=this.createOption(mxResources.get("shadow"),function(){return c.shadowVisible},function(a){var f=new ChangePageSetup(b);f.ignoreColor=!0;f.ignoreImage=!0;f.shadowVisible=a;c.model.execute(f)},{install:function(a){this.listener=function(){a(c.shadowVisible)};b.addListener("shadowVisibleChanged",this.listener)},
|
|
|
|
@ -8392,30 +8392,30 @@ stroke:"#36393d"},{fill:"#ffff88",stroke:"#36393d"},{fill:"#cdeb8b",stroke:"#363
|
|
|
|
|
null!=d.shape&&(d.shape.commonCustomPropAdded||(d.shape.commonCustomPropAdded=!0,d.shape.customProperties=d.shape.customProperties||[],d.cell.vertex?Array.prototype.push.apply(d.shape.customProperties,Editor.commonVertexProperties):Array.prototype.push.apply(d.shape.customProperties,Editor.commonEdgeProperties)),f(d.shape.customProperties));a=a.getAttribute("customProperties");if(null!=a)try{f(JSON.parse(a))}catch(I){}}};var f=StyleFormatPanel.prototype.init;StyleFormatPanel.prototype.init=function(){var a=
|
|
|
|
|
this.format.createSelectionState();"image"==a.style.shape||a.containsLabel||this.container.appendChild(this.addStyles(this.createPanel()));f.apply(this,arguments);if(Editor.enableCustomProperties){for(var b={},c=a.vertices,d=a.edges,l=0;l<c.length;l++)this.findCommonProperties(c[l],b,0==l);for(l=0;l<d.length;l++)this.findCommonProperties(d[l],b,0==c.length&&0==l);null!=Object.getOwnPropertyNames&&0<Object.getOwnPropertyNames(b).length&&this.container.appendChild(this.addProperties(this.createPanel(),
|
|
|
|
|
b,a))}};var l=StyleFormatPanel.prototype.addStyleOps;StyleFormatPanel.prototype.addStyleOps=function(a){var b=mxUtils.button(mxResources.get("copyStyle"),mxUtils.bind(this,function(a){this.editorUi.actions.get("copyStyle").funct()}));b.setAttribute("title",mxResources.get("copyStyle")+" ("+this.editorUi.actions.get("copyStyle").shortcut+")");b.style.marginBottom="2px";b.style.width="100px";b.style.marginRight="2px";a.appendChild(b);b=mxUtils.button(mxResources.get("pasteStyle"),mxUtils.bind(this,
|
|
|
|
|
function(a){this.editorUi.actions.get("pasteStyle").funct()}));b.setAttribute("title",mxResources.get("pasteStyle")+" ("+this.editorUi.actions.get("pasteStyle").shortcut+")");b.style.marginBottom="2px";b.style.width="100px";a.appendChild(b);mxUtils.br(a);return l.apply(this,arguments)};EditorUi.prototype.propertiesCollapsed=!0;StyleFormatPanel.prototype.addProperties=function(a,b,c){function f(a,b,c,f){v.getModel().beginUpdate();try{var d=[],l=[];if(null!=c.index){for(var e=[],p=c.parentRow.nextSibling;p&&
|
|
|
|
|
p.getAttribute("data-pName")==a;)e.push(p.getAttribute("data-pValue")),p=p.nextSibling;c.index<e.length?null!=f?e.splice(f,1):e[c.index]=b:e.push(b);null!=c.size&&e.length>c.size&&(e=e.slice(0,c.size));b=e.join(",");null!=c.countProperty&&(v.setCellStyles(c.countProperty,e.length,v.getSelectionCells()),d.push(c.countProperty),l.push(e.length))}v.setCellStyles(a,b,v.getSelectionCells());d.push(a);l.push(b);if(null!=c.dependentProps)for(a=0;a<c.dependentProps.length;a++){var g=c.dependentPropsDefVal[a],
|
|
|
|
|
function(a){this.editorUi.actions.get("pasteStyle").funct()}));b.setAttribute("title",mxResources.get("pasteStyle")+" ("+this.editorUi.actions.get("pasteStyle").shortcut+")");b.style.marginBottom="2px";b.style.width="100px";a.appendChild(b);mxUtils.br(a);return l.apply(this,arguments)};EditorUi.prototype.propertiesCollapsed=!0;StyleFormatPanel.prototype.addProperties=function(a,b,c){function f(a,b,c,f){v.getModel().beginUpdate();try{var d=[],l=[];if(null!=c.index){for(var p=[],e=c.parentRow.nextSibling;e&&
|
|
|
|
|
e.getAttribute("data-pName")==a;)p.push(e.getAttribute("data-pValue")),e=e.nextSibling;c.index<p.length?null!=f?p.splice(f,1):p[c.index]=b:p.push(b);null!=c.size&&p.length>c.size&&(p=p.slice(0,c.size));b=p.join(",");null!=c.countProperty&&(v.setCellStyles(c.countProperty,p.length,v.getSelectionCells()),d.push(c.countProperty),l.push(p.length))}v.setCellStyles(a,b,v.getSelectionCells());d.push(a);l.push(b);if(null!=c.dependentProps)for(a=0;a<c.dependentProps.length;a++){var g=c.dependentPropsDefVal[a],
|
|
|
|
|
k=c.dependentPropsVals[a];if(k.length>b)k=k.slice(0,b);else for(var u=k.length;u<b;u++)k.push(g);k=k.join(",");v.setCellStyles(c.dependentProps[a],k,v.getSelectionCells());d.push(c.dependentProps[a]);l.push(k)}if("function"==typeof c.onChange)c.onChange(v,b);t.editorUi.fireEvent(new mxEventObject("styleChanged","keys",d,"values",l,"cells",v.getSelectionCells()))}finally{v.getModel().endUpdate()}}function d(b,c,f){var d=mxUtils.getOffset(a,!0),l=mxUtils.getOffset(b,!0);c.style.position="absolute";
|
|
|
|
|
c.style.left=l.x-d.x+"px";c.style.top=l.y-d.y+"px";c.style.width=b.offsetWidth+"px";c.style.height=b.offsetHeight-(f?4:0)+"px";c.style.zIndex=5}function l(a,b,c){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=b&&"none"!=b?b:"url('"+Dialog.prototype.noColorImage+"')";btn=mxUtils.button("",mxUtils.bind(t,function(l){this.editorUi.pickColor(b,function(b){d.style.background="none"==b?"url('"+Dialog.prototype.noColorImage+
|
|
|
|
|
"')":b;f(a,b,c)});mxEvent.consume(l)}));btn.style.height="12px";btn.style.width="40px";btn.className="geColorBtn";btn.appendChild(d);return btn}function e(a,b,c,d,l,e,p){null!=b&&(b=b.split(","),u.push({name:a,values:b,type:c,defVal:d,countProperty:l,parentRow:e,isDeletable:!0,flipBkg:p}));btn=mxUtils.button("+",mxUtils.bind(t,function(b){for(var g=e,t=0;null!=g.nextSibling;)if(g.nextSibling.getAttribute("data-pName")==a)g=g.nextSibling,t++;else break;var v={type:c,parentRow:e,index:t,isDeletable:!0,
|
|
|
|
|
defVal:d,countProperty:l},t=k(a,"",v,0==t%2,p);f(a,d,v);g.parentNode.insertBefore(t,g.nextSibling);mxEvent.consume(b)}));btn.style.height="16px";btn.style.width="25px";btn.className="geColorBtn";return btn}function p(a,b,c,f,d,l,e){if(0<d){var p=Array(d);b=null!=b?b.split(","):[];for(var g=0;g<d;g++)p[g]=null!=b[g]?b[g]:null!=f?f:"";u.push({name:a,values:p,type:c,defVal:f,parentRow:l,flipBkg:e,size:d})}return document.createElement("div")}function g(a,b,c){var d=document.createElement("input");d.type=
|
|
|
|
|
"')":b;f(a,b,c)});mxEvent.consume(l)}));btn.style.height="12px";btn.style.width="40px";btn.className="geColorBtn";btn.appendChild(d);return btn}function p(a,b,c,d,l,p,e){null!=b&&(b=b.split(","),u.push({name:a,values:b,type:c,defVal:d,countProperty:l,parentRow:p,isDeletable:!0,flipBkg:e}));btn=mxUtils.button("+",mxUtils.bind(t,function(b){for(var g=p,t=0;null!=g.nextSibling;)if(g.nextSibling.getAttribute("data-pName")==a)g=g.nextSibling,t++;else break;var v={type:c,parentRow:p,index:t,isDeletable:!0,
|
|
|
|
|
defVal:d,countProperty:l},t=k(a,"",v,0==t%2,e);f(a,d,v);g.parentNode.insertBefore(t,g.nextSibling);mxEvent.consume(b)}));btn.style.height="16px";btn.style.width="25px";btn.className="geColorBtn";return btn}function e(a,b,c,f,d,l,p){if(0<d){var e=Array(d);b=null!=b?b.split(","):[];for(var g=0;g<d;g++)e[g]=null!=b[g]?b[g]:null!=f?f:"";u.push({name:a,values:e,type:c,defVal:f,parentRow:l,flipBkg:p,size:d})}return document.createElement("div")}function g(a,b,c){var d=document.createElement("input");d.type=
|
|
|
|
|
"checkbox";d.checked="1"==b;mxEvent.addListener(d,"change",function(){f(a,d.checked?"1":"0",c)});return d}function k(b,c,k,v,u){var B=k.dispName,m=k.type,n=document.createElement("tr");n.className="gePropRow"+(u?"Dark":"")+(v?"Alt":"")+" gePropNonHeaderRow";n.setAttribute("data-pName",b);n.setAttribute("data-pValue",c);v=!1;null!=k.index&&(n.setAttribute("data-index",k.index),B=(null!=B?B:"")+"["+k.index+"]",v=!0);var y=document.createElement("td");y.className="gePropRowCell";y.innerHTML=mxUtils.htmlEntities(mxResources.get(B,
|
|
|
|
|
null,B));v&&(y.style.textAlign="right");n.appendChild(y);y=document.createElement("td");y.className="gePropRowCell";if("color"==m)y.appendChild(l(b,c,k));else if("bool"==m||"boolean"==m)y.appendChild(g(b,c,k));else if("enum"==m){var z=k.enumList;for(u=0;u<z.length;u++)if(B=z[u],B.val==c){y.innerHTML=mxUtils.htmlEntities(mxResources.get(B.dispName,null,B.dispName));break}mxEvent.addListener(y,"click",mxUtils.bind(t,function(){var l=document.createElement("select");d(y,l);for(var e=0;e<z.length;e++){var p=
|
|
|
|
|
z[e],g=document.createElement("option");g.value=mxUtils.htmlEntities(p.val);g.innerHTML=mxUtils.htmlEntities(mxResources.get(p.dispName,null,p.dispName));l.appendChild(g)}l.value=c;a.appendChild(l);mxEvent.addListener(l,"change",function(){var a=mxUtils.htmlEntities(l.value);f(b,a,k)});l.focus();mxEvent.addListener(l,"blur",function(){a.removeChild(l)})}))}else"dynamicArr"==m?y.appendChild(e(b,c,k.subType,k.subDefVal,k.countProperty,n,u)):"staticArr"==m?y.appendChild(p(b,c,k.subType,k.subDefVal,k.size,
|
|
|
|
|
n,u)):(y.innerHTML=c,mxEvent.addListener(y,"click",mxUtils.bind(t,function(){function l(){var a=e.value,a=0==a.length&&"string"!=m?0:a;k.allowAuto&&("auto"==a.trim().toLowerCase()?(a="auto",m="string"):(a=parseFloat(a),a=isNaN(a)?0:a));null!=k.min&&a<k.min?a=k.min:null!=k.max&&a>k.max&&(a=k.max);a=mxUtils.htmlEntities(("int"==m?parseInt(a):a)+"");f(b,a,k)}var e=document.createElement("input");d(y,e,!0);e.value=c;e.className="gePropEditor";"int"!=m&&"float"!=m||k.allowAuto||(e.type="number",e.step=
|
|
|
|
|
"int"==m?"1":"any",null!=k.min&&(e.min=parseFloat(k.min)),null!=k.max&&(e.max=parseFloat(k.max)));a.appendChild(e);mxEvent.addListener(e,"keypress",function(a){13==a.keyCode&&l()});e.focus();mxEvent.addListener(e,"blur",function(){l()})})));k.isDeletable&&(u=mxUtils.button("-",mxUtils.bind(t,function(a){f(b,"",k,k.index);mxEvent.consume(a)})),u.style.height="16px",u.style.width="25px",u.style["float"]="right",u.className="geColorBtn",y.appendChild(u));n.appendChild(y);return n}var t=this,v=this.editorUi.editor.graph,
|
|
|
|
|
null,B));v&&(y.style.textAlign="right");n.appendChild(y);y=document.createElement("td");y.className="gePropRowCell";if("color"==m)y.appendChild(l(b,c,k));else if("bool"==m||"boolean"==m)y.appendChild(g(b,c,k));else if("enum"==m){var z=k.enumList;for(u=0;u<z.length;u++)if(B=z[u],B.val==c){y.innerHTML=mxUtils.htmlEntities(mxResources.get(B.dispName,null,B.dispName));break}mxEvent.addListener(y,"click",mxUtils.bind(t,function(){var l=document.createElement("select");d(y,l);for(var p=0;p<z.length;p++){var e=
|
|
|
|
|
z[p],g=document.createElement("option");g.value=mxUtils.htmlEntities(e.val);g.innerHTML=mxUtils.htmlEntities(mxResources.get(e.dispName,null,e.dispName));l.appendChild(g)}l.value=c;a.appendChild(l);mxEvent.addListener(l,"change",function(){var a=mxUtils.htmlEntities(l.value);f(b,a,k)});l.focus();mxEvent.addListener(l,"blur",function(){a.removeChild(l)})}))}else"dynamicArr"==m?y.appendChild(p(b,c,k.subType,k.subDefVal,k.countProperty,n,u)):"staticArr"==m?y.appendChild(e(b,c,k.subType,k.subDefVal,k.size,
|
|
|
|
|
n,u)):(y.innerHTML=c,mxEvent.addListener(y,"click",mxUtils.bind(t,function(){function l(){var a=p.value,a=0==a.length&&"string"!=m?0:a;k.allowAuto&&("auto"==a.trim().toLowerCase()?(a="auto",m="string"):(a=parseFloat(a),a=isNaN(a)?0:a));null!=k.min&&a<k.min?a=k.min:null!=k.max&&a>k.max&&(a=k.max);a=mxUtils.htmlEntities(("int"==m?parseInt(a):a)+"");f(b,a,k)}var p=document.createElement("input");d(y,p,!0);p.value=c;p.className="gePropEditor";"int"!=m&&"float"!=m||k.allowAuto||(p.type="number",p.step=
|
|
|
|
|
"int"==m?"1":"any",null!=k.min&&(p.min=parseFloat(k.min)),null!=k.max&&(p.max=parseFloat(k.max)));a.appendChild(p);mxEvent.addListener(p,"keypress",function(a){13==a.keyCode&&l()});p.focus();mxEvent.addListener(p,"blur",function(){l()})})));k.isDeletable&&(u=mxUtils.button("-",mxUtils.bind(t,function(a){f(b,"",k,k.index);mxEvent.consume(a)})),u.style.height="16px",u.style.width="25px",u.style["float"]="right",u.className="geColorBtn",y.appendChild(u));n.appendChild(y);return n}var t=this,v=this.editorUi.editor.graph,
|
|
|
|
|
u=[];a.style.position="relative";a.style.padding="0";var B=document.createElement("table");B.style.whiteSpace="nowrap";B.style.width="100%";var m=document.createElement("tr");m.className="gePropHeader";var n=document.createElement("th");n.className="gePropHeaderCell";var y=document.createElement("img");y.src=Sidebar.prototype.expandedImage;n.appendChild(y);mxUtils.write(n,mxResources.get("property"));m.style.cursor="pointer";var z=function(){var b=B.querySelectorAll(".gePropNonHeaderRow"),c;if(t.editorUi.propertiesCollapsed){y.src=
|
|
|
|
|
Sidebar.prototype.collapsedImage;c="none";for(var f=a.childNodes.length-1;0<=f;f--)try{var d=a.childNodes[f],l=d.nodeName.toUpperCase();"INPUT"!=l&&"SELECT"!=l||a.removeChild(d)}catch(O){}}else y.src=Sidebar.prototype.expandedImage,c="";for(f=0;f<b.length;f++)b[f].style.display=c};mxEvent.addListener(m,"click",function(){t.editorUi.propertiesCollapsed=!t.editorUi.propertiesCollapsed;z()});m.appendChild(n);n=document.createElement("th");n.className="gePropHeaderCell";n.innerHTML=mxResources.get("value");
|
|
|
|
|
m.appendChild(n);B.appendChild(m);var x=!1,A=!1,C;for(C in b)if(m=b[C],"function"!=typeof m.isVisible||m.isVisible(c)){var q=null!=c.style[C]?mxUtils.htmlEntities(c.style[C]+""):m.defVal;if("separator"==m.type)A=!A;else{if("staticArr"==m.type)m.size=parseInt(c.style[m.sizeProperty]||b[m.sizeProperty].defVal)||0;else if(null!=m.dependentProps){for(var D=m.dependentProps,J=[],H=[],n=0;n<D.length;n++){var N=c.style[D[n]];H.push(b[D[n]].subDefVal);J.push(null!=N?N.split(","):[])}m.dependentPropsDefVal=
|
|
|
|
|
H;m.dependentPropsVals=J}B.appendChild(k(C,q,m,x,A));x=!x}}for(n=0;n<u.length;n++)for(m=u[n],b=m.parentRow,c=0;c<m.values.length;c++)C=k(m.name,m.values[c],{type:m.type,parentRow:m.parentRow,isDeletable:m.isDeletable,index:c,defVal:m.defVal,countProperty:m.countProperty,size:m.size},0==c%2,m.flipBkg),b.parentNode.insertBefore(C,b.nextSibling),b=C;a.appendChild(B);z();return a};StyleFormatPanel.prototype.addStyles=function(a){function b(a){function b(a){var b=mxUtils.button("",function(b){f.getModel().beginUpdate();
|
|
|
|
|
try{var c=f.getSelectionCells();for(b=0;b<c.length;b++){for(var d=f.getModel().getStyle(c[b]),e=0;e<l.length;e++)d=mxUtils.removeStylename(d,l[e]);var p=f.getModel().isVertex(c[b])?f.defaultVertexStyle:f.defaultEdgeStyle;null!=a?(d=mxUtils.setStyle(d,mxConstants.STYLE_GRADIENTCOLOR,a.gradient||mxUtils.getValue(p,mxConstants.STYLE_GRADIENTCOLOR,null)),d=""==a.fill?mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,null):mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,a.fill||mxUtils.getValue(p,mxConstants.STYLE_FILLCOLOR,
|
|
|
|
|
null)),d=""==a.stroke?mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,null):mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,a.stroke||mxUtils.getValue(p,mxConstants.STYLE_STROKECOLOR,null)),f.getModel().isVertex(c[b])&&(d=mxUtils.setStyle(d,mxConstants.STYLE_FONTCOLOR,a.font||mxUtils.getValue(p,mxConstants.STYLE_FONTCOLOR,null)))):(d=mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,mxUtils.getValue(p,mxConstants.STYLE_FILLCOLOR,"#ffffff")),d=mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,mxUtils.getValue(p,
|
|
|
|
|
mxConstants.STYLE_STROKECOLOR,"#000000")),d=mxUtils.setStyle(d,mxConstants.STYLE_GRADIENTCOLOR,mxUtils.getValue(p,mxConstants.STYLE_GRADIENTCOLOR,null)),f.getModel().isVertex(c[b])&&(d=mxUtils.setStyle(d,mxConstants.STYLE_FONTCOLOR,mxUtils.getValue(p,mxConstants.STYLE_FONTCOLOR,null))));f.getModel().setStyle(c[b],d)}}finally{f.getModel().endUpdate()}});b.className="geStyleButton";b.style.width="36px";b.style.height="30px";b.style.margin="0px 6px 6px 0px";if(null!=a)null!=a.gradient?mxClient.IS_IE&&
|
|
|
|
|
try{var c=f.getSelectionCells();for(b=0;b<c.length;b++){for(var d=f.getModel().getStyle(c[b]),p=0;p<l.length;p++)d=mxUtils.removeStylename(d,l[p]);var e=f.getModel().isVertex(c[b])?f.defaultVertexStyle:f.defaultEdgeStyle;null!=a?(d=mxUtils.setStyle(d,mxConstants.STYLE_GRADIENTCOLOR,a.gradient||mxUtils.getValue(e,mxConstants.STYLE_GRADIENTCOLOR,null)),d=""==a.fill?mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,null):mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,a.fill||mxUtils.getValue(e,mxConstants.STYLE_FILLCOLOR,
|
|
|
|
|
null)),d=""==a.stroke?mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,null):mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,a.stroke||mxUtils.getValue(e,mxConstants.STYLE_STROKECOLOR,null)),f.getModel().isVertex(c[b])&&(d=mxUtils.setStyle(d,mxConstants.STYLE_FONTCOLOR,a.font||mxUtils.getValue(e,mxConstants.STYLE_FONTCOLOR,null)))):(d=mxUtils.setStyle(d,mxConstants.STYLE_FILLCOLOR,mxUtils.getValue(e,mxConstants.STYLE_FILLCOLOR,"#ffffff")),d=mxUtils.setStyle(d,mxConstants.STYLE_STROKECOLOR,mxUtils.getValue(e,
|
|
|
|
|
mxConstants.STYLE_STROKECOLOR,"#000000")),d=mxUtils.setStyle(d,mxConstants.STYLE_GRADIENTCOLOR,mxUtils.getValue(e,mxConstants.STYLE_GRADIENTCOLOR,null)),f.getModel().isVertex(c[b])&&(d=mxUtils.setStyle(d,mxConstants.STYLE_FONTCOLOR,mxUtils.getValue(e,mxConstants.STYLE_FONTCOLOR,null))));f.getModel().setStyle(c[b],d)}}finally{f.getModel().endUpdate()}});b.className="geStyleButton";b.style.width="36px";b.style.height="30px";b.style.margin="0px 6px 6px 0px";if(null!=a)null!=a.gradient?mxClient.IS_IE&&
|
|
|
|
|
(mxClient.IS_QUIRKS||10>document.documentMode)?b.style.filter="progid:DXImageTransform.Microsoft.Gradient(StartColorStr='"+a.fill+"', EndColorStr='"+a.gradient+"', GradientType=0)":b.style.backgroundImage="linear-gradient("+a.fill+" 0px,"+a.gradient+" 100%)":a.fill==mxConstants.NONE?b.style.background="url('"+Dialog.prototype.noColorImage+"')":b.style.backgroundColor=""==a.fill?mxUtils.getValue(f.defaultVertexStyle,mxConstants.STYLE_FILLCOLOR,"dark"==uiTheme?"#000000":"#ffffff"):a.fill||mxUtils.getValue(f.defaultVertexStyle,
|
|
|
|
|
mxConstants.STYLE_FILLCOLOR,"dark"==uiTheme?"#000000":"#ffffff"),b.style.border=a.stroke==mxConstants.NONE?"1px solid transparent":""==a.stroke?"1px solid "+mxUtils.getValue(f.defaultVertexStyle,mxConstants.STYLE_STROKECOLOR,"dark"!=uiTheme?"#000000":"#ffffff"):"1px solid "+(a.stroke||mxUtils.getValue(f.defaultVertexStyle,mxConstants.STYLE_STROKECOLOR,"dark"!=uiTheme?"#000000":"#ffffff"));else{var c=mxUtils.getValue(f.defaultVertexStyle,mxConstants.STYLE_FILLCOLOR,"#ffffff"),e=mxUtils.getValue(f.defaultVertexStyle,
|
|
|
|
|
mxConstants.STYLE_STROKECOLOR,"#000000");b.style.backgroundColor=c;b.style.border="1px solid "+e}d.appendChild(b)}d.innerHTML="";for(var c=0;c<a.length;c++)0<c&&0==mxUtils.mod(c,4)&&mxUtils.br(d),b(a[c])}function c(a){mxEvent.addListener(a,"mouseenter",function(){a.style.opacity="1"});mxEvent.addListener(a,"mouseleave",function(){a.style.opacity="0.5"})}var f=this.editorUi.editor.graph,d=document.createElement("div");d.style.whiteSpace="nowrap";d.style.paddingLeft="24px";d.style.paddingRight="20px";
|
|
|
|
|
a.style.paddingLeft="16px";a.style.paddingBottom="6px";a.style.position="relative";a.appendChild(d);var l="plain-gray plain-blue plain-green plain-turquoise plain-orange plain-yellow plain-red plain-pink plain-purple gray blue green turquoise orange yellow red pink purple".split(" ");null==this.editorUi.currentScheme&&(this.editorUi.currentScheme=0);var e=document.createElement("div");e.style.cssText="position:absolute;left:10px;top:8px;bottom:8px;width:20px;margin:4px;opacity:0.5;background-repeat:no-repeat;background-position:center center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAQBAMAAADQT4M0AAAAIVBMVEUAAAB2dnZ4eHh3d3d1dXVxcXF2dnZ2dnZ2dnZxcXF2dnYmb3w1AAAACnRSTlMAfCTkhhvb7cQSPH2JPgAAADRJREFUCNdjwACMAmBKaiGYs2oJmLPKAZ3DabU8AMRTXpUKopislqFyVzCAuUZgikkBZjoAcMYLnp53P/UAAAAASUVORK5CYII=);";
|
|
|
|
|
mxEvent.addListener(e,"click",mxUtils.bind(this,function(){this.editorUi.currentScheme=mxUtils.mod(this.editorUi.currentScheme-1,this.defaultColorSchemes.length);b(this.defaultColorSchemes[this.editorUi.currentScheme])}));var p=document.createElement("div");p.style.cssText="position:absolute;left:202px;top:8px;bottom:8px;width:20px;margin:4px;opacity:0.5;background-repeat:no-repeat;background-position:center center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAQBAMAAADQT4M0AAAAIVBMVEUAAAB2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnYBuwCcAAAACnRSTlMAfCTkhhvb7cQSPH2JPgAAADZJREFUCNdjQAOMAmBKaiGY8loF5rKswsZlrVo8AUiFrTICcbIWK8A5DF1gDoMymMPApIAwHwCS0Qx/U7qCBQAAAABJRU5ErkJggg==);";
|
|
|
|
|
1<this.defaultColorSchemes.length&&(a.appendChild(e),a.appendChild(p));mxEvent.addListener(p,"click",mxUtils.bind(this,function(){this.editorUi.currentScheme=mxUtils.mod(this.editorUi.currentScheme+1,this.defaultColorSchemes.length);b(this.defaultColorSchemes[this.editorUi.currentScheme])}));c(e);c(p);b(this.defaultColorSchemes[this.editorUi.currentScheme]);return a};StyleFormatPanel.prototype.addEditOps=function(a){var b=this.format.getSelectionState(),c=null;1==this.editorUi.editor.graph.getSelectionCount()&&
|
|
|
|
|
mxConstants.STYLE_FILLCOLOR,"dark"==uiTheme?"#000000":"#ffffff"),b.style.border=a.stroke==mxConstants.NONE?"1px solid transparent":""==a.stroke?"1px solid "+mxUtils.getValue(f.defaultVertexStyle,mxConstants.STYLE_STROKECOLOR,"dark"!=uiTheme?"#000000":"#ffffff"):"1px solid "+(a.stroke||mxUtils.getValue(f.defaultVertexStyle,mxConstants.STYLE_STROKECOLOR,"dark"!=uiTheme?"#000000":"#ffffff"));else{var c=mxUtils.getValue(f.defaultVertexStyle,mxConstants.STYLE_FILLCOLOR,"#ffffff"),p=mxUtils.getValue(f.defaultVertexStyle,
|
|
|
|
|
mxConstants.STYLE_STROKECOLOR,"#000000");b.style.backgroundColor=c;b.style.border="1px solid "+p}d.appendChild(b)}d.innerHTML="";for(var c=0;c<a.length;c++)0<c&&0==mxUtils.mod(c,4)&&mxUtils.br(d),b(a[c])}function c(a){mxEvent.addListener(a,"mouseenter",function(){a.style.opacity="1"});mxEvent.addListener(a,"mouseleave",function(){a.style.opacity="0.5"})}var f=this.editorUi.editor.graph,d=document.createElement("div");d.style.whiteSpace="nowrap";d.style.paddingLeft="24px";d.style.paddingRight="20px";
|
|
|
|
|
a.style.paddingLeft="16px";a.style.paddingBottom="6px";a.style.position="relative";a.appendChild(d);var l="plain-gray plain-blue plain-green plain-turquoise plain-orange plain-yellow plain-red plain-pink plain-purple gray blue green turquoise orange yellow red pink purple".split(" ");null==this.editorUi.currentScheme&&(this.editorUi.currentScheme=0);var p=document.createElement("div");p.style.cssText="position:absolute;left:10px;top:8px;bottom:8px;width:20px;margin:4px;opacity:0.5;background-repeat:no-repeat;background-position:center center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAQBAMAAADQT4M0AAAAIVBMVEUAAAB2dnZ4eHh3d3d1dXVxcXF2dnZ2dnZ2dnZxcXF2dnYmb3w1AAAACnRSTlMAfCTkhhvb7cQSPH2JPgAAADRJREFUCNdjwACMAmBKaiGYs2oJmLPKAZ3DabU8AMRTXpUKopislqFyVzCAuUZgikkBZjoAcMYLnp53P/UAAAAASUVORK5CYII=);";
|
|
|
|
|
mxEvent.addListener(p,"click",mxUtils.bind(this,function(){this.editorUi.currentScheme=mxUtils.mod(this.editorUi.currentScheme-1,this.defaultColorSchemes.length);b(this.defaultColorSchemes[this.editorUi.currentScheme])}));var e=document.createElement("div");e.style.cssText="position:absolute;left:202px;top:8px;bottom:8px;width:20px;margin:4px;opacity:0.5;background-repeat:no-repeat;background-position:center center;background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAwAAAAQBAMAAADQT4M0AAAAIVBMVEUAAAB2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnZ2dnYBuwCcAAAACnRSTlMAfCTkhhvb7cQSPH2JPgAAADZJREFUCNdjQAOMAmBKaiGY8loF5rKswsZlrVo8AUiFrTICcbIWK8A5DF1gDoMymMPApIAwHwCS0Qx/U7qCBQAAAABJRU5ErkJggg==);";
|
|
|
|
|
1<this.defaultColorSchemes.length&&(a.appendChild(p),a.appendChild(e));mxEvent.addListener(e,"click",mxUtils.bind(this,function(){this.editorUi.currentScheme=mxUtils.mod(this.editorUi.currentScheme+1,this.defaultColorSchemes.length);b(this.defaultColorSchemes[this.editorUi.currentScheme])}));c(p);c(e);b(this.defaultColorSchemes[this.editorUi.currentScheme]);return a};StyleFormatPanel.prototype.addEditOps=function(a){var b=this.format.getSelectionState(),c=null;1==this.editorUi.editor.graph.getSelectionCount()&&
|
|
|
|
|
(c=mxUtils.button(mxResources.get("editStyle"),mxUtils.bind(this,function(a){this.editorUi.actions.get("editStyle").funct()})),c.setAttribute("title",mxResources.get("editStyle")+" ("+this.editorUi.actions.get("editStyle").shortcut+")"),c.style.width="202px",c.style.marginBottom="2px",a.appendChild(c));var f=this.editorUi.editor.graph,d=f.view.getState(f.getSelectionCell());1==f.getSelectionCount()&&null!=d&&null!=d.shape&&null!=d.shape.stencil?(b=mxUtils.button(mxResources.get("editShape"),mxUtils.bind(this,
|
|
|
|
|
function(a){this.editorUi.actions.get("editShape").funct()})),b.setAttribute("title",mxResources.get("editShape")),b.style.marginBottom="2px",null==c?b.style.width="202px":(c.style.width="100px",b.style.width="100px",b.style.marginLeft="2px"),a.appendChild(b)):b.image&&(b=mxUtils.button(mxResources.get("editImage"),mxUtils.bind(this,function(a){this.editorUi.actions.get("image").funct()})),b.setAttribute("title",mxResources.get("editImage")),b.style.marginBottom="2px",null==c?b.style.width="202px":
|
|
|
|
|
(c.style.width="100px",b.style.width="100px",b.style.marginLeft="2px"),a.appendChild(b));return a}}Graph.prototype.defaultThemeName="default-style2";Graph.prototype.lastPasteXml=null;Graph.prototype.pasteCounter=0;Graph.prototype.defaultScrollbars="0"!=urlParams.sb;Graph.prototype.defaultPageVisible="0"!=urlParams.pv;Graph.prototype.shadowId="dropShadow";Graph.prototype.svgShadowColor="#3D4574";Graph.prototype.svgShadowOpacity="0.4";Graph.prototype.svgShadowBlur="1.7";Graph.prototype.svgShadowSize=
|
|
|
|
@ -8430,8 +8430,8 @@ t.apply(this,arguments);if(null==b){if(null==this.globalUrlVars&&null!=urlParams
|
|
|
|
|
(this.webKitForceRepaintNode=document.createElement("div"),this.webKitForceRepaintNode.style.cssText="position:absolute;",a.ownerSVGElement.parentNode.insertBefore(this.webKitForceRepaintNode,a.ownerSVGElement))}};var x=Graph.prototype.loadStylesheet;Graph.prototype.loadStylesheet=function(){x.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 b=0;b<
|
|
|
|
|
a.actions.length;b++){var c=a.actions[b];if(null!=c.open)if(this.isCustomLink(c.open)){if(!this.customLinkClicked(c.open))return}else this.openLink(c.open)}this.model.beginUpdate();try{for(b=0;b<a.actions.length;b++)c=a.actions[b],null!=c.toggle&&this.toggleCells(this.getCellsForAction(c.toggle,!0)),null!=c.show&&this.setCellsVisible(this.getCellsForAction(c.show,!0),!0),null!=c.hide&&this.setCellsVisible(this.getCellsForAction(c.hide,!0),!1)}finally{this.model.endUpdate()}for(b=0;b<a.actions.length;b++){var c=
|
|
|
|
|
a.actions[b],f=[];null!=c.select&&this.isEnabled()&&(f=this.getCellsForAction(c.select),this.setSelectionCells(f));null!=c.highlight&&(f=this.getCellsForAction(c.highlight),this.highlightCells(f,c.highlight.color,c.highlight.duration,c.highlight.opacity));null!=c.scroll&&(f=this.getCellsForAction(c.scroll));0<f.length&&this.scrollCellToVisible(f[0])}}};Graph.prototype.getCellsForAction=function(a,b){return this.getCellsById(a.cells).concat(this.getCellsForTags(a.tags,null,null,b))};Graph.prototype.getCellsById=
|
|
|
|
|
function(a){var b=[];if(null!=a)for(var c=0;c<a.length;c++)if("*"==a[c])var f=this.getDefaultParent(),b=b.concat(this.model.filterDescendants(function(a){return a!=f},f));else{var d=this.model.getCell(a[c]);null!=d&&b.push(d)}return b};Graph.prototype.getCellsForTags=function(a,b,c,f){var d=[];if(null!=a){b=null!=b?b:this.model.getDescendants(this.model.getRoot());c=null!=c?c:"tags";for(var l=0,e={},p=0;p<a.length;p++)0<a[p].length&&(e[a[p].toLowerCase()]=!0,l++);for(p=0;p<b.length;p++)if(f&&this.model.getParent(b[p])==
|
|
|
|
|
this.model.root||this.model.isVertex(b[p])||this.model.isEdge(b[p])){var g=null!=b[p].value&&"object"==typeof b[p].value?mxUtils.trim(b[p].value.getAttribute(c)||""):"",k=!1;if(0<g.length){if(g=g.toLowerCase().split(" "),g.length>=a.length){for(var t=k=0;t<g.length&&k<l;t++)null!=e[g[t]]&&k++;k=k==l}}else k=0==a.length;k&&d.push(b[p])}}return d};Graph.prototype.toggleCells=function(a){this.model.beginUpdate();try{for(var b=0;b<a.length;b++)this.model.setVisible(a[b],!this.model.isVisible(a[b]))}finally{this.model.endUpdate()}};
|
|
|
|
|
function(a){var b=[];if(null!=a)for(var c=0;c<a.length;c++)if("*"==a[c])var f=this.getDefaultParent(),b=b.concat(this.model.filterDescendants(function(a){return a!=f},f));else{var d=this.model.getCell(a[c]);null!=d&&b.push(d)}return b};Graph.prototype.getCellsForTags=function(a,b,c,f){var d=[];if(null!=a){b=null!=b?b:this.model.getDescendants(this.model.getRoot());c=null!=c?c:"tags";for(var l=0,p={},e=0;e<a.length;e++)0<a[e].length&&(p[a[e].toLowerCase()]=!0,l++);for(e=0;e<b.length;e++)if(f&&this.model.getParent(b[e])==
|
|
|
|
|
this.model.root||this.model.isVertex(b[e])||this.model.isEdge(b[e])){var g=null!=b[e].value&&"object"==typeof b[e].value?mxUtils.trim(b[e].value.getAttribute(c)||""):"",k=!1;if(0<g.length){if(g=g.toLowerCase().split(" "),g.length>=a.length){for(var t=k=0;t<g.length&&k<l;t++)null!=p[g[t]]&&k++;k=k==l}}else k=0==a.length;k&&d.push(b[e])}}return d};Graph.prototype.toggleCells=function(a){this.model.beginUpdate();try{for(var b=0;b<a.length;b++)this.model.setVisible(a[b],!this.model.isVisible(a[b]))}finally{this.model.endUpdate()}};
|
|
|
|
|
Graph.prototype.setCellsVisible=function(a,b){this.model.beginUpdate();try{for(var c=0;c<a.length;c++)this.model.setVisible(a[c],b)}finally{this.model.endUpdate()}};Graph.prototype.highlightCells=function(a,b,c,f){for(var d=0;d<a.length;d++)this.highlightCell(a[d],b,c,f)};Graph.prototype.highlightCell=function(a,b,c,f){b=null!=b?b:mxConstants.DEFAULT_VALID_COLOR;c=null!=c?c:1E3;a=this.view.getState(a);if(null!=a){var d=Math.max(5,mxUtils.getValue(a.style,mxConstants.STYLE_STROKEWIDTH,1)+4),l=new mxCellHighlight(this,
|
|
|
|
|
b,d,!1);null!=f&&(l.opacity=f);l.highlight(a);window.setTimeout(function(){null!=l.shape&&(mxUtils.setPrefixedStyle(l.shape.node.style,"transition","all 1200ms ease-in-out"),l.shape.node.style.opacity=0);window.setTimeout(function(){l.destroy()},1200)},c)}};Graph.prototype.addSvgShadow=function(a,b,c){c=null!=c?c:!1;var f=a.ownerDocument,d=null!=f.createElementNS?f.createElementNS(mxConstants.NS_SVG,"filter"):f.createElement("filter");d.setAttribute("id",this.shadowId);var l=null!=f.createElementNS?
|
|
|
|
|
f.createElementNS(mxConstants.NS_SVG,"feGaussianBlur"):f.createElement("feGaussianBlur");l.setAttribute("in","SourceAlpha");l.setAttribute("stdDeviation",this.svgShadowBlur);l.setAttribute("result","blur");d.appendChild(l);l=null!=f.createElementNS?f.createElementNS(mxConstants.NS_SVG,"feOffset"):f.createElement("feOffset");l.setAttribute("in","blur");l.setAttribute("dx",this.svgShadowSize);l.setAttribute("dy",this.svgShadowSize);l.setAttribute("result","offsetBlur");d.appendChild(l);l=null!=f.createElementNS?
|
|
|
|
@ -8447,33 +8447,33 @@ mxStencilRegistry.libraries["mockup/graphics"]=[SHAPES_PATH+"/mockup/mxMockupGra
|
|
|
|
|
"/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 b=null;null!=a&&0<a.length&&("ER"==a.substring(0,2)?b="mxgraph.er":"sysML"==a.substring(0,5)&&(b="mxgraph.sysml"));return b};var C=mxMarker.createMarker;mxMarker.createMarker=function(a,b,c,f,d,l,e,p,g,k){if(null!=c&&null==mxMarker.markers[c]){var t=this.getPackageForType(c);null!=t&&mxStencilRegistry.getStencil(t)}return C.apply(this,arguments)};PrintDialog.prototype.create=function(a,b){function c(){m.value=Math.max(1,
|
|
|
|
|
Math.min(p,Math.max(parseInt(m.value),parseInt(u.value))));u.value=Math.max(1,Math.min(p,Math.min(parseInt(m.value),parseInt(u.value))))}function f(b){function c(b,c,d){var l=b.getGraphBounds(),e=0,p=0,g=ja.get(),k=1/b.pageScale,t=x.checked;if(t)var k=parseInt(S.value),v=parseInt(T.value),k=Math.min(g.height*v/(l.height/b.view.scale),g.width*k/(l.width/b.view.scale));else k=parseInt(z.value)/(100*b.pageScale),isNaN(k)&&(f=1/b.pageScale,z.value="100 %");g=mxRectangle.fromRectangle(g);g.width=Math.ceil(g.width*
|
|
|
|
|
f);g.height=Math.ceil(g.height*f);k*=f;!t&&b.pageVisible?(l=b.getPageLayout(),e-=l.x*g.width,p-=l.y*g.height):t=!0;if(null==c){c=PrintDialog.createPrintPreview(b,k,g,0,e,p,t);c.pageSelector=!1;c.mathEnabled=!1;b=a.getCurrentFile();null!=b&&(c.title=b.getTitle());var u=c.writeHead;c.writeHead=function(b){u.apply(this,arguments);null!=a.editor.fontCss&&(b.writeln('<style type="text/css">'),b.writeln(a.editor.fontCss),b.writeln("</style>"))};if("undefined"!==typeof MathJax){var B=c.renderPage;c.renderPage=
|
|
|
|
|
function(a,b,c,f,d,l){var e=mxClient.NO_FO;mxClient.NO_FO=this.graph.mathEnabled&&!this.useForeignObjectForMath?!0:this.originalNoForeignObject;var p=B.apply(this,arguments);mxClient.NO_FO=e;this.graph.mathEnabled?this.mathEnabled=this.mathEnabled||!0:p.className="geDisableMathJax";return p}}c.open(null,null,d,!0)}else{g=b.background;if(null==g||""==g||g==mxConstants.NONE)g="#ffffff";c.backgroundColor=g;c.autoOrigin=t;c.appendGraph(b,k,e,p,d,!0)}return c}var f=parseInt(ka.value)/100;isNaN(f)&&(f=
|
|
|
|
|
1,ka.value="100 %");var f=.75*f,l=u.value,e=m.value,p=!t.checked,k=null;p&&(p=l==g&&e==g);if(!p&&null!=a.pages&&a.pages.length){var v=0,p=a.pages.length-1;t.checked||(v=parseInt(l)-1,p=parseInt(e)-1);for(var B=v;B<=p;B++){var n=a.pages[B],l=n==a.currentPage?d:null;if(null==l){var l=a.createTemporaryGraph(d.getStylesheet()),e=!0,v=!1,y=null,A=null;null==n.viewState&&null==n.root&&a.updatePageRoot(n);null!=n.viewState&&(e=n.viewState.pageVisible,v=n.viewState.mathEnabled,y=n.viewState.background,A=
|
|
|
|
|
n.viewState.backgroundImage);l.background=y;l.backgroundImage=null!=A?new mxImage(A.src,A.width,A.height):null;l.pageVisible=e;l.mathEnabled=v;var C=l.getGlobalVariable;l.getGlobalVariable=function(a){return"page"==a?n.getName():"pagenumber"==a?B+1:C.apply(this,arguments)};document.body.appendChild(l.container);a.updatePageRoot(n);l.model.setRoot(n.root)}k=c(l,k,B!=p);l!=d&&l.container.parentNode.removeChild(l.container)}}else k=c(d);null==k?a.handleError({message:mxResources.get("errorUpdatingPreview")}):
|
|
|
|
|
(k.mathEnabled&&(p=k.wnd.document,p.writeln('<script type="text/x-mathjax-config">'),p.writeln("MathJax.Hub.Config({"),p.writeln("showMathMenu: false,"),p.writeln('messageStyle: "none",'),p.writeln('jax: ["input/TeX", "input/MathML", "input/AsciiMath", "output/HTML-CSS"],'),p.writeln('extensions: ["tex2jax.js", "mml2jax.js", "asciimath2jax.js"],'),p.writeln('"HTML-CSS": {'),p.writeln("imageFont: null"),p.writeln("},"),p.writeln("TeX: {"),p.writeln('extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]'),
|
|
|
|
|
p.writeln("},"),p.writeln("tex2jax: {"),p.writeln('\tignoreClass: "geDisableMathJax"'),p.writeln("},"),p.writeln("asciimath2jax: {"),p.writeln('\tignoreClass: "geDisableMathJax"'),p.writeln("}"),p.writeln("});"),b&&(p.writeln("MathJax.Hub.Queue(function () {"),p.writeln("window.print();"),p.writeln("});")),p.writeln("\x3c/script>"),p.writeln('<script type="text/javascript" src="'+DRAW_MATH_URL+'/MathJax.js">\x3c/script>')),k.closeDocument(),!k.mathEnabled&&b&&PrintDialog.printPreview(k))}var d=a.editor.graph,
|
|
|
|
|
l=document.createElement("div"),e=document.createElement("h3");e.style.width="100%";e.style.textAlign="center";e.style.marginTop="0px";mxUtils.write(e,b||mxResources.get("print"));l.appendChild(e);var p=1,g=1,k=document.createElement("div");k.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");k.appendChild(t);e=document.createElement("span");mxUtils.write(e,mxResources.get("printAllPages"));k.appendChild(e);mxUtils.br(k);var v=t.cloneNode(!0);t.setAttribute("checked","checked");v.setAttribute("value","range");k.appendChild(v);e=document.createElement("span");mxUtils.write(e,mxResources.get("pages")+":");k.appendChild(e);var u=document.createElement("input");u.style.cssText="margin:0 8px 0 8px;";u.setAttribute("value","1");u.setAttribute("type","number");u.setAttribute("min",
|
|
|
|
|
"1");u.style.width="50px";k.appendChild(u);e=document.createElement("span");mxUtils.write(e,mxResources.get("to"));k.appendChild(e);var m=u.cloneNode(!0);k.appendChild(m);mxEvent.addListener(u,"focus",function(){v.checked=!0});mxEvent.addListener(m,"focus",function(){v.checked=!0});mxEvent.addListener(u,"change",c);mxEvent.addListener(m,"change",c);if(null!=a.pages&&(p=a.pages.length,null!=a.currentPage))for(e=0;e<a.pages.length;e++)if(a.currentPage==a.pages[e]){g=e+1;u.value=g;m.value=g;break}u.setAttribute("max",
|
|
|
|
|
p);m.setAttribute("max",p);1<p&&l.appendChild(k);var B=document.createElement("div");B.style.marginBottom="10px";var n=document.createElement("input");n.style.marginRight="8px";n.setAttribute("value","adjust");n.setAttribute("type","radio");n.setAttribute("name","printZoom");B.appendChild(n);e=document.createElement("span");mxUtils.write(e,mxResources.get("adjustTo"));B.appendChild(e);var z=document.createElement("input");z.style.cssText="margin:0 8px 0 8px;";z.setAttribute("value","100 %");z.style.width=
|
|
|
|
|
"50px";B.appendChild(z);mxEvent.addListener(z,"focus",function(){n.checked=!0});l.appendChild(B);var k=k.cloneNode(!1),x=n.cloneNode(!0);x.setAttribute("value","fit");n.setAttribute("checked","checked");e=document.createElement("div");e.style.cssText="display:inline-block;height:100%;vertical-align:top;padding-top:2px;";e.appendChild(x);k.appendChild(e);B=document.createElement("table");B.style.display="inline-block";var y=document.createElement("tbody"),A=document.createElement("tr"),C=A.cloneNode(!0),
|
|
|
|
|
q=document.createElement("td"),D=q.cloneNode(!0),J=q.cloneNode(!0),P=q.cloneNode(!0),N=q.cloneNode(!0),ba=q.cloneNode(!0);q.style.textAlign="right";P.style.textAlign="right";mxUtils.write(q,mxResources.get("fitTo"));var S=document.createElement("input");S.style.cssText="margin:0 8px 0 8px;";S.setAttribute("value","1");S.setAttribute("min","1");S.setAttribute("type","number");S.style.width="40px";D.appendChild(S);e=document.createElement("span");mxUtils.write(e,mxResources.get("fitToSheetsAcross"));
|
|
|
|
|
J.appendChild(e);mxUtils.write(P,mxResources.get("fitToBy"));var T=S.cloneNode(!0);N.appendChild(T);mxEvent.addListener(S,"focus",function(){x.checked=!0});mxEvent.addListener(T,"focus",function(){x.checked=!0});e=document.createElement("span");mxUtils.write(e,mxResources.get("fitToSheetsDown"));ba.appendChild(e);A.appendChild(q);A.appendChild(D);A.appendChild(J);C.appendChild(P);C.appendChild(N);C.appendChild(ba);y.appendChild(A);y.appendChild(C);B.appendChild(y);k.appendChild(B);l.appendChild(k);
|
|
|
|
|
k=document.createElement("div");e=document.createElement("div");e.style.fontWeight="bold";e.style.marginBottom="12px";mxUtils.write(e,mxResources.get("paperSize"));k.appendChild(e);e=document.createElement("div");e.style.marginBottom="12px";var ja=PageSetupDialog.addPageFormatPanel(e,"printdialog",a.editor.graph.pageFormat||mxConstants.PAGE_FORMAT_A4_PORTRAIT);k.appendChild(e);e=document.createElement("span");mxUtils.write(e,mxResources.get("pageScale"));k.appendChild(e);var ka=document.createElement("input");
|
|
|
|
|
ka.style.cssText="margin:0 8px 0 8px;";ka.setAttribute("value","100 %");ka.style.width="60px";k.appendChild(ka);l.appendChild(k);e=document.createElement("div");e.style.cssText="text-align:right;margin:48px 0 0 0;";k=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});k.className="geBtn";a.editor.cancelFirst&&e.appendChild(k);a.isOffline()||(B=mxUtils.button(mxResources.get("help"),function(){d.openLink("https://desk.draw.io/support/solutions/articles/16000048947")}),B.className=
|
|
|
|
|
"geBtn",e.appendChild(B));PrintDialog.previewEnabled&&(B=mxUtils.button(mxResources.get("preview"),function(){a.hideDialog();f(!1)}),B.className="geBtn",e.appendChild(B));B=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){a.hideDialog();f(!0)});B.className="geBtn gePrimaryBtn";e.appendChild(B);a.editor.cancelFirst||e.appendChild(k);l.appendChild(e);this.container=l};var v=ChangePageSetup.prototype.execute;ChangePageSetup.prototype.execute=function(){null==this.page&&
|
|
|
|
|
[STENCIL_PATH+"/pid/flow_sensors.xml"];mxMarker.getPackageForType=function(a){var b=null;null!=a&&0<a.length&&("ER"==a.substring(0,2)?b="mxgraph.er":"sysML"==a.substring(0,5)&&(b="mxgraph.sysml"));return b};var C=mxMarker.createMarker;mxMarker.createMarker=function(a,b,c,f,d,l,p,e,g,k){if(null!=c&&null==mxMarker.markers[c]){var t=this.getPackageForType(c);null!=t&&mxStencilRegistry.getStencil(t)}return C.apply(this,arguments)};PrintDialog.prototype.create=function(a,b){function c(){m.value=Math.max(1,
|
|
|
|
|
Math.min(e,Math.max(parseInt(m.value),parseInt(u.value))));u.value=Math.max(1,Math.min(e,Math.min(parseInt(m.value),parseInt(u.value))))}function f(b){function c(b,c,d){var l=b.getGraphBounds(),p=0,e=0,g=ja.get(),k=1/b.pageScale,t=x.checked;if(t)var k=parseInt(S.value),v=parseInt(T.value),k=Math.min(g.height*v/(l.height/b.view.scale),g.width*k/(l.width/b.view.scale));else k=parseInt(z.value)/(100*b.pageScale),isNaN(k)&&(f=1/b.pageScale,z.value="100 %");g=mxRectangle.fromRectangle(g);g.width=Math.ceil(g.width*
|
|
|
|
|
f);g.height=Math.ceil(g.height*f);k*=f;!t&&b.pageVisible?(l=b.getPageLayout(),p-=l.x*g.width,e-=l.y*g.height):t=!0;if(null==c){c=PrintDialog.createPrintPreview(b,k,g,0,p,e,t);c.pageSelector=!1;c.mathEnabled=!1;b=a.getCurrentFile();null!=b&&(c.title=b.getTitle());var u=c.writeHead;c.writeHead=function(b){u.apply(this,arguments);null!=a.editor.fontCss&&(b.writeln('<style type="text/css">'),b.writeln(a.editor.fontCss),b.writeln("</style>"))};if("undefined"!==typeof MathJax){var B=c.renderPage;c.renderPage=
|
|
|
|
|
function(a,b,c,f,d,l){var p=mxClient.NO_FO;mxClient.NO_FO=this.graph.mathEnabled&&!this.useForeignObjectForMath?!0:this.originalNoForeignObject;var e=B.apply(this,arguments);mxClient.NO_FO=p;this.graph.mathEnabled?this.mathEnabled=this.mathEnabled||!0:e.className="geDisableMathJax";return e}}c.open(null,null,d,!0)}else{g=b.background;if(null==g||""==g||g==mxConstants.NONE)g="#ffffff";c.backgroundColor=g;c.autoOrigin=t;c.appendGraph(b,k,p,e,d,!0)}return c}var f=parseInt(ka.value)/100;isNaN(f)&&(f=
|
|
|
|
|
1,ka.value="100 %");var f=.75*f,l=u.value,p=m.value,e=!t.checked,k=null;e&&(e=l==g&&p==g);if(!e&&null!=a.pages&&a.pages.length){var v=0,e=a.pages.length-1;t.checked||(v=parseInt(l)-1,e=parseInt(p)-1);for(var B=v;B<=e;B++){var n=a.pages[B],l=n==a.currentPage?d:null;if(null==l){var l=a.createTemporaryGraph(d.getStylesheet()),p=!0,v=!1,y=null,A=null;null==n.viewState&&null==n.root&&a.updatePageRoot(n);null!=n.viewState&&(p=n.viewState.pageVisible,v=n.viewState.mathEnabled,y=n.viewState.background,A=
|
|
|
|
|
n.viewState.backgroundImage);l.background=y;l.backgroundImage=null!=A?new mxImage(A.src,A.width,A.height):null;l.pageVisible=p;l.mathEnabled=v;var C=l.getGlobalVariable;l.getGlobalVariable=function(a){return"page"==a?n.getName():"pagenumber"==a?B+1:C.apply(this,arguments)};document.body.appendChild(l.container);a.updatePageRoot(n);l.model.setRoot(n.root)}k=c(l,k,B!=e);l!=d&&l.container.parentNode.removeChild(l.container)}}else k=c(d);null==k?a.handleError({message:mxResources.get("errorUpdatingPreview")}):
|
|
|
|
|
(k.mathEnabled&&(e=k.wnd.document,e.writeln('<script type="text/x-mathjax-config">'),e.writeln("MathJax.Hub.Config({"),e.writeln("showMathMenu: false,"),e.writeln('messageStyle: "none",'),e.writeln('jax: ["input/TeX", "input/MathML", "input/AsciiMath", "output/HTML-CSS"],'),e.writeln('extensions: ["tex2jax.js", "mml2jax.js", "asciimath2jax.js"],'),e.writeln('"HTML-CSS": {'),e.writeln("imageFont: null"),e.writeln("},"),e.writeln("TeX: {"),e.writeln('extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]'),
|
|
|
|
|
e.writeln("},"),e.writeln("tex2jax: {"),e.writeln('\tignoreClass: "geDisableMathJax"'),e.writeln("},"),e.writeln("asciimath2jax: {"),e.writeln('\tignoreClass: "geDisableMathJax"'),e.writeln("}"),e.writeln("});"),b&&(e.writeln("MathJax.Hub.Queue(function () {"),e.writeln("window.print();"),e.writeln("});")),e.writeln("\x3c/script>"),e.writeln('<script type="text/javascript" src="'+DRAW_MATH_URL+'/MathJax.js">\x3c/script>')),k.closeDocument(),!k.mathEnabled&&b&&PrintDialog.printPreview(k))}var d=a.editor.graph,
|
|
|
|
|
l=document.createElement("div"),p=document.createElement("h3");p.style.width="100%";p.style.textAlign="center";p.style.marginTop="0px";mxUtils.write(p,b||mxResources.get("print"));l.appendChild(p);var e=1,g=1,k=document.createElement("div");k.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");k.appendChild(t);p=document.createElement("span");mxUtils.write(p,mxResources.get("printAllPages"));k.appendChild(p);mxUtils.br(k);var v=t.cloneNode(!0);t.setAttribute("checked","checked");v.setAttribute("value","range");k.appendChild(v);p=document.createElement("span");mxUtils.write(p,mxResources.get("pages")+":");k.appendChild(p);var u=document.createElement("input");u.style.cssText="margin:0 8px 0 8px;";u.setAttribute("value","1");u.setAttribute("type","number");u.setAttribute("min",
|
|
|
|
|
"1");u.style.width="50px";k.appendChild(u);p=document.createElement("span");mxUtils.write(p,mxResources.get("to"));k.appendChild(p);var m=u.cloneNode(!0);k.appendChild(m);mxEvent.addListener(u,"focus",function(){v.checked=!0});mxEvent.addListener(m,"focus",function(){v.checked=!0});mxEvent.addListener(u,"change",c);mxEvent.addListener(m,"change",c);if(null!=a.pages&&(e=a.pages.length,null!=a.currentPage))for(p=0;p<a.pages.length;p++)if(a.currentPage==a.pages[p]){g=p+1;u.value=g;m.value=g;break}u.setAttribute("max",
|
|
|
|
|
e);m.setAttribute("max",e);1<e&&l.appendChild(k);var B=document.createElement("div");B.style.marginBottom="10px";var n=document.createElement("input");n.style.marginRight="8px";n.setAttribute("value","adjust");n.setAttribute("type","radio");n.setAttribute("name","printZoom");B.appendChild(n);p=document.createElement("span");mxUtils.write(p,mxResources.get("adjustTo"));B.appendChild(p);var z=document.createElement("input");z.style.cssText="margin:0 8px 0 8px;";z.setAttribute("value","100 %");z.style.width=
|
|
|
|
|
"50px";B.appendChild(z);mxEvent.addListener(z,"focus",function(){n.checked=!0});l.appendChild(B);var k=k.cloneNode(!1),x=n.cloneNode(!0);x.setAttribute("value","fit");n.setAttribute("checked","checked");p=document.createElement("div");p.style.cssText="display:inline-block;height:100%;vertical-align:top;padding-top:2px;";p.appendChild(x);k.appendChild(p);B=document.createElement("table");B.style.display="inline-block";var y=document.createElement("tbody"),A=document.createElement("tr"),C=A.cloneNode(!0),
|
|
|
|
|
q=document.createElement("td"),D=q.cloneNode(!0),J=q.cloneNode(!0),P=q.cloneNode(!0),N=q.cloneNode(!0),ba=q.cloneNode(!0);q.style.textAlign="right";P.style.textAlign="right";mxUtils.write(q,mxResources.get("fitTo"));var S=document.createElement("input");S.style.cssText="margin:0 8px 0 8px;";S.setAttribute("value","1");S.setAttribute("min","1");S.setAttribute("type","number");S.style.width="40px";D.appendChild(S);p=document.createElement("span");mxUtils.write(p,mxResources.get("fitToSheetsAcross"));
|
|
|
|
|
J.appendChild(p);mxUtils.write(P,mxResources.get("fitToBy"));var T=S.cloneNode(!0);N.appendChild(T);mxEvent.addListener(S,"focus",function(){x.checked=!0});mxEvent.addListener(T,"focus",function(){x.checked=!0});p=document.createElement("span");mxUtils.write(p,mxResources.get("fitToSheetsDown"));ba.appendChild(p);A.appendChild(q);A.appendChild(D);A.appendChild(J);C.appendChild(P);C.appendChild(N);C.appendChild(ba);y.appendChild(A);y.appendChild(C);B.appendChild(y);k.appendChild(B);l.appendChild(k);
|
|
|
|
|
k=document.createElement("div");p=document.createElement("div");p.style.fontWeight="bold";p.style.marginBottom="12px";mxUtils.write(p,mxResources.get("paperSize"));k.appendChild(p);p=document.createElement("div");p.style.marginBottom="12px";var ja=PageSetupDialog.addPageFormatPanel(p,"printdialog",a.editor.graph.pageFormat||mxConstants.PAGE_FORMAT_A4_PORTRAIT);k.appendChild(p);p=document.createElement("span");mxUtils.write(p,mxResources.get("pageScale"));k.appendChild(p);var ka=document.createElement("input");
|
|
|
|
|
ka.style.cssText="margin:0 8px 0 8px;";ka.setAttribute("value","100 %");ka.style.width="60px";k.appendChild(ka);l.appendChild(k);p=document.createElement("div");p.style.cssText="text-align:right;margin:48px 0 0 0;";k=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()});k.className="geBtn";a.editor.cancelFirst&&p.appendChild(k);a.isOffline()||(B=mxUtils.button(mxResources.get("help"),function(){d.openLink("https://desk.draw.io/support/solutions/articles/16000048947")}),B.className=
|
|
|
|
|
"geBtn",p.appendChild(B));PrintDialog.previewEnabled&&(B=mxUtils.button(mxResources.get("preview"),function(){a.hideDialog();f(!1)}),B.className="geBtn",p.appendChild(B));B=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){a.hideDialog();f(!0)});B.className="geBtn gePrimaryBtn";p.appendChild(B);a.editor.cancelFirst||p.appendChild(k);l.appendChild(p);this.container=l};var v=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)):(v.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 B=document.createElement("canvas"),D=new Image;D.onload=function(){try{B.getContext("2d").drawImage(D,0,0);var a=B.toDataURL("image/png");Editor.prototype.useCanvasForExport=
|
|
|
|
|
null!=a&&6<a.length}catch(J){}};D.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(y){}})();
|
|
|
|
|
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,b,d){d.ui=a.ui;return b};a.afterDecode=function(a,b,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="11.0.7";EditorUi.compactUi="atlas"!=uiTheme;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";EditorUi.enablePlantUml=
|
|
|
|
|
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,b,d){d.ui=a.ui;return b};a.afterDecode=function(a,b,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="11.0.8";EditorUi.compactUi="atlas"!=uiTheme;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";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,c,d,e){if("1"==urlParams.dev)EditorUi.debug("logError",a,b,c,d,e);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 f=0<=a.indexOf("NetworkError")||0<=a.indexOf("SecurityError")||0<=a.indexOf("NS_ERROR_FAILURE")||0<=a.indexOf("out of memory")?"CONFIG":"SEVERE",l=null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"";e=null!=e?e:Error(a);(new Image).src=l+"/log?severity="+f+"&v="+encodeURIComponent(EditorUi.VERSION)+"&msg=clientError:"+encodeURIComponent(a)+":url:"+encodeURIComponent(window.location.href)+":lnum:"+encodeURIComponent(c)+(null!=d?":colno:"+encodeURIComponent(d):"")+(null!=e&&null!=e.stack?"&stack="+
|
|
|
|
|
encodeURIComponent(e.stack):"")}}catch(x){}};EditorUi.logEvent=function(a){if("1"==urlParams.dev)EditorUi.debug("logEvent",a);else if(EditorUi.enableLogging)try{var b=null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:"";(new Image).src=b+"/images/1x1.png?v="+encodeURIComponent(EditorUi.VERSION)+(null!=a?"&data="+encodeURIComponent(JSON.stringify(a)):"")}catch(p){}};EditorUi.sendReport=function(a,b){if("1"==urlParams.dev)EditorUi.debug("sendReport",a);else if(EditorUi.enableLogging)try{b=null!=b?b:
|
|
|
|
|
5E4,a.length>b&&(a=a.substring(0,b)+"\n...[SHORTENED]"),mxUtils.post("/email","version="+encodeURIComponent(EditorUi.VERSION)+"&url="+encodeURIComponent(window.location.href)+"&data="+encodeURIComponent(a))}catch(p){}};EditorUi.debug=function(){try{if(null!=window.console&&"1"==urlParams.dev){for(var a=[(new Date).toISOString()],b=0;b<arguments.length;b++)a.push(arguments[b]);console.log.apply(console,a)}}catch(p){}};EditorUi.parsePng=function(a,b,c){function f(a,b){var c=l;l+=b;return a.substring(c,
|
|
|
|
|
l)}function d(a){a=f(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}var l=0;if(f(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=c&&c();else if(f(a,4),"IHDR"!=f(a,4))null!=c&&c();else{f(a,17);do{c=d(a);var e=f(a,4);if(null!=b&&b(l-8,e,c))break;value=f(a,c);f(a,4);if("IEND"==e)break}while(c)}};EditorUi.removeChildNodes=function(a){for(;null!=a.firstChild;)a.removeChild(a.firstChild)};EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';
|
|
|
|
|
l)}function d(a){a=f(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}var l=0;if(f(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=c&&c();else if(f(a,4),"IHDR"!=f(a,4))null!=c&&c();else{f(a,17);do{c=d(a);var p=f(a,4);if(null!=b&&b(l-8,p,c))break;value=f(a,c);f(a,4);if("IEND"==p)break}while(c)}};EditorUi.removeChildNodes=function(a){for(;null!=a.firstChild;)a.removeChild(a.firstChild)};EditorUi.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';
|
|
|
|
|
EditorUi.prototype.emptyLibraryXml="<mxlibrary>[]</mxlibrary>";EditorUi.prototype.mode=null;EditorUi.prototype.timeout=Editor.prototype.timeout;EditorUi.prototype.sidebarFooterHeight=38;EditorUi.prototype.defaultCustomShapeStyle="shape=stencil(tZRtTsQgEEBPw1+DJR7AoN6DbWftpAgE0Ortd/jYRGq72R+YNE2YgTePloEJGWblgA18ZuKFDcMj5/Sm8boZq+BgjCX4pTyqk6ZlKROitwusOMXKQDODx5iy4pXxZ5qTHiFHawxB0JrQZH7lCabQ0Fr+XWC1/E8zcsT/gAi+Subo2/3Mh6d/oJb5nU1b5tW7r2knautaa3T+U32o7f7vZwpJkaNDLORJjcu7t59m2jXxqX9un+tt022acsfmoKaQZ+vhhswZtS6Ne/ThQGt0IV0N3Yyv6P3CeT9/tHO0XFI5cAE=);whiteSpace=wrap;html=1;";
|
|
|
|
|
EditorUi.prototype.svgBrokenImage=Graph.createSvgImage(10,10,'<rect x="0" y="0" width="10" height="10" stroke="#000" fill="transparent"/><path d="m 0 0 L 10 10 L 0 10 L 10 0" stroke="#000" fill="transparent"/>');EditorUi.prototype.crossOriginImages=!mxClient.IS_IE;EditorUi.prototype.maxBackgroundSize=1600;EditorUi.prototype.maxImageSize=520;EditorUi.prototype.resampleThreshold=1E5;EditorUi.prototype.maxImageBytes=1E6;EditorUi.prototype.maxBackgroundBytes=25E5;EditorUi.prototype.maxTextBytes=5E5;EditorUi.prototype.currentFile=
|
|
|
|
|
null;EditorUi.prototype.printPdfExport=!1;EditorUi.prototype.pdfPageExport=!0;EditorUi.prototype.formatEnabled="0"!=urlParams.format;EditorUi.prototype.insertTemplateEnabled=!0;EditorUi.prototype.closableScratchpad=!0;(function(){EditorUi.prototype.useCanvasForExport=!1;EditorUi.prototype.jpgSupported=!1;try{var a=document.createElement("canvas");EditorUi.prototype.canvasSupported=!(!a.getContext||!a.getContext("2d"))}catch(z){}try{var b=document.createElement("canvas"),c=new Image;c.onload=function(){try{b.getContext("2d").drawImage(c,
|
|
|
|
@ -8516,21 +8516,21 @@ a,d,c,k,e,m,n);this.editor.graph.pageVisible=f;return l}catch(K){this.handleErro
|
|
|
|
|
this.convertImages(x,mxUtils.bind(this,mxUtils.bind(this,function(a){this.spinner.stop();u('<?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 l=f+".svg",t=this.getFileData(!1,!0,null,mxUtils.bind(this,function(a){this.spinner.stop();u(a)}),d)}}catch(G){this.handleError(G)}};EditorUi.prototype.createDownloadRequest=function(a,b,c,d,e,g,k,m){var f=this.editor.graph.getGraphBounds();
|
|
|
|
|
c=this.getFileData(!0,null,null,null,c,0==g?!1:"xmlpng"!=b);var l="",p="";if(f.width*f.height>MAX_AREA||c.length>MAX_REQUEST_SIZE)throw{message:mxResources.get("drawingTooLarge")};f="0";"pdf"==b&&0==g&&(p="&allPages=1");if("xmlpng"==b&&(f="1",b="png",null!=this.pages&&null!=this.currentPage))for(g=0;g<this.pages.length;g++)if(this.pages[g]==this.currentPage){l="&from="+g;break}g=this.editor.graph.background;"png"==b&&e?g=mxConstants.NONE:e||null!=g&&g!=mxConstants.NONE||(g="#ffffff");return new mxXmlRequest(EXPORT_URL,
|
|
|
|
|
"format="+b+l+p+"&bg="+(null!=g?g:mxConstants.NONE)+"&base64="+d+"&embedXml="+f+"&xml="+encodeURIComponent(c)+(null!=a?"&filename="+encodeURIComponent(a):"")+(null!=k?"&scale="+k:"")+(null!=m?"&border="+m:""))};EditorUi.prototype.setMode=function(a,b){this.mode=a};EditorUi.prototype.loadDescriptor=function(a,b,c){var f=window.location.hash,d=mxUtils.bind(this,function(c){var d=null!=a.data?a.data:"";null!=c&&0<c.length&&(0<d.length&&(d+="\n"),d+=c);c=new LocalFile(this,"csv"!=a.format&&0<d.length?
|
|
|
|
|
d:this.emptyDiagramXml,null!=urlParams.title?decodeURIComponent(urlParams.title):this.defaultFilename,!0);c.getHash=function(){return f};this.fileLoaded(c);"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,l=null,g=mxUtils.bind(this,function(){var b=this.currentPage;mxUtils.post(a.update,"xml="+encodeURIComponent(mxUtils.getXml(this.editor.getGraphXml())),
|
|
|
|
|
mxUtils.bind(this,function(a){b===this.currentPage&&(200<=a.getStatus()&&300>=a.getStatus()?(this.updateDiagram(a.getText()),p()):this.handleError({message:mxResources.get("error")+" "+a.getStatus()}))}),mxUtils.bind(this,function(a){this.handleError(a)}))}),p=mxUtils.bind(this,function(){window.clearTimeout(l);l=window.setTimeout(g,e)});this.editor.addListener("pageSelected",mxUtils.bind(this,function(){p();g()}));p();g()}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){d(a)}),mxUtils.bind(this,function(a){null!=c&&c(a)}))}else d("")};EditorUi.prototype.updateDiagram=function(a){function b(a){var b=new mxCellOverlay(a.image||f.warningImage,a.tooltip,a.align,a.valign,a.offset);b.addListener(mxEvent.CLICK,function(b,c){d.alert(a.tooltip)});return b}var c=null,d=this;if(null!=a&&0<a.length&&(c=mxUtils.parseXml(a),a=null!=c?c.documentElement:
|
|
|
|
|
d:this.emptyDiagramXml,null!=urlParams.title?decodeURIComponent(urlParams.title):this.defaultFilename,!0);c.getHash=function(){return f};this.fileLoaded(c);"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 l=null!=a.interval?parseInt(a.interval):6E4,e=null,g=mxUtils.bind(this,function(){var b=this.currentPage;mxUtils.post(a.update,"xml="+encodeURIComponent(mxUtils.getXml(this.editor.getGraphXml())),
|
|
|
|
|
mxUtils.bind(this,function(a){b===this.currentPage&&(200<=a.getStatus()&&300>=a.getStatus()?(this.updateDiagram(a.getText()),p()):this.handleError({message:mxResources.get("error")+" "+a.getStatus()}))}),mxUtils.bind(this,function(a){this.handleError(a)}))}),p=mxUtils.bind(this,function(){window.clearTimeout(e);e=window.setTimeout(g,l)});this.editor.addListener("pageSelected",mxUtils.bind(this,function(){p();g()}));p();g()}null!=b&&b()});if(null!=a.url&&0<a.url.length){var l=a.url;/^https?:\/\//.test(l)&&
|
|
|
|
|
!this.editor.isCorsEnabledForUrl(l)&&(l=PROXY_URL+"?url="+encodeURIComponent(l));this.loadUrl(l,mxUtils.bind(this,function(a){d(a)}),mxUtils.bind(this,function(a){null!=c&&c(a)}))}else d("")};EditorUi.prototype.updateDiagram=function(a){function b(a){var b=new mxCellOverlay(a.image||f.warningImage,a.tooltip,a.align,a.valign,a.offset);b.addListener(mxEvent.CLICK,function(b,c){d.alert(a.tooltip)});return b}var c=null,d=this;if(null!=a&&0<a.length&&(c=mxUtils.parseXml(a),a=null!=c?c.documentElement:
|
|
|
|
|
null,null!=a&&"updates"==a.nodeName)){var f=this.editor.graph,e=f.getModel();e.beginUpdate();var g=null;try{for(a=a.firstChild;null!=a;){if("update"==a.nodeName){var k=e.getCell(a.getAttribute("id"));if(null!=k){try{var m=a.getAttribute("value");if(null!=m){var v=mxUtils.parseXml(m).documentElement;if(null!=v)if("1"==v.getAttribute("replace-value"))e.setValue(k,v);else for(var B=v.attributes,n=0;n<B.length;n++)f.setAttributeForCell(k,B[n].nodeName,0<B[n].nodeValue.length?B[n].nodeValue:null)}}catch(L){null!=
|
|
|
|
|
window.console&&console.log("Error in value for "+k.id+": "+L)}try{var y=a.getAttribute("style");null!=y&&f.model.setStyle(k,y)}catch(L){null!=window.console&&console.log("Error in style for "+k.id+": "+L)}try{var q=a.getAttribute("icon");if(null!=q){var H=0<q.length?JSON.parse(q):null;null!=H&&H.append||f.removeCellOverlays(k);null!=H&&f.addCellOverlay(k,b(H))}}catch(L){null!=window.console&&console.log("Error in icon for "+k.id+": "+L)}try{var F=a.getAttribute("geometry");if(null!=F){var F=JSON.parse(F),
|
|
|
|
|
G=f.getCellGeometry(k);if(null!=G){G=G.clone();for(key in F){var I=parseFloat(F[key]);"dx"==key?G.x+=I:"dy"==key?G.y+=I:"dw"==key?G.width+=I:"dh"==key?G.height+=I:G[key]=parseFloat(F[key])}f.model.setGeometry(k,G)}}}catch(L){null!=window.console&&console.log("Error in icon for "+k.id+": "+L)}}}else if("model"==a.nodeName){for(var E=a.firstChild;null!=E&&E.nodeType!=mxConstants.NODETYPE_ELEMENT;)E=E.nextSibling;null!=E&&(new mxCodec(a.firstChild)).decode(E,e)}else if("view"==a.nodeName){if(a.hasAttribute("scale")&&
|
|
|
|
|
(f.view.scale=parseFloat(a.getAttribute("scale"))),a.hasAttribute("dx")||a.hasAttribute("dy"))f.view.translate=new mxPoint(parseFloat(a.getAttribute("dx")||0),parseFloat(a.getAttribute("dy")||0))}else"fit"==a.nodeName&&(g=a.hasAttribute("max-scale")?parseFloat(a.getAttribute("max-scale")):1);a=a.nextSibling}}finally{e.endUpdate()}null!=g&&this.chromelessResize&&this.chromelessResize(!0,g)}return c};EditorUi.prototype.getCopyFilename=function(a,b){var c=null!=a&&null!=a.getTitle()?a.getTitle():this.defaultFilename,
|
|
|
|
|
d="",f=c.lastIndexOf(".");0<=f&&(d=c.substring(f),c=c.substring(0,f));if(b)var e=new Date,f=e.getFullYear(),l=e.getMonth()+1,g=e.getDate(),k=e.getHours(),v=e.getMinutes(),e=e.getSeconds(),c=c+(" "+(f+"-"+l+"-"+g+"-"+k+"-"+v+"-"+e));return c=mxResources.get("copyOf",[c])+d};EditorUi.prototype.fileLoaded=function(a,b){var c=this.getCurrentFile();this.fileLoadedError=null;this.setCurrentFile(null);var d=!1;this.hideDialog();null!=c&&(c.removeListener(this.descriptorChangedListener),c.close());this.editor.graph.model.clear();
|
|
|
|
|
d="",f=c.lastIndexOf(".");0<=f&&(d=c.substring(f),c=c.substring(0,f));if(b)var l=new Date,f=l.getFullYear(),e=l.getMonth()+1,g=l.getDate(),k=l.getHours(),v=l.getMinutes(),l=l.getSeconds(),c=c+(" "+(f+"-"+e+"-"+g+"-"+k+"-"+v+"-"+l));return c=mxResources.get("copyOf",[c])+d};EditorUi.prototype.fileLoaded=function(a,b){var c=this.getCurrentFile();this.fileLoadedError=null;this.setCurrentFile(null);var d=!1;this.hideDialog();null!=c&&(c.removeListener(this.descriptorChangedListener),c.close());this.editor.graph.model.clear();
|
|
|
|
|
this.editor.undoManager.clear();var f=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"));d=!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(A){}try{mxSettings.setOpenCounter(mxSettings.getOpenCounter()+
|
|
|
|
|
1),mxSettings.save()}catch(A){}}catch(A){this.fileLoadedError=A;null!=window.console&&(console.error(A),console.log("error in fileLoaded:",a,A));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!=A&&null!=A.message?":err:"+encodeURIComponent(A.message):"")+(null!=A&&null!=A.stack?"&stack="+encodeURIComponent(A.stack):
|
|
|
|
|
"")}catch(x){}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):f()});b?e():this.handleError(A,mxResources.get("errorLoadingFile"),e,!0)}else f();return d};EditorUi.prototype.getHashValueForPages=function(a,b){var c=0,d=new mxGraphModel,f=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 l=a[e].node.cloneNode(!1);l.removeAttribute("name");d.root=a[e].root;var g=f.encode(d);this.editor.graph.saveViewState(a[e].viewState,g,!0);g.removeAttribute("pageWidth");g.removeAttribute("pageHeight");l.appendChild(g);null!=b&&(b.eltCount+=l.getElementsByTagName("*").length,b.nodeCount+=l.getElementsByTagName("mxCell").length);c=(c<<5)-c+this.hashValue(l,function(a,b,c,d){return!d||"mxGeometry"!=a.nodeName&&"mxPoint"!=a.nodeName||"x"!=b&&"y"!=b&&"width"!=b&&"height"!=b?d&&"mxCell"==a.nodeName&&
|
|
|
|
|
"")}catch(x){}var l=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):f()});b?l():this.handleError(A,mxResources.get("errorLoadingFile"),l,!0)}else f();return d};EditorUi.prototype.getHashValueForPages=function(a,b){var c=0,d=new mxGraphModel,f=new mxCodec;null!=b&&(b.byteCount=0,b.attrCount=0,b.eltCount=0,b.nodeCount=0);for(var l=0;l<a.length;l++){this.updatePageRoot(a[l]);
|
|
|
|
|
var e=a[l].node.cloneNode(!1);e.removeAttribute("name");d.root=a[l].root;var g=f.encode(d);this.editor.graph.saveViewState(a[l].viewState,g,!0);g.removeAttribute("pageWidth");g.removeAttribute("pageHeight");e.appendChild(g);null!=b&&(b.eltCount+=e.getElementsByTagName("*").length,b.nodeCount+=e.getElementsByTagName("mxCell").length);c=(c<<5)-c+this.hashValue(e,function(a,b,c,d){return!d||"mxGeometry"!=a.nodeName&&"mxPoint"!=a.nodeName||"x"!=b&&"y"!=b&&"width"!=b&&"height"!=b?d&&"mxCell"==a.nodeName&&
|
|
|
|
|
"previous"==b?null:c:Math.round(c)},b)<<0}return c};EditorUi.prototype.hashValue=function(a,b,c){var d=0;if(null!=a&&"object"===typeof a&&"number"===typeof a.nodeType&&"string"===typeof a.nodeName&&"function"===typeof a.getAttribute){null!=a.nodeName&&(d^=this.hashValue(a.nodeName,b,c));if(null!=a.attributes){null!=c&&(c.attrCount+=a.attributes.length);for(var f=0;f<a.attributes.length;f++){var e=a.attributes[f].name,l=null!=b?b(a,e,a.attributes[f].value,!0):a.attributes[f].value;null!=l&&(d^=this.hashValue(e,
|
|
|
|
|
b,c)+this.hashValue(l,b,c))}}if(null!=a.childNodes)for(f=0;f<a.childNodes.length;f++)d=(d<<5)-d+this.hashValue(a.childNodes[f],b,c)<<0}else if(null!=a&&"function"!==typeof a){a=String(a);b=0;null!=c&&(c.byteCount+=a.length);for(f=0;f<a.length;f++)b=(b<<5)-b+a.charCodeAt(f)<<0;d^=b}return d};EditorUi.prototype.descriptorChanged=function(){};EditorUi.prototype.restoreLibraries=function(){};EditorUi.prototype.saveLibrary=function(a,b,c,d,e,g,k){};EditorUi.prototype.isScratchpadEnabled=function(){return isLocalStorage||
|
|
|
|
|
mxClient.IS_CHROMEAPP};EditorUi.prototype.toggleScratchpad=function(){this.isScratchpadEnabled()&&(null==this.scratchpad?this.getLocalData(".scratchpad",mxUtils.bind(this,function(a){null==a&&(a=this.emptyLibraryXml);this.loadLibrary(new StorageLibrary(this,a,".scratchpad"))})):this.closeLibrary(this.scratchpad))};EditorUi.prototype.createLibraryDataFromImages=function(a){var b=mxUtils.createXmlDocument(),c=b.createElement("mxlibrary");mxUtils.setTextContent(c,JSON.stringify(a));b.appendChild(c);
|
|
|
|
@ -8543,13 +8543,13 @@ p.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+c);var k=document.crea
|
|
|
|
|
"0 3px";var n=null;if(".scratchpad"!=a.title||this.closableScratchpad)k.appendChild(m),mxEvent.addListener(m,"click",mxUtils.bind(this,function(b){if(!mxEvent.isConsumed(b)){var c=mxUtils.bind(this,function(){this.closeLibrary(a)});null!=n?this.confirm(mxResources.get("allChangesLost"),null,c,mxResources.get("cancel"),mxResources.get("discardChanges")):c();mxEvent.consume(b)}}));if(a.isEditable()){var y=this.editor.graph,q=null,H=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),g,
|
|
|
|
|
b,a,a.getMode());mxEvent.consume(c)}),F=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=q&&null!=q.parentNode&&q.parentNode.removeChild(q),q=m.cloneNode(!1),q.setAttribute("src",Editor.spinImage),q.setAttribute("title",mxResources.get("saving")),q.style.cursor="default",q.style.marginRight="2px",q.style.marginTop="-2px",k.insertBefore(q,k.firstChild),p.style.paddingRight=18*k.childNodes.length+"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=q&&null!=
|
|
|
|
|
q.parentNode&&(q.parentNode.removeChild(q),p.style.paddingRight=18*k.childNodes.length+"px")})):null==n&&(n=m.cloneNode(!1),n.setAttribute("src",IMAGE_PATH+"/download.png"),n.setAttribute("title",mxResources.get("save")),k.insertBefore(n,k.firstChild),mxEvent.addListener(n,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==n||a.isModified()||(p.style.paddingRight=18*k.childNodes.length+"px",n.parentNode.removeChild(n),
|
|
|
|
|
n=null)});mxEvent.consume(c)})),p.style.paddingRight=18*k.childNodes.length+"px")}),G=mxUtils.bind(this,function(a,c,d,e){a=y.cloneCells(mxUtils.sortCells(y.model.getTopmostCells(a)));for(var l=0;l<a.length;l++){var k=y.getCellGeometry(a[l]);null!=k&&k.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);F(d);null!=
|
|
|
|
|
n=null)});mxEvent.consume(c)})),p.style.paddingRight=18*k.childNodes.length+"px")}),G=mxUtils.bind(this,function(a,c,d,e){a=y.cloneCells(mxUtils.sortCells(y.model.getTopmostCells(a)));for(var l=0;l<a.length;l++){var p=y.getCellGeometry(a[l]);null!=p&&p.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);F(d);null!=
|
|
|
|
|
f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)}),I=mxUtils.bind(this,function(a){if(y.isSelectionEmpty())y.getRubberband().isActive()?(y.getRubberband().execute(a),y.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var b=y.getSelectionCells(),c=y.view.getBounds(b),d=y.view.scale;c.x/=d;c.y/=d;c.width/=d;c.height/=d;c.x-=y.view.translate.x;c.y-=y.view.translate.y;G(b,c)}mxEvent.consume(a)});mxEvent.addGestureListeners(g,
|
|
|
|
|
function(){},mxUtils.bind(this,function(a){y.isMouseDown&&null!=y.panningManager&&null!=y.graphHandler.shape&&(y.graphHandler.shape.node.style.visibility="hidden",g.style.backgroundColor="#f1f3f4",g.style.cursor="copy",y.panningManager.stop(),y.autoScroll=!1,null!=y.graphHandler.guide&&y.graphHandler.guide.setVisible(!1),null!=y.graphHandler.hint&&(y.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,function(a){y.isMouseDown&&null!=y.panningManager&&null!=y.graphHandler&&
|
|
|
|
|
(g.style.backgroundColor="",g.style.cursor="default",this.sidebar.showTooltips=!0,y.panningManager.stop(),y.graphHandler.reset(),y.isMouseDown=!1,y.autoScroll=!0,I(a),mxEvent.consume(a))}));mxEvent.addListener(g,"mouseleave",mxUtils.bind(this,function(a){y.isMouseDown&&null!=y.graphHandler.shape&&(y.graphHandler.shape.node.style.visibility="visible",g.style.backgroundColor="",g.style.cursor="",y.autoScroll=!0,null!=y.graphHandler.guide&&y.graphHandler.guide.setVisible(!0),null!=y.graphHandler.hint&&
|
|
|
|
|
(y.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,k,p,t,v,m,n){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,p,t),c)],c[0].vertex=!0,G(c,new mxRectangle(0,0,p,t),a,mxEvent.isAltDown(a)?null:v.substring(0,v.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var B=!1,u=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var l=
|
|
|
|
|
mxUtils.parseXml(c);if("mxlibrary"==l.documentElement.nodeName)try{var k=JSON.parse(mxUtils.getTextContent(l.documentElement));e(k,g);b=b.concat(k);F(a);this.spinner.stop();B=!0}catch(N){}else if("mxfile"==l.documentElement.nodeName)try{for(var p=l.documentElement.getElementsByTagName("diagram"),l=0;l<p.length;l++){var t=this.stringToCells(Editor.getDiagramNodeXml(p[l])),v=this.editor.graph.getBoundingBoxFromGeometry(t);G(t,new mxRectangle(0,0,v.width,v.height),a)}B=!0}catch(N){null!=window.console&&
|
|
|
|
|
function(c,d,l,p,k,t,v,m,n){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,k,t),c)],c[0].vertex=!0,G(c,new mxRectangle(0,0,k,t),a,mxEvent.isAltDown(a)?null:v.substring(0,v.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var B=!1,u=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var l=
|
|
|
|
|
mxUtils.parseXml(c);if("mxlibrary"==l.documentElement.nodeName)try{var p=JSON.parse(mxUtils.getTextContent(l.documentElement));e(p,g);b=b.concat(p);F(a);this.spinner.stop();B=!0}catch(N){}else if("mxfile"==l.documentElement.nodeName)try{for(var k=l.documentElement.getElementsByTagName("diagram"),l=0;l<k.length;l++){var t=this.stringToCells(Editor.getDiagramNodeXml(k[l])),v=this.editor.graph.getBoundingBoxFromGeometry(t);G(t,new mxRectangle(0,0,v.width,v.height),a)}B=!0}catch(N){null!=window.console&&
|
|
|
|
|
console.log("error in drop handler:",N)}}B||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)});null!=n&&null!=v&&(/(\.v(dx|sdx?))($|\?)/i.test(v)||/(\.vs(x|sx?))($|\?)/i.test(v))?this.importVisio(n,function(a){u(a,"text/xml")},null,v):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,v)&&null!=n?this.parseFile(n,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),
|
|
|
|
|
200<=a.status&&299>=a.status?u(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):u(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"));k.insertBefore(m,
|
|
|
|
|
k.firstChild);mxEvent.addListener(m,"click",H);mxEvent.addListener(g,"dblclick",function(a){mxEvent.getSource(a)==g&&H(a)});c=m.cloneNode(!1);c.setAttribute("src",Editor.plusImage);c.setAttribute("title",mxResources.get("add"));k.insertBefore(c,k.firstChild);mxEvent.addListener(c,"click",I);this.isOffline()||".scratchpad"!=a.title||null==EditorUi.scratchpadHelpLink||(c=document.createElement("span"),c.setAttribute("title",mxResources.get("help")),c.style.cssText="color:#a3a3a3;text-decoration:none;margin-right:2px;",
|
|
|
|
@ -8562,11 +8562,11 @@ EditorUi.initTheme();EditorUi.prototype.hideFooter=function(){var a=document.get
|
|
|
|
|
!0);a.init()};EditorUi.prototype.showBackgroundImageDialog=function(a){a=null!=a?a:mxUtils.bind(this,function(a){a=new ChangePageSetup(this,null,a);a.ignoreColor=!0;this.editor.graph.model.execute(a)});var b=new BackgroundImageDialog(this,mxUtils.bind(this,function(b){a(b)}));this.showDialog(b.container,360,200,!0,!0);b.init()};EditorUi.prototype.showLibraryDialog=function(a,b,c,d,e){a=new LibraryDialog(this,a,b,c,d,e);this.showDialog(a.container,640,440,!0,!1,mxUtils.bind(this,function(a){a&&null==
|
|
|
|
|
this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()}));a.init()};var c=EditorUi.prototype.createFormat;EditorUi.prototype.createFormat=function(a){var b=c.apply(this,arguments);this.editor.graph.addListener("viewStateChanged",mxUtils.bind(this,function(a){this.editor.graph.isSelectionEmpty()&&b.refresh()}));return b};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="#188038";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,c,d,e){var f=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},l=null!=a&&null!=a.error?a.error:a;if(null!=l||null!=b){var g=mxUtils.htmlEntities(mxResources.get("unknownError")),k=mxResources.get("ok"),p=null;b=null!=b?b:mxResources.get("error");if(null!=l)if(null!=l.retry&&(k=mxResources.get("cancel"),p=function(){f();l.retry()}),404==l.code||404==l.status||403==l.code){var g=403==l.code?null!=l.message?mxUtils.htmlEntities(l.message):
|
|
|
|
|
return a};EditorUi.prototype.handleError=function(a,b,c,d,e){var f=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},l=null!=a&&null!=a.error?a.error:a;if(null!=l||null!=b){var g=mxUtils.htmlEntities(mxResources.get("unknownError")),p=mxResources.get("ok"),k=null;b=null!=b?b:mxResources.get("error");if(null!=l)if(null!=l.retry&&(p=mxResources.get("cancel"),k=function(){f();l.retry()}),404==l.code||404==l.status||403==l.code){var g=403==l.code?null!=l.message?mxUtils.htmlEntities(l.message):
|
|
|
|
|
mxUtils.htmlEntities(mxResources.get("accessDenied")):null!=e?e:mxUtils.htmlEntities(mxResources.get("fileNotFoundOrDenied")+(null!=this.drive&&null!=this.drive.user?" ("+this.drive.user.displayName+", "+this.drive.user.email+")":"")),m=window.location.hash;if(null!=m&&("#G"==m.substring(0,2)||"#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D"==m.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==l.code||404==l.status)){m="#U"==m.substring(0,2)?m.substring(45,m.lastIndexOf("%26ex")):m.substring(2);this.showError(b,g,mxResources.get("openInNewWindow"),mxUtils.bind(this,function(){this.editor.graph.openLink("https://drive.google.com/open?id="+m);this.handleError(a,b,c,d,e)}),p,mxResources.get("changeUser"),mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&(this.drive.clearUserId(),gapi.auth.signOut(),window.location.reload())}),
|
|
|
|
|
"fileAccess"==a.error.data[0].reason)||404==l.code||404==l.status)){m="#U"==m.substring(0,2)?m.substring(45,m.lastIndexOf("%26ex")):m.substring(2);this.showError(b,g,mxResources.get("openInNewWindow"),mxUtils.bind(this,function(){this.editor.graph.openLink("https://drive.google.com/open?id="+m);this.handleError(a,b,c,d,e)}),k,mxResources.get("changeUser"),mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&(this.drive.clearUserId(),gapi.auth.signOut(),window.location.reload())}),
|
|
|
|
|
mxResources.get("cancel"),mxUtils.bind(this,function(){window.location.hash=""}),480,150);return}}else null!=l.message?g=mxUtils.htmlEntities(l.message):null!=l.response&&null!=l.response.error?g=mxUtils.htmlEntities(l.response.error):"undefined"!==window.App&&(l.code==App.ERROR_TIMEOUT?g=mxUtils.htmlEntities(mxResources.get("timeout")):l.code==App.ERROR_BUSY&&(g=mxUtils.htmlEntities(mxResources.get("busy"))));var n=null,u=null;null!=l&&null!=l.helpLink&&(n=mxResources.get("help"),u=mxUtils.bind(this,
|
|
|
|
|
function(){return this.editor.graph.openLink(l.helpLink)}));this.showError(b,g,k,c,p,null,null,n,u,null,null,null,d?c:null)}else null!=c&&c()};EditorUi.prototype.alert=function(a,b){var c=new ErrorDialog(this,null,a,mxResources.get("ok"),b);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(a,b,c,d,e,g){var f=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){};a=new ConfirmDialog(this,a,function(){f();null!=b&&b()},function(){f();null!=
|
|
|
|
|
function(){return this.editor.graph.openLink(l.helpLink)}));this.showError(b,g,p,c,k,null,null,n,u,null,null,null,d?c:null)}else null!=c&&c()};EditorUi.prototype.alert=function(a,b){var c=new ErrorDialog(this,null,a,mxResources.get("ok"),b);this.showDialog(c.container,340,100,!0,!1);c.init()};EditorUi.prototype.confirm=function(a,b,c,d,e,g){var f=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){};a=new ConfirmDialog(this,a,function(){f();null!=b&&b()},function(){f();null!=
|
|
|
|
|
c&&c()},d,e);this.showDialog(a.container,340,90,!0,g);a.init()};EditorUi.prototype.setCurrentFile=function(a){null!=a&&(a.opened=new Date);this.currentFile=a};EditorUi.prototype.getCurrentFile=function(){return this.currentFile};EditorUi.prototype.isExportToCanvas=function(){return mxClient.IS_CHROMEAPP||!this.editor.graph.mathEnabled&&this.useCanvasForExport};EditorUi.prototype.createSvgDataUri=function(a){return"data:image/svg+xml;base64,"+btoa(unescape(encodeURIComponent(a)))};EditorUi.prototype.createImageDataUri=
|
|
|
|
|
function(a,b,c){var d=a.toDataURL("image/"+c);if(6>=d.length||d==a.cloneNode(!1).toDataURL("image/"+c))throw{message:"Invalid image"};null!=b&&(d=this.writeGraphModelToPng(d,"tEXt","mxfile",b));return d};EditorUi.prototype.saveCanvas=function(a,b,c,d){var f="jpeg"==c?"jpg":c;d=this.getBaseFilename(d)+"."+f;a=this.createImageDataUri(a,b,c);this.saveData(d,f,a.substring(a.lastIndexOf(",")+1),"image/"+c,!0)};EditorUi.prototype.isLocalFileSave=function(){return"remote"!=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)};
|
|
|
|
@ -8574,57 +8574,57 @@ EditorUi.prototype.doSaveLocalFile=function(a,b,c,d,e){if(window.Blob&&navigator
|
|
|
|
|
navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./),l=65==(g?parseInt(g[2],10):!1)?!1:l;if(l||this.isOffline()){f.href=URL.createObjectURL(d?this.base64ToBlob(a,c):new Blob([a],{type:c}));l?f.download=b:f.setAttribute("target","_blank");document.body.appendChild(f);try{window.setTimeout(function(){URL.revokeObjectURL(f.href)},0),f.click(),f.parentNode.removeChild(f)}catch(C){}}else this.createEchoRequest(a,b,c,d,e).simulate(document,"_blank")}};EditorUi.prototype.createEchoRequest=function(a,b,
|
|
|
|
|
c,d,e,g){a="xml="+encodeURIComponent(a);return new mxXmlRequest(SAVE_URL,a+(null!=c?"&mime="+c:"")+(null!=e?"&format="+e:"")+(null!=g?"&base64="+g:"")+(null!=b?"&filename="+encodeURIComponent(b):"")+(d?"&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),l=0;l<f;++l){for(var g=1024*l,k=Math.min(g+1024,d),v=Array(k-g),m=0;g<k;++m,++g)v[m]=c[g].charCodeAt(0);e[l]=new Uint8Array(v)}return new Blob(e,{type:b})};EditorUi.prototype.saveLocalFile=
|
|
|
|
|
function(a,b,c,d,e,g,k){g=null!=g?g:!1;k=null!=k?k:"vsdx"!=e&&(!mxClient.IS_IOS||!navigator.standalone);e=this.getServiceCount(g);isLocalStorage&&e++;var f=4>=e?2:6<e?4:3;b=new CreateDialog(this,b,mxUtils.bind(this,function(b,f){try{if("_blank"==f)if(null==c||"image/"!=c.substring(0,6)||"image/svg"==c.substring(0,9)&&!mxClient.IS_SVG){var e=window.open("about:blank");null==e?mxUtils.popup(a,!0):(e.document.write("<pre>"+mxUtils.htmlEntities(a,!1)+"<pre>"),e.document.close())}else this.openInNewWindow(a,
|
|
|
|
|
c,d);else f==App.MODE_DEVICE||"download"==f?this.doSaveLocalFile(a,b,c,d):null!=b&&0<b.length&&this.pickFolder(f,mxUtils.bind(this,function(e){try{this.exportFile(a,b,c,d,f,e)}catch(y){this.handleError(y)}}))}catch(D){this.handleError(D)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,g,k,null,1<e,f,a,c,d);this.showDialog(b.container,400,e>f?390:270,!0,!0);b.init()};EditorUi.prototype.openInNewWindow=function(a,b,c){if(mxClient.IS_GC||mxClient.IS_EDGE||
|
|
|
|
|
11==document.documentMode||10==document.documentMode){var d=window.open("about:blank");null==d||null==d.document?mxUtils.popup(a,!0):("image/svg+xml"==b?d.document.write("<html>"+a+"</html>"):d.document.write('<html><img src="data:'+b+(c?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))+'"/></html>'),d.document.close())}else d=window.open("data:"+b+(c?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null!=d&&null!=d.document||mxUtils.popup(a,!0)};var b=EditorUi.prototype.addChromelessToolbarItems;
|
|
|
|
|
EditorUi.prototype.addChromelessToolbarItems=function(a){if(this.isExportToCanvas()){this.exportDialog=null;var c=a(mxUtils.bind(this,function(a){var b=mxUtils.bind(this,function(){mxEvent.removeListener(this.editor.graph.container,"click",b);null!=this.exportDialog&&(this.exportDialog.parentNode.removeChild(this.exportDialog),this.exportDialog=null)});if(null!=this.exportDialog)b.apply(this);else{this.exportDialog=document.createElement("div");var d=c.getBoundingClientRect();mxUtils.setPrefixedStyle(this.exportDialog.style,
|
|
|
|
|
"borderRadius","5px");this.exportDialog.style.position="fixed";this.exportDialog.style.textAlign="center";this.exportDialog.style.fontFamily="Helvetica,Arial";this.exportDialog.style.backgroundColor="#000000";this.exportDialog.style.width="50px";this.exportDialog.style.height="50px";this.exportDialog.style.padding="4px 2px 4px 2px";this.exportDialog.style.color="#ffffff";mxUtils.setOpacity(this.exportDialog,70);this.exportDialog.style.left=d.left+"px";this.exportDialog.style.bottom=parseInt(this.chromelessToolbar.style.bottom)+
|
|
|
|
|
this.chromelessToolbar.offsetHeight+4+"px";d=mxUtils.getCurrentStyle(this.editor.graph.container);this.exportDialog.style.zIndex=d.zIndex;var f=new Spinner({lines:8,length:6,width:5,radius:6,rotate:0,color:"#fff",speed:1.5,trail:60,shadow:!1,hwaccel:!1,top:"28px",zIndex:2E9});f.spin(this.exportDialog);this.exportToCanvas(mxUtils.bind(this,function(a){f.stop();this.exportDialog.style.width="auto";this.exportDialog.style.height="auto";this.exportDialog.style.padding="10px";var c=this.createImageDataUri(a,
|
|
|
|
|
null,"png");a=document.createElement("img");a.style.maxWidth="140px";a.style.maxHeight="140px";a.style.cursor="pointer";a.style.backgroundColor="white";a.setAttribute("title",mxResources.get("openInNewWindow"));a.setAttribute("border","0");a.setAttribute("src",c);this.exportDialog.appendChild(a);mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.openInNewWindow(c.substring(c.indexOf(",")+1),"image/png",!0);b.apply(this,arguments)}))}),null,this.thumbImageCache,null,mxUtils.bind(this,
|
|
|
|
|
function(a){this.spinner.stop();this.handleError(a)}));mxEvent.addListener(this.editor.graph.container,"click",b);document.body.appendChild(this.exportDialog)}mxEvent.consume(a)}),Editor.cameraLargeImage,mxResources.get("export"))}b.apply(this,arguments)};EditorUi.prototype.saveData=function(a,b,c,d,e){this.isLocalFileSave()?this.saveLocalFile(c,a,d,e,b):this.saveRequest(a,b,mxUtils.bind(this,function(a,f){return this.createEchoRequest(c,a,d,e,b,f)}),c,e,d)};EditorUi.prototype.saveRequest=function(a,
|
|
|
|
|
b,c,d,e,g,k){k=null!=k?k:!mxClient.IS_IOS||!navigator.standalone;var f=this.getServiceCount(!1);isLocalStorage&&f++;var l=4>=f?2:6<f?4:3;a=new CreateDialog(this,a,mxUtils.bind(this,function(a,f){if("_blank"==f||null!=a&&0<a.length){var e=c("_blank"==f?null:a,f==App.MODE_DEVICE||"download"==f||null==f||"_blank"==f?"0":"1");null!=e&&(f==App.MODE_DEVICE||"download"==f||"_blank"==f?e.simulate(document,"_blank"):this.pickFolder(f,mxUtils.bind(this,function(c){g=null!=g?g:"pdf"==b?"application/pdf":"image/"+
|
|
|
|
|
b;if(null!=d)try{this.exportFile(d,a,g,!0,f,c)}catch(J){this.handleError(J)}else this.spinner.spin(document.body,mxResources.get("saving"))&&e.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=e.getStatus()&&299>=e.getStatus())try{this.exportFile(e.getText(),a,g,!0,f,c)}catch(J){this.handleError(J)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(a){this.spinner.stop();this.handleError(a)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),
|
|
|
|
|
mxResources.get("download"),!1,!1,k,null,1<f,l,d,g,e);this.showDialog(a.container,380,1==f?160:4<f?390:270,!0,!0);a.init()};EditorUi.prototype.getEditBlankXml=function(){return this.getFileData(!0)};EditorUi.prototype.exportFile=function(a,b,c,d,e,g){};EditorUi.prototype.pickFolder=function(a,b,c){b(null)};EditorUi.prototype.exportSvg=function(a,b,c,d,e,g,k,m,n,v){if(this.spinner.spin(document.body,mxResources.get("export"))){var f=this.editor.graph.isSelectionEmpty();c=null!=c?c:f;f=b?null:this.editor.graph.background;
|
|
|
|
|
f==mxConstants.NONE&&(f=null);null==f&&0==b&&(f="#ffffff");var l=this.editor.graph.getSvg(f,a,k,m,null,c,null,null,"blank"==v?"_blank":"self"==v?"_top":null);d&&this.editor.graph.addSvgShadow(l);var p=this.getBaseFilename()+".svg",t=mxUtils.bind(this,function(a){this.spinner.stop();e&&a.setAttribute("content",this.getFileData(!0,null,null,null,c,n));if(null!=this.editor.fontCss){var b=a.ownerDocument,b=null!=b.createElementNS?b.createElementNS(mxConstants.NS_SVG,"style"):b.createElement("style");
|
|
|
|
|
b.setAttribute("type","text/css");mxUtils.setTextContent(b,this.editor.fontCss);a.getElementsByTagName("defs")[0].appendChild(b)}var d='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(a);this.isLocalFileSave()||d.length<=MAX_REQUEST_SIZE?this.saveData(p,"svg",d,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(d)}))});this.convertMath(this.editor.graph,
|
|
|
|
|
l,!1,mxUtils.bind(this,function(){g?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(l,t,this.thumbImageCache)):t(l)}))}};EditorUi.prototype.addRadiobox=function(a,b,c,d,e,g,k){return this.addCheckbox(a,c,d,e,g,k,!0,b)};EditorUi.prototype.addCheckbox=function(a,b,c,d,e,g,k,m){g=null!=g?g:!0;var f=document.createElement("input");f.style.marginRight="8px";f.style.marginTop="16px";f.setAttribute("type",k?"radio":"checkbox");k="geCheckbox-"+Editor.guid();f.id=k;null!=m&&f.setAttribute("name",
|
|
|
|
|
m);c&&(f.setAttribute("checked","checked"),f.defaultChecked=!0);d&&f.setAttribute("disabled","disabled");g&&(a.appendChild(f),c=document.createElement("label"),mxUtils.write(c,b),c.setAttribute("for",k),a.appendChild(c),e||mxUtils.br(a));return f};EditorUi.prototype.addEditButton=function(a,b){var c=this.addCheckbox(a,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var d=this.getCurrentFile(),f="";null!=d&&d.getMode()!=App.MODE_DEVICE&&d.getMode()!=App.MODE_BROWSER&&(f=window.location.href);
|
|
|
|
|
var e=document.createElement("select");e.style.width="120px";e.style.marginLeft="8px";e.style.marginRight="10px";e.className="geBtn";d=document.createElement("option");d.setAttribute("value","blank");mxUtils.write(d,mxResources.get("makeCopy"));e.appendChild(d);d=document.createElement("option");d.setAttribute("value","custom");mxUtils.write(d,mxResources.get("custom")+"...");e.appendChild(d);a.appendChild(e);mxEvent.addListener(e,"change",mxUtils.bind(this,function(){if("custom"==e.value){var a=
|
|
|
|
|
new FilenameDialog(this,f,mxResources.get("ok"),function(a){null!=a?f=a:e.value="blank"},mxResources.get("url"),null,null,null,null,function(){e.value="blank"});this.showDialog(a.container,300,80,!0,!1);a.init()}}));mxEvent.addListener(c,"change",mxUtils.bind(this,function(){c.checked&&(null==b||b.checked)?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled")}));mxUtils.br(a);return{getLink:function(){return c.checked?"blank"===e.value?"_blank":f:null},getEditInput:function(){return c},
|
|
|
|
|
getEditSelect:function(){return e}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){g.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=e&&e!=mxConstants.NONE?"border:1px solid black;background-color:"+e:"background-position:center center;background-repeat:no-repeat;background-image:url('"+Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("links")+":");var d=document.createElement("select");d.style.width="100px";d.style.marginLeft=
|
|
|
|
|
"8px";d.style.marginRight="10px";d.className="geBtn";var f=document.createElement("option");f.setAttribute("value","auto");mxUtils.write(f,mxResources.get("automatic"));d.appendChild(f);f=document.createElement("option");f.setAttribute("value","blank");mxUtils.write(f,mxResources.get("openInNewWindow"));d.appendChild(f);f=document.createElement("option");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",g=null,g=mxUtils.button("",mxUtils.bind(this,function(a){this.pickColor(e||"none",function(a){e=a;c()});mxEvent.consume(a)}));c();g.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";g.style.marginLeft="4px";g.style.height="22px";g.style.width="22px";g.style.position="relative";g.style.top=mxClient.IS_IE||
|
|
|
|
|
mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";g.className="geColorBtn";a.appendChild(g);mxUtils.br(a);return{getColor:function(){return e},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=function(a,b,c,d,e,g,k,m){var f=this.getCurrentFile(),l=[];d&&(l.push("lightbox=1"),"auto"!=a&&l.push("target="+a),null!=b&&b!=mxConstants.NONE&&l.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),null!=e&&0<e.length&&l.push("edit="+encodeURIComponent(e)),g&&
|
|
|
|
|
l.push("layers=1"),this.editor.graph.foldingEnabled&&l.push("nav=1"));c&&null!=this.currentPage&&null!=this.pages&&this.currentPage!=this.pages[0]&&l.push("page-id="+this.currentPage.getId());a=!0;null!=k?c="#U"+encodeURIComponent(k):(f=this.getCurrentFile(),m||null==f||f.constructor!=window.DriveFile?c="#R"+encodeURIComponent(c?this.getFileData(!0,null,null,null,null,null,null,!0):Graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(c="#"+f.getHash(),a=!1));a&&null!=f&&null!=f.getTitle()&&
|
|
|
|
|
f.getTitle()!=this.defaultFilename&&l.push("title="+encodeURIComponent(f.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||!/.*\.draw\.io$/.test(window.location.hostname)?EditorUi.drawHost:"https://"+window.location.host+"/")+(0<l.length?"?"+l.join("&"):"")+c};EditorUi.prototype.createHtml=function(a,b,c,d,e,g,k,m,n,v,B){this.getBasenames();var f={};""!=e&&e!=mxConstants.NONE&&(f.highlight=e);"auto"!==d&&(f.target=d);n||(f.lightbox=!1);f.nav=this.editor.graph.foldingEnabled;c=parseInt(c);
|
|
|
|
|
isNaN(c)||100==c||(f.zoom=c/100);c=[];k&&(c.push("pages"),f.resize=!0,null!=this.pages&&null!=this.currentPage&&(f.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(c.push("zoom"),f.resize=!0);m&&c.push("layers");0<c.length&&(n&&c.push("lightbox"),f.toolbar=c.join(" "));null!=v&&0<v.length&&(f.edit=v);null!=a?f.url=a:f.xml=this.getFileData(!0,null,null,null,null,!k);b='<div class="mxgraph" style="'+(g?"max-width:100%;":"")+(""!=c?"border:1px solid transparent;":"")+'" data-mxgraph="'+mxUtils.htmlEntities(JSON.stringify(f))+
|
|
|
|
|
'"></div>';a=null!=a?"&fetch="+encodeURIComponent(a):"";B(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,c,d){var f=document.createElement("div");f.style.whiteSpace="nowrap";var e=document.createElement("h3");
|
|
|
|
|
mxUtils.write(e,mxResources.get("html"));e.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";f.appendChild(e);var g=document.createElement("div");g.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var l=document.createElement("input");l.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";l.setAttribute("value","url");l.setAttribute("type","radio");l.setAttribute("name","type-embedhtmldialog");e=l.cloneNode(!0);e.setAttribute("value",
|
|
|
|
|
"copy");g.appendChild(e);var k=document.createElement("span");mxUtils.write(k,mxResources.get("includeCopyOfMyDiagram"));g.appendChild(k);mxUtils.br(g);g.appendChild(l);k=document.createElement("span");mxUtils.write(k,mxResources.get("publicDiagramUrl"));g.appendChild(k);var p=this.getCurrentFile();null==c&&null!=p&&p.constructor==window.DriveFile&&(k=document.createElement("a"),k.style.paddingLeft="12px",k.style.color="gray",k.setAttribute("href","javascript:void(0);"),mxUtils.write(k,mxResources.get("share")),
|
|
|
|
|
g.appendChild(k),mxEvent.addListener(k,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(p.getId())})));e.setAttribute("checked","checked");null==c&&l.setAttribute("disabled","disabled");f.appendChild(g);var m=this.addLinkSection(f),n=this.addCheckbox(f,mxResources.get("zoom"),!0,null,!0);mxUtils.write(f,":");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%";f.appendChild(u);var q=this.addCheckbox(f,mxResources.get("fit"),!0),g=null!=this.pages&&1<this.pages.length,H=H=this.addCheckbox(f,mxResources.get("allPages"),g,!g),F=this.addCheckbox(f,mxResources.get("layers"),!0),G=this.addCheckbox(f,mxResources.get("lightbox"),!0),I=this.addEditButton(f,G),E=I.getEditInput();E.style.marginBottom="16px";mxEvent.addListener(G,"change",function(){G.checked?E.removeAttribute("disabled"):E.setAttribute("disabled","disabled");E.checked&&G.checked?
|
|
|
|
|
I.getEditSelect().removeAttribute("disabled"):I.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,f,mxUtils.bind(this,function(){d(l.checked?c:null,n.checked,u.value,m.getTarget(),m.getColor(),q.checked,H.checked,F.checked,G.checked,I.getLink())}),null,a,b);this.showDialog(a.container,340,384,!0,!0);e.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,c,d,e,g){var f=document.createElement("div");f.style.whiteSpace="nowrap";var l=document.createElement("h3");
|
|
|
|
|
mxUtils.write(l,a||mxResources.get("link"));l.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";f.appendChild(l);var k=this.getCurrentFile(),l="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=k&&k.constructor==window.DriveFile&&!b){a=80;var l="https://desk.draw.io/support/solutions/articles/16000039384",p=document.createElement("div");p.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";
|
|
|
|
|
var m=document.createElement("div");m.style.whiteSpace="normal";mxUtils.write(m,mxResources.get("linkAccountRequired"));p.appendChild(m);m=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(k.getId())}));m.style.marginTop="12px";m.className="geBtn";p.appendChild(m);f.appendChild(p);m=document.createElement("a");m.style.paddingLeft="12px";m.style.color="gray";m.style.fontSize="11px";m.setAttribute("href","javascript:void(0);");mxUtils.write(m,mxResources.get("check"));
|
|
|
|
|
p.appendChild(m);mxEvent.addListener(m,"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,mxResources.get(null!=a?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(a.container,300,80,!0,!1);a.init()}))}))}var n=null,t=null;if(null!=c||null!=d)a+=30,mxUtils.write(f,mxResources.get("width")+":"),n=document.createElement("input"),
|
|
|
|
|
n.setAttribute("type","text"),n.style.marginRight="16px",n.style.width="50px",n.style.marginLeft="6px",n.style.marginRight="16px",n.style.marginBottom="10px",n.value="100%",f.appendChild(n),mxUtils.write(f,mxResources.get("height")+":"),t=document.createElement("input"),t.setAttribute("type","text"),t.style.width="50px",t.style.marginLeft="6px",t.style.marginBottom="10px",t.value=d+"px",f.appendChild(t),mxUtils.br(f);var u=this.addLinkSection(f,g);c=null!=this.pages&&1<this.pages.length;var q=null;
|
|
|
|
|
if(null==k||k.constructor!=window.DriveFile||b)q=this.addCheckbox(f,mxResources.get("allPages"),c,!c);var z=this.addCheckbox(f,mxResources.get("lightbox"),!0),G=this.addEditButton(f,z),I=G.getEditInput(),E=this.addCheckbox(f,mxResources.get("layers"),!0);E.style.marginLeft=I.style.marginLeft;E.style.marginBottom="16px";E.style.marginTop="8px";mxEvent.addListener(z,"change",function(){z.checked?(E.removeAttribute("disabled"),I.removeAttribute("disabled")):(E.setAttribute("disabled","disabled"),I.setAttribute("disabled",
|
|
|
|
|
"disabled"));I.checked&&z.checked?G.getEditSelect().removeAttribute("disabled"):G.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,f,mxUtils.bind(this,function(){e(u.getTarget(),u.getColor(),null==q?!0:q.checked,z.checked,G.getLink(),E.checked,null!=n?n.value:null,null!=t?t.value:null)}),null,mxResources.get("create"),l);this.showDialog(b.container,340,254+a,!0,!0);null!=n?(n.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():
|
|
|
|
|
document.execCommand("selectAll",!1,null)):u.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,c,d,e){var f=document.createElement("div");f.style.whiteSpace="nowrap";var g=document.createElement("h3");mxUtils.write(g,mxResources.get("image"));g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:"+(e?"10":"4")+"px";f.appendChild(g);if(e){mxUtils.write(f,mxResources.get("zoom")+":");var l=document.createElement("input");l.setAttribute("type","text");l.style.marginRight=
|
|
|
|
|
"16px";l.style.width="60px";l.style.marginLeft="4px";l.style.marginRight="12px";l.value=this.lastExportZoom||"100%";f.appendChild(l);mxUtils.write(f,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";f.appendChild(k);mxUtils.br(f)}var p=this.addCheckbox(f,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),m=d?null:this.addCheckbox(f,
|
|
|
|
|
mxResources.get("includeCopyOfMyDiagram"),!0),g=this.editor.graph,n=d?null:this.addCheckbox(f,mxResources.get("transparentBackground"),g.background==mxConstants.NONE||null==g.background);null!=n&&(n.style.marginBottom="16px");a=new CustomDialog(this,f,mxUtils.bind(this,function(){var a=parseInt(l.value)/100||1,b=parseInt(k.value)||0;c(!p.checked,null!=m?m.checked:!1,null!=n?n.checked:!1,a,b)}),null,a,b);this.showDialog(a.container,300,(e?25:0)+(d?125:210),!0,!0)};EditorUi.prototype.showExportDialog=
|
|
|
|
|
function(a,b,c,d,e,g,k,m){k=null!=k?k:!0;var f=document.createElement("div");f.style.whiteSpace="nowrap";var l=this.editor.graph,p="jpeg"==m?196:300,n=document.createElement("h3");mxUtils.write(n,a);n.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";f.appendChild(n);mxUtils.write(f,mxResources.get("zoom")+":");var t=document.createElement("input");t.setAttribute("type","text");t.style.marginRight="16px";t.style.width="60px";t.style.marginLeft="4px";t.style.marginRight=
|
|
|
|
|
"12px";t.value=this.lastExportZoom||"100%";f.appendChild(t);mxUtils.write(f,mxResources.get("borderWidth")+":");var u=document.createElement("input");u.setAttribute("type","text");u.style.marginRight="16px";u.style.width="60px";u.style.marginLeft="4px";u.value=this.lastExportBorder||"0";f.appendChild(u);mxUtils.br(f);var q=this.addCheckbox(f,mxResources.get("transparentBackground"),!1,null,null,"jpeg"!=m),z=this.addCheckbox(f,mxResources.get("selectionOnly"),!1,l.isSelectionEmpty()),x=document.createElement("input");
|
|
|
|
|
x.style.marginTop="16px";x.style.marginRight="8px";x.style.marginLeft="24px";x.setAttribute("disabled","disabled");x.setAttribute("type","checkbox");g&&(f.appendChild(x),mxUtils.write(f,mxResources.get("crop")),mxUtils.br(f),p+=26,mxEvent.addListener(z,"change",function(){z.checked?x.removeAttribute("disabled"):x.setAttribute("disabled","disabled")}));l.isSelectionEmpty()||(x.setAttribute("checked","checked"),x.defaultChecked=!0);var A=this.addCheckbox(f,mxResources.get("shadow"),l.shadowVisible),
|
|
|
|
|
E=document.createElement("input");E.style.marginTop="16px";E.style.marginRight="8px";E.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||E.setAttribute("disabled","disabled");b&&(f.appendChild(E),mxUtils.write(f,mxResources.get("embedImages")),mxUtils.br(f),p+=26);var L=this.addCheckbox(f,mxResources.get("includeCopyOfMyDiagram"),k,null,null,"jpeg"!=m),K=null!=this.pages&&1<this.pages.length,R=this.addCheckbox(f,K?mxResources.get("allPages"):"",K,!K,null,"jpeg"!=m);R.style.marginLeft=
|
|
|
|
|
"24px";R.style.marginBottom="16px";K||(R.style.display="none");mxEvent.addListener(L,"change",function(){L.checked&&K?R.removeAttribute("disabled"):R.setAttribute("disabled","disabled")});k&&K||R.setAttribute("disabled","disabled");var V=document.createElement("select");V.style.maxWidth="260px";V.style.marginLeft="8px";V.style.marginRight="10px";V.className="geBtn";a=document.createElement("option");a.setAttribute("value","auto");mxUtils.write(a,mxResources.get("automatic"));V.appendChild(a);a=document.createElement("option");
|
|
|
|
|
a.setAttribute("value","blank");mxUtils.write(a,mxResources.get("openInNewWindow"));V.appendChild(a);a=document.createElement("option");a.setAttribute("value","self");mxUtils.write(a,mxResources.get("openInThisWindow"));V.appendChild(a);"svg"==m&&(mxUtils.write(f,mxResources.get("links")+":"),f.appendChild(V),mxUtils.br(f),mxUtils.br(f),p+=26);c=new CustomDialog(this,f,mxUtils.bind(this,function(){this.lastExportBorder=u.value;this.lastExportZoom=t.value;e(t.value,q.checked,!z.checked,A.checked,L.checked,
|
|
|
|
|
E.checked,u.value,x.checked,!R.checked,V.value)}),null,c,d);this.showDialog(c.container,340,p,!0,!0,null,null,null,null,!0);t.focus();mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?t.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,c,d,e){var f=document.createElement("div");f.style.whiteSpace="nowrap";var g=this.editor.graph;if(null!=b){var l=document.createElement("h3");mxUtils.write(l,b);l.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";
|
|
|
|
|
f.appendChild(l)}var k=this.addCheckbox(f,mxResources.get("fit"),!0),p=this.addCheckbox(f,mxResources.get("shadow"),g.shadowVisible&&d,!d),m=this.addCheckbox(f,c),n=this.addCheckbox(f,mxResources.get("lightbox"),!0),u=this.addEditButton(f,n),q=u.getEditInput(),z=1<g.model.getChildCount(g.model.getRoot()),F=this.addCheckbox(f,mxResources.get("layers"),z,!z);F.style.marginLeft=q.style.marginLeft;F.style.marginBottom="12px";F.style.marginTop="8px";mxEvent.addListener(n,"change",function(){n.checked?
|
|
|
|
|
(z&&F.removeAttribute("disabled"),q.removeAttribute("disabled")):(F.setAttribute("disabled","disabled"),q.setAttribute("disabled","disabled"));q.checked&&n.checked?u.getEditSelect().removeAttribute("disabled"):u.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,f,mxUtils.bind(this,function(){a(k.checked,p.checked,m.checked,n.checked,u.getLink(),F.checked)}),null,mxResources.get("embed"),e);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=
|
|
|
|
|
function(a,b,c,d,e,g,k,m){function f(b){var f=" ",p="";d&&(f=" 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('"+EditorUi.drawHost+"/?client=1&lightbox=1"+(e?"&edit=_blank":"")+(g?"&layers=1":"")+"');}})(this);\"",p+="cursor:pointer;");
|
|
|
|
|
a&&(p+="max-width:100%;");var m="";c&&(m=' width="'+Math.round(l.width)+'" height="'+Math.round(l.height)+'"');k('<img src="'+b+'"'+m+(""!=p?' style="'+p+'"':"")+f+"/>")}var l=this.editor.graph.getGraphBounds();if(this.isExportToCanvas())this.exportToCanvas(mxUtils.bind(this,function(a){var b=d?this.getFileData(!0):null;a=this.createImageDataUri(a,b,"png");f(a)}),null,null,null,mxUtils.bind(this,function(a){m({message:mxResources.get("unknownError")})}),null,!0,c?2:1,null,b);else if(b=this.getFileData(!0),
|
|
|
|
|
l.width*l.height<=MAX_AREA&&b.length<=MAX_REQUEST_SIZE){var p="";c&&(p="&w="+Math.round(2*l.width)+"&h="+Math.round(2*l.height));var n=new mxXmlRequest(EXPORT_URL,"format=png&base64=1&embedXml="+(d?"1":"0")+p+"&xml="+encodeURIComponent(b));n.send(mxUtils.bind(this,function(){200<=n.getStatus()&&299>=n.getStatus()?f("data:image/png;base64,"+n.getText()):m({message:mxResources.get("unknownError")})}))}else m({message:mxResources.get("drawingTooLarge")})};EditorUi.prototype.createEmbedSvg=function(a,
|
|
|
|
|
b,c,d,e,g,k){var f=this.editor.graph.getSvg(),l=f.getElementsByTagName("a");if(null!=l)for(var p=0;p<l.length;p++){var m=l[p].getAttribute("href");null!=m&&"#"==m.charAt(0)&&"_blank"==l[p].getAttribute("target")&&l[p].removeAttribute("target")}d&&f.setAttribute("content",this.getFileData(!0));b&&this.editor.graph.addSvgShadow(f);if(c){var n=" ",t="";d&&(n="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('"+
|
|
|
|
|
c,d);else f==App.MODE_DEVICE||"download"==f?this.doSaveLocalFile(a,b,c,d):null!=b&&0<b.length&&this.pickFolder(f,mxUtils.bind(this,function(e){try{this.exportFile(a,b,c,d,f,e)}catch(y){this.handleError(y)}}))}catch(D){this.handleError(D)}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,g,k,null,1<e,f,a,c,d);g=this.isServices(e)?e>f?390:270:160;this.showDialog(b.container,400,g,!0,!0);b.init()};EditorUi.prototype.openInNewWindow=function(a,
|
|
|
|
|
b,c){if(mxClient.IS_GC||mxClient.IS_EDGE||11==document.documentMode||10==document.documentMode){var d=window.open("about:blank");null==d||null==d.document?mxUtils.popup(a,!0):("image/svg+xml"==b?d.document.write("<html>"+a+"</html>"):d.document.write('<html><img src="data:'+b+(c?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))+'"/></html>'),d.document.close())}else d=window.open("data:"+b+(c?";base64,"+a:";charset=utf8,"+encodeURIComponent(a))),null!=d&&null!=d.document||mxUtils.popup(a,!0)};
|
|
|
|
|
var b=EditorUi.prototype.addChromelessToolbarItems;EditorUi.prototype.addChromelessToolbarItems=function(a){if(this.isExportToCanvas()){this.exportDialog=null;var c=a(mxUtils.bind(this,function(a){var b=mxUtils.bind(this,function(){mxEvent.removeListener(this.editor.graph.container,"click",b);null!=this.exportDialog&&(this.exportDialog.parentNode.removeChild(this.exportDialog),this.exportDialog=null)});if(null!=this.exportDialog)b.apply(this);else{this.exportDialog=document.createElement("div");var d=
|
|
|
|
|
c.getBoundingClientRect();mxUtils.setPrefixedStyle(this.exportDialog.style,"borderRadius","5px");this.exportDialog.style.position="fixed";this.exportDialog.style.textAlign="center";this.exportDialog.style.fontFamily="Helvetica,Arial";this.exportDialog.style.backgroundColor="#000000";this.exportDialog.style.width="50px";this.exportDialog.style.height="50px";this.exportDialog.style.padding="4px 2px 4px 2px";this.exportDialog.style.color="#ffffff";mxUtils.setOpacity(this.exportDialog,70);this.exportDialog.style.left=
|
|
|
|
|
d.left+"px";this.exportDialog.style.bottom=parseInt(this.chromelessToolbar.style.bottom)+this.chromelessToolbar.offsetHeight+4+"px";d=mxUtils.getCurrentStyle(this.editor.graph.container);this.exportDialog.style.zIndex=d.zIndex;var f=new Spinner({lines:8,length:6,width:5,radius:6,rotate:0,color:"#fff",speed:1.5,trail:60,shadow:!1,hwaccel:!1,top:"28px",zIndex:2E9});f.spin(this.exportDialog);this.exportToCanvas(mxUtils.bind(this,function(a){f.stop();this.exportDialog.style.width="auto";this.exportDialog.style.height=
|
|
|
|
|
"auto";this.exportDialog.style.padding="10px";var c=this.createImageDataUri(a,null,"png");a=document.createElement("img");a.style.maxWidth="140px";a.style.maxHeight="140px";a.style.cursor="pointer";a.style.backgroundColor="white";a.setAttribute("title",mxResources.get("openInNewWindow"));a.setAttribute("border","0");a.setAttribute("src",c);this.exportDialog.appendChild(a);mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.openInNewWindow(c.substring(c.indexOf(",")+1),"image/png",!0);
|
|
|
|
|
b.apply(this,arguments)}))}),null,this.thumbImageCache,null,mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a)}));mxEvent.addListener(this.editor.graph.container,"click",b);document.body.appendChild(this.exportDialog)}mxEvent.consume(a)}),Editor.cameraLargeImage,mxResources.get("export"))}b.apply(this,arguments)};EditorUi.prototype.saveData=function(a,b,c,d,e){this.isLocalFileSave()?this.saveLocalFile(c,a,d,e,b):this.saveRequest(a,b,mxUtils.bind(this,function(a,f){return this.createEchoRequest(c,
|
|
|
|
|
a,d,e,b,f)}),c,e,d)};EditorUi.prototype.saveRequest=function(a,b,c,d,e,g,k){k=null!=k?k:!mxClient.IS_IOS||!navigator.standalone;var f=this.getServiceCount(!1);isLocalStorage&&f++;var l=4>=f?2:6<f?4:3;a=new CreateDialog(this,a,mxUtils.bind(this,function(a,f){if("_blank"==f||null!=a&&0<a.length){var e=c("_blank"==f?null:a,f==App.MODE_DEVICE||"download"==f||null==f||"_blank"==f?"0":"1");null!=e&&(f==App.MODE_DEVICE||"download"==f||"_blank"==f?e.simulate(document,"_blank"):this.pickFolder(f,mxUtils.bind(this,
|
|
|
|
|
function(c){g=null!=g?g:"pdf"==b?"application/pdf":"image/"+b;if(null!=d)try{this.exportFile(d,a,g,!0,f,c)}catch(J){this.handleError(J)}else this.spinner.spin(document.body,mxResources.get("saving"))&&e.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=e.getStatus()&&299>=e.getStatus())try{this.exportFile(e.getText(),a,g,!0,f,c)}catch(J){this.handleError(J)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(a){this.spinner.stop();this.handleError(a)})})))}}),
|
|
|
|
|
mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,k,null,1<f,l,d,g,e);f=this.isServices(f)?4<f?390:270:160;this.showDialog(a.container,380,f,!0,!0);a.init()};EditorUi.prototype.isServices=function(a){return 1!=a};EditorUi.prototype.getEditBlankXml=function(){return this.getFileData(!0)};EditorUi.prototype.exportFile=function(a,b,c,d,e,g){};EditorUi.prototype.pickFolder=function(a,b,c){b(null)};EditorUi.prototype.exportSvg=function(a,b,c,d,
|
|
|
|
|
e,g,k,m,n,v){if(this.spinner.spin(document.body,mxResources.get("export"))){var f=this.editor.graph.isSelectionEmpty();c=null!=c?c:f;f=b?null:this.editor.graph.background;f==mxConstants.NONE&&(f=null);null==f&&0==b&&(f="#ffffff");var l=this.editor.graph.getSvg(f,a,k,m,null,c,null,null,"blank"==v?"_blank":"self"==v?"_top":null);d&&this.editor.graph.addSvgShadow(l);var p=this.getBaseFilename()+".svg",t=mxUtils.bind(this,function(a){this.spinner.stop();e&&a.setAttribute("content",this.getFileData(!0,
|
|
|
|
|
null,null,null,c,n));if(null!=this.editor.fontCss){var b=a.ownerDocument,b=null!=b.createElementNS?b.createElementNS(mxConstants.NS_SVG,"style"):b.createElement("style");b.setAttribute("type","text/css");mxUtils.setTextContent(b,this.editor.fontCss);a.getElementsByTagName("defs")[0].appendChild(b)}var d='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(a);this.isLocalFileSave()||d.length<=MAX_REQUEST_SIZE?this.saveData(p,"svg",d,
|
|
|
|
|
"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),mxUtils.bind(this,function(){mxUtils.popup(d)}))});this.convertMath(this.editor.graph,l,!1,mxUtils.bind(this,function(){g?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(l,t,this.thumbImageCache)):t(l)}))}};EditorUi.prototype.addRadiobox=function(a,b,c,d,e,g,k){return this.addCheckbox(a,c,d,e,g,k,!0,b)};EditorUi.prototype.addCheckbox=function(a,b,c,d,e,g,k,m){g=null!=g?
|
|
|
|
|
g:!0;var f=document.createElement("input");f.style.marginRight="8px";f.style.marginTop="16px";f.setAttribute("type",k?"radio":"checkbox");k="geCheckbox-"+Editor.guid();f.id=k;null!=m&&f.setAttribute("name",m);c&&(f.setAttribute("checked","checked"),f.defaultChecked=!0);d&&f.setAttribute("disabled","disabled");g&&(a.appendChild(f),c=document.createElement("label"),mxUtils.write(c,b),c.setAttribute("for",k),a.appendChild(c),e||mxUtils.br(a));return f};EditorUi.prototype.addEditButton=function(a,b){var c=
|
|
|
|
|
this.addCheckbox(a,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var d=this.getCurrentFile(),f="";null!=d&&d.getMode()!=App.MODE_DEVICE&&d.getMode()!=App.MODE_BROWSER&&(f=window.location.href);var e=document.createElement("select");e.style.width="120px";e.style.marginLeft="8px";e.style.marginRight="10px";e.className="geBtn";d=document.createElement("option");d.setAttribute("value","blank");mxUtils.write(d,mxResources.get("makeCopy"));e.appendChild(d);d=document.createElement("option");
|
|
|
|
|
d.setAttribute("value","custom");mxUtils.write(d,mxResources.get("custom")+"...");e.appendChild(d);a.appendChild(e);mxEvent.addListener(e,"change",mxUtils.bind(this,function(){if("custom"==e.value){var a=new FilenameDialog(this,f,mxResources.get("ok"),function(a){null!=a?f=a:e.value="blank"},mxResources.get("url"),null,null,null,null,function(){e.value="blank"});this.showDialog(a.container,300,80,!0,!1);a.init()}}));mxEvent.addListener(c,"change",mxUtils.bind(this,function(){c.checked&&(null==b||
|
|
|
|
|
b.checked)?e.removeAttribute("disabled"):e.setAttribute("disabled","disabled")}));mxUtils.br(a);return{getLink:function(){return c.checked?"blank"===e.value?"_blank":f:null},getEditInput:function(){return c},getEditSelect:function(){return e}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){g.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=e&&e!=mxConstants.NONE?"border:1px solid black;background-color:"+e:"background-position:center center;background-repeat:no-repeat;background-image:url('"+
|
|
|
|
|
Dialog.prototype.closeImage+"')")+';"></div>'}mxUtils.write(a,mxResources.get("links")+":");var d=document.createElement("select");d.style.width="100px";d.style.marginLeft="8px";d.style.marginRight="10px";d.className="geBtn";var f=document.createElement("option");f.setAttribute("value","auto");mxUtils.write(f,mxResources.get("automatic"));d.appendChild(f);f=document.createElement("option");f.setAttribute("value","blank");mxUtils.write(f,mxResources.get("openInNewWindow"));d.appendChild(f);f=document.createElement("option");
|
|
|
|
|
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",g=null,g=mxUtils.button("",mxUtils.bind(this,function(a){this.pickColor(e||"none",function(a){e=a;c()});mxEvent.consume(a)}));c();g.style.padding=
|
|
|
|
|
mxClient.IS_FF?"4px 2px 4px 2px":"4px";g.style.marginLeft="4px";g.style.height="22px";g.style.width="22px";g.style.position="relative";g.style.top=mxClient.IS_IE||mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";g.className="geColorBtn";a.appendChild(g);mxUtils.br(a);return{getColor:function(){return e},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=function(a,b,c,d,e,g,k,m){var f=this.getCurrentFile(),l=[];d&&(l.push("lightbox=1"),"auto"!=a&&l.push("target="+
|
|
|
|
|
a),null!=b&&b!=mxConstants.NONE&&l.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),null!=e&&0<e.length&&l.push("edit="+encodeURIComponent(e)),g&&l.push("layers=1"),this.editor.graph.foldingEnabled&&l.push("nav=1"));c&&null!=this.currentPage&&null!=this.pages&&this.currentPage!=this.pages[0]&&l.push("page-id="+this.currentPage.getId());a=!0;null!=k?c="#U"+encodeURIComponent(k):(f=this.getCurrentFile(),m||null==f||f.constructor!=window.DriveFile?c="#R"+encodeURIComponent(c?this.getFileData(!0,
|
|
|
|
|
null,null,null,null,null,null,!0):Graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(c="#"+f.getHash(),a=!1));a&&null!=f&&null!=f.getTitle()&&f.getTitle()!=this.defaultFilename&&l.push("title="+encodeURIComponent(f.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||!/.*\.draw\.io$/.test(window.location.hostname)?EditorUi.drawHost:"https://"+window.location.host+"/")+(0<l.length?"?"+l.join("&"):"")+c};EditorUi.prototype.createHtml=function(a,b,c,d,e,g,k,m,n,v,B){this.getBasenames();
|
|
|
|
|
var f={};""!=e&&e!=mxConstants.NONE&&(f.highlight=e);"auto"!==d&&(f.target=d);n||(f.lightbox=!1);f.nav=this.editor.graph.foldingEnabled;c=parseInt(c);isNaN(c)||100==c||(f.zoom=c/100);c=[];k&&(c.push("pages"),f.resize=!0,null!=this.pages&&null!=this.currentPage&&(f.page=mxUtils.indexOf(this.pages,this.currentPage)));b&&(c.push("zoom"),f.resize=!0);m&&c.push("layers");0<c.length&&(n&&c.push("lightbox"),f.toolbar=c.join(" "));null!=v&&0<v.length&&(f.edit=v);null!=a?f.url=a:f.xml=this.getFileData(!0,
|
|
|
|
|
null,null,null,null,!k);b='<div class="mxgraph" style="'+(g?"max-width:100%;":"")+(""!=c?"border:1px solid transparent;":"")+'" data-mxgraph="'+mxUtils.htmlEntities(JSON.stringify(f))+'"></div>';a=null!=a?"&fetch="+encodeURIComponent(a):"";B(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,c,d){var f=document.createElement("div");f.style.whiteSpace="nowrap";var e=document.createElement("h3");mxUtils.write(e,mxResources.get("html"));e.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";f.appendChild(e);var g=document.createElement("div");g.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var l=document.createElement("input");l.style.cssText=
|
|
|
|
|
"margin-right:8px;margin-top:8px;margin-bottom:8px;";l.setAttribute("value","url");l.setAttribute("type","radio");l.setAttribute("name","type-embedhtmldialog");e=l.cloneNode(!0);e.setAttribute("value","copy");g.appendChild(e);var k=document.createElement("span");mxUtils.write(k,mxResources.get("includeCopyOfMyDiagram"));g.appendChild(k);mxUtils.br(g);g.appendChild(l);k=document.createElement("span");mxUtils.write(k,mxResources.get("publicDiagramUrl"));g.appendChild(k);var p=this.getCurrentFile();
|
|
|
|
|
null==c&&null!=p&&p.constructor==window.DriveFile&&(k=document.createElement("a"),k.style.paddingLeft="12px",k.style.color="gray",k.setAttribute("href","javascript:void(0);"),mxUtils.write(k,mxResources.get("share")),g.appendChild(k),mxEvent.addListener(k,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(p.getId())})));e.setAttribute("checked","checked");null==c&&l.setAttribute("disabled","disabled");f.appendChild(g);var m=this.addLinkSection(f),n=this.addCheckbox(f,
|
|
|
|
|
mxResources.get("zoom"),!0,null,!0);mxUtils.write(f,":");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%";f.appendChild(u);var q=this.addCheckbox(f,mxResources.get("fit"),!0),g=null!=this.pages&&1<this.pages.length,H=H=this.addCheckbox(f,mxResources.get("allPages"),g,!g),F=this.addCheckbox(f,mxResources.get("layers"),!0),G=this.addCheckbox(f,mxResources.get("lightbox"),
|
|
|
|
|
!0),I=this.addEditButton(f,G),E=I.getEditInput();E.style.marginBottom="16px";mxEvent.addListener(G,"change",function(){G.checked?E.removeAttribute("disabled"):E.setAttribute("disabled","disabled");E.checked&&G.checked?I.getEditSelect().removeAttribute("disabled"):I.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,f,mxUtils.bind(this,function(){d(l.checked?c:null,n.checked,u.value,m.getTarget(),m.getColor(),q.checked,H.checked,F.checked,G.checked,I.getLink())}),null,a,
|
|
|
|
|
b);this.showDialog(a.container,340,384,!0,!0);e.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,c,d,e,g){var f=document.createElement("div");f.style.whiteSpace="nowrap";var l=document.createElement("h3");mxUtils.write(l,a||mxResources.get("link"));l.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";f.appendChild(l);var k=this.getCurrentFile(),l="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=k&&k.constructor==window.DriveFile&&
|
|
|
|
|
!b){a=80;var l="https://desk.draw.io/support/solutions/articles/16000039384",p=document.createElement("div");p.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";var m=document.createElement("div");m.style.whiteSpace="normal";mxUtils.write(m,mxResources.get("linkAccountRequired"));p.appendChild(m);m=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(k.getId())}));m.style.marginTop=
|
|
|
|
|
"12px";m.className="geBtn";p.appendChild(m);f.appendChild(p);m=document.createElement("a");m.style.paddingLeft="12px";m.style.color="gray";m.style.fontSize="11px";m.setAttribute("href","javascript:void(0);");mxUtils.write(m,mxResources.get("check"));p.appendChild(m);mxEvent.addListener(m,"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,
|
|
|
|
|
mxResources.get(null!=a?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(a.container,300,80,!0,!1);a.init()}))}))}var n=null,t=null;if(null!=c||null!=d)a+=30,mxUtils.write(f,mxResources.get("width")+":"),n=document.createElement("input"),n.setAttribute("type","text"),n.style.marginRight="16px",n.style.width="50px",n.style.marginLeft="6px",n.style.marginRight="16px",n.style.marginBottom="10px",n.value="100%",f.appendChild(n),mxUtils.write(f,mxResources.get("height")+":"),
|
|
|
|
|
t=document.createElement("input"),t.setAttribute("type","text"),t.style.width="50px",t.style.marginLeft="6px",t.style.marginBottom="10px",t.value=d+"px",f.appendChild(t),mxUtils.br(f);var u=this.addLinkSection(f,g);c=null!=this.pages&&1<this.pages.length;var q=null;if(null==k||k.constructor!=window.DriveFile||b)q=this.addCheckbox(f,mxResources.get("allPages"),c,!c);var z=this.addCheckbox(f,mxResources.get("lightbox"),!0),G=this.addEditButton(f,z),I=G.getEditInput(),E=this.addCheckbox(f,mxResources.get("layers"),
|
|
|
|
|
!0);E.style.marginLeft=I.style.marginLeft;E.style.marginBottom="16px";E.style.marginTop="8px";mxEvent.addListener(z,"change",function(){z.checked?(E.removeAttribute("disabled"),I.removeAttribute("disabled")):(E.setAttribute("disabled","disabled"),I.setAttribute("disabled","disabled"));I.checked&&z.checked?G.getEditSelect().removeAttribute("disabled"):G.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,f,mxUtils.bind(this,function(){e(u.getTarget(),u.getColor(),null==q?
|
|
|
|
|
!0:q.checked,z.checked,G.getLink(),E.checked,null!=n?n.value:null,null!=t?t.value:null)}),null,mxResources.get("create"),l);this.showDialog(b.container,340,254+a,!0,!0);null!=n?(n.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",!1,null)):u.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,c,d,e){var f=document.createElement("div");f.style.whiteSpace="nowrap";var g=document.createElement("h3");mxUtils.write(g,
|
|
|
|
|
mxResources.get("image"));g.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:"+(e?"10":"4")+"px";f.appendChild(g);if(e){mxUtils.write(f,mxResources.get("zoom")+":");var l=document.createElement("input");l.setAttribute("type","text");l.style.marginRight="16px";l.style.width="60px";l.style.marginLeft="4px";l.style.marginRight="12px";l.value=this.lastExportZoom||"100%";f.appendChild(l);mxUtils.write(f,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";f.appendChild(k);mxUtils.br(f)}var p=this.addCheckbox(f,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),m=d?null:this.addCheckbox(f,mxResources.get("includeCopyOfMyDiagram"),!0),g=this.editor.graph,n=d?null:this.addCheckbox(f,mxResources.get("transparentBackground"),g.background==mxConstants.NONE||null==g.background);null!=n&&(n.style.marginBottom="16px");a=
|
|
|
|
|
new CustomDialog(this,f,mxUtils.bind(this,function(){var a=parseInt(l.value)/100||1,b=parseInt(k.value)||0;c(!p.checked,null!=m?m.checked:!1,null!=n?n.checked:!1,a,b)}),null,a,b);this.showDialog(a.container,300,(e?25:0)+(d?125:210),!0,!0)};EditorUi.prototype.showExportDialog=function(a,b,c,d,e,g,k,m){k=null!=k?k:!0;var f=document.createElement("div");f.style.whiteSpace="nowrap";var l=this.editor.graph,p="jpeg"==m?196:300,n=document.createElement("h3");mxUtils.write(n,a);n.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";
|
|
|
|
|
f.appendChild(n);mxUtils.write(f,mxResources.get("zoom")+":");var t=document.createElement("input");t.setAttribute("type","text");t.style.marginRight="16px";t.style.width="60px";t.style.marginLeft="4px";t.style.marginRight="12px";t.value=this.lastExportZoom||"100%";f.appendChild(t);mxUtils.write(f,mxResources.get("borderWidth")+":");var u=document.createElement("input");u.setAttribute("type","text");u.style.marginRight="16px";u.style.width="60px";u.style.marginLeft="4px";u.value=this.lastExportBorder||
|
|
|
|
|
"0";f.appendChild(u);mxUtils.br(f);var q=this.addCheckbox(f,mxResources.get("transparentBackground"),!1,null,null,"jpeg"!=m),z=this.addCheckbox(f,mxResources.get("selectionOnly"),!1,l.isSelectionEmpty()),x=document.createElement("input");x.style.marginTop="16px";x.style.marginRight="8px";x.style.marginLeft="24px";x.setAttribute("disabled","disabled");x.setAttribute("type","checkbox");g&&(f.appendChild(x),mxUtils.write(f,mxResources.get("crop")),mxUtils.br(f),p+=26,mxEvent.addListener(z,"change",function(){z.checked?
|
|
|
|
|
x.removeAttribute("disabled"):x.setAttribute("disabled","disabled")}));l.isSelectionEmpty()||(x.setAttribute("checked","checked"),x.defaultChecked=!0);var A=this.addCheckbox(f,mxResources.get("shadow"),l.shadowVisible),E=document.createElement("input");E.style.marginTop="16px";E.style.marginRight="8px";E.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||E.setAttribute("disabled","disabled");b&&(f.appendChild(E),mxUtils.write(f,mxResources.get("embedImages")),mxUtils.br(f),p+=
|
|
|
|
|
26);var L=this.addCheckbox(f,mxResources.get("includeCopyOfMyDiagram"),k,null,null,"jpeg"!=m),K=null!=this.pages&&1<this.pages.length,R=this.addCheckbox(f,K?mxResources.get("allPages"):"",K,!K,null,"jpeg"!=m);R.style.marginLeft="24px";R.style.marginBottom="16px";K||(R.style.display="none");mxEvent.addListener(L,"change",function(){L.checked&&K?R.removeAttribute("disabled"):R.setAttribute("disabled","disabled")});k&&K||R.setAttribute("disabled","disabled");var V=document.createElement("select");V.style.maxWidth=
|
|
|
|
|
"260px";V.style.marginLeft="8px";V.style.marginRight="10px";V.className="geBtn";a=document.createElement("option");a.setAttribute("value","auto");mxUtils.write(a,mxResources.get("automatic"));V.appendChild(a);a=document.createElement("option");a.setAttribute("value","blank");mxUtils.write(a,mxResources.get("openInNewWindow"));V.appendChild(a);a=document.createElement("option");a.setAttribute("value","self");mxUtils.write(a,mxResources.get("openInThisWindow"));V.appendChild(a);"svg"==m&&(mxUtils.write(f,
|
|
|
|
|
mxResources.get("links")+":"),f.appendChild(V),mxUtils.br(f),mxUtils.br(f),p+=26);c=new CustomDialog(this,f,mxUtils.bind(this,function(){this.lastExportBorder=u.value;this.lastExportZoom=t.value;e(t.value,q.checked,!z.checked,A.checked,L.checked,E.checked,u.value,x.checked,!R.checked,V.value)}),null,c,d);this.showDialog(c.container,340,p,!0,!0,null,null,null,null,!0);t.focus();mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?t.select():document.execCommand("selectAll",
|
|
|
|
|
!1,null)};EditorUi.prototype.showEmbedImageDialog=function(a,b,c,d,e){var f=document.createElement("div");f.style.whiteSpace="nowrap";var g=this.editor.graph;if(null!=b){var l=document.createElement("h3");mxUtils.write(l,b);l.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";f.appendChild(l)}var k=this.addCheckbox(f,mxResources.get("fit"),!0),p=this.addCheckbox(f,mxResources.get("shadow"),g.shadowVisible&&d,!d),m=this.addCheckbox(f,c),n=this.addCheckbox(f,mxResources.get("lightbox"),
|
|
|
|
|
!0),u=this.addEditButton(f,n),q=u.getEditInput(),z=1<g.model.getChildCount(g.model.getRoot()),F=this.addCheckbox(f,mxResources.get("layers"),z,!z);F.style.marginLeft=q.style.marginLeft;F.style.marginBottom="12px";F.style.marginTop="8px";mxEvent.addListener(n,"change",function(){n.checked?(z&&F.removeAttribute("disabled"),q.removeAttribute("disabled")):(F.setAttribute("disabled","disabled"),q.setAttribute("disabled","disabled"));q.checked&&n.checked?u.getEditSelect().removeAttribute("disabled"):u.getEditSelect().setAttribute("disabled",
|
|
|
|
|
"disabled")});b=new CustomDialog(this,f,mxUtils.bind(this,function(){a(k.checked,p.checked,m.checked,n.checked,u.getLink(),F.checked)}),null,mxResources.get("embed"),e);this.showDialog(b.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(a,b,c,d,e,g,k,m){function f(b){var f=" ",p="";d&&(f=" 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('"+
|
|
|
|
|
EditorUi.drawHost+"/?client=1&lightbox=1"+(e?"&edit=_blank":"")+(g?"&layers=1":"")+"');}})(this);\"",p+="cursor:pointer;");a&&(p+="max-width:100%;");var m="";c&&(m=' width="'+Math.round(l.width)+'" height="'+Math.round(l.height)+'"');k('<img src="'+b+'"'+m+(""!=p?' style="'+p+'"':"")+f+"/>")}var l=this.editor.graph.getGraphBounds();if(this.isExportToCanvas())this.exportToCanvas(mxUtils.bind(this,function(a){var b=d?this.getFileData(!0):null;a=this.createImageDataUri(a,b,"png");f(a)}),null,null,null,
|
|
|
|
|
mxUtils.bind(this,function(a){m({message:mxResources.get("unknownError")})}),null,!0,c?2:1,null,b);else if(b=this.getFileData(!0),l.width*l.height<=MAX_AREA&&b.length<=MAX_REQUEST_SIZE){var p="";c&&(p="&w="+Math.round(2*l.width)+"&h="+Math.round(2*l.height));var n=new mxXmlRequest(EXPORT_URL,"format=png&base64=1&embedXml="+(d?"1":"0")+p+"&xml="+encodeURIComponent(b));n.send(mxUtils.bind(this,function(){200<=n.getStatus()&&299>=n.getStatus()?f("data:image/png;base64,"+n.getText()):m({message:mxResources.get("unknownError")})}))}else m({message:mxResources.get("drawingTooLarge")})};
|
|
|
|
|
EditorUi.prototype.createEmbedSvg=function(a,b,c,d,e,g,k){var f=this.editor.graph.getSvg(),l=f.getElementsByTagName("a");if(null!=l)for(var p=0;p<l.length;p++){var m=l[p].getAttribute("href");null!=m&&"#"==m.charAt(0)&&"_blank"==l[p].getAttribute("target")&&l[p].removeAttribute("target")}d&&f.setAttribute("content",this.getFileData(!0));b&&this.editor.graph.addSvgShadow(f);if(c){var n=" ",t="";d&&(n="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('"+
|
|
|
|
|
EditorUi.drawHost+"/?client=1&lightbox=1"+(e?"&edit=_blank":"")+(g?"&layers=1":"")+"');}})(this);\"",t+="cursor:pointer;");a&&(t+="max-width:100%;");this.convertImages(f,mxUtils.bind(this,function(a){k('<img src="'+this.createSvgDataUri(mxUtils.getXml(a))+'"'+(""!=t?' style="'+t+'"':"")+n+"/>")}))}else t="",d&&(f.setAttribute("onclick","(function(svg){var src=window.event.target||window.event.srcElement;while (src!=null&&src.nodeName.toLowerCase()!='a'){src=src.parentNode;}if(src==null){if(svg.wnd!=null&&!svg.wnd.closed){svg.wnd.focus();}else{var r=function(evt){if(evt.data=='ready'&&evt.source==svg.wnd){svg.wnd.postMessage(decodeURIComponent(svg.getAttribute('content')),'*');window.removeEventListener('message',r);}};window.addEventListener('message',r);svg.wnd=window.open('"+
|
|
|
|
|
EditorUi.drawHost+"/?client=1&lightbox=1"+(e?"&edit=_blank":"")+(g?"&layers=1":"")+"');}}})(this);"),t+="cursor:pointer;"),a&&(a=parseInt(f.getAttribute("width")),b=parseInt(f.getAttribute("height")),f.setAttribute("viewBox","-0.5 -0.5 "+a+" "+b),t+="max-width:100%;max-height:"+b+"px;",f.removeAttribute("height")),""!=t&&f.setAttribute("style",t),k(mxUtils.getXml(f))};EditorUi.prototype.timeSince=function(a){a=Math.floor((new Date-a)/1E3);var b=Math.floor(a/31536E3);if(1<b)return b+" "+mxResources.get("years");
|
|
|
|
|
b=Math.floor(a/2592E3);if(1<b)return b+" "+mxResources.get("months");b=Math.floor(a/86400);if(1<b)return b+" "+mxResources.get("days");b=Math.floor(a/3600);if(1<b)return b+" "+mxResources.get("hours");b=Math.floor(a/60);return 1<b?b+" "+mxResources.get("minutes"):1==b?b+" "+mxResources.get("minute"):null};EditorUi.prototype.convertMath=function(a,b,c,d){a.mathEnabled&&"undefined"!==typeof MathJax&&"undefined"!==typeof MathJax.Hub?(Editor.MathJaxRender(b),window.setTimeout(mxUtils.bind(this,function(){MathJax.Hub.Queue(mxUtils.bind(this,
|
|
|
|
@ -8649,52 +8649,53 @@ b?b:0;c=null!=c?c:0;var f=[];try{var g=this.editor.graph;if(null!=a&&0<a.length)
|
|
|
|
|
p[m].getAttribute("id");p[m].removeAttribute("id");var u=this.updatePageRoot(new DiagramPage(p[m]));a[n]=p[m].getAttribute("id");var q=this.pages.length;null==u.getName()&&u.setName(mxResources.get("pageWithNumber",[q+1]));g.model.execute(new ChangePage(this,u,u,q,!0));l.push(u)}this.updatePageLinks(a,l)}}null!=k&&"mxGraphModel"===k.nodeName&&(f=g.importGraphModel(k,b,c,d))}finally{g.model.endUpdate()}}}catch(H){if(e)throw H;this.handleError(H)}return f};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&&"data:page/id,"==f.substring(0,13)&&d.setLinkForCell(b,this.updatePageLink(a,f));if(d.isHtmlLabel(b)){c.innerHTML=d.getLabel(b);for(var e=c.getElementsByTagName("a"),g=!1,l=0;l<e.length;l++)f=e[l].getAttribute("href"),null!=f&&"data:page/id,"==f.substring(0,13)&&(e[l].setAttribute("href",
|
|
|
|
|
this.updatePageLink(a,f)),g=!0);g&&d.labelChanged(b,c.innerHTML)}for(l=0;l<d.model.getChildCount(b);l++)this.updatePageLinksForCell(a,d.model.getChildAt(b,l))};EditorUi.prototype.updatePageLink=function(a,b){var c=a[b.substring(b.indexOf(",")+1)];return null!=c?"data:page/id,"+c:null};EditorUi.prototype.isRemoteVisioFormat=function(a){return/(\.v(sd|dx))($|\?)/i.test(a)||/(\.vs(s|x))($|\?)/i.test(a)};EditorUi.prototype.importVisio=function(a,b,c,d){d=null!=d?d:a.name;c=null!=c?c:mxUtils.bind(this,
|
|
|
|
|
function(a){this.handleError(a)});var f=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.doImportVisio){var f=this.isRemoteVisioFormat(d);try{var e="UNKNOWN-VISIO",g=d.lastIndexOf(".");0<=g&&g<d.length&&(e=d.substring(g+1).toUpperCase());EditorUi.logEvent({category:e+"-MS-IMPORT-FILE",action:"filename_"+d,label:f?"remote":"local"})}catch(v){}if(f&&null!=VSD_CONVERT_URL){f=new FormData;f.append("file1",a,d);var l=new XMLHttpRequest;l.open("POST",VSD_CONVERT_URL);l.responseType="blob";
|
|
|
|
|
l.onreadystatechange=mxUtils.bind(this,function(){if(4==l.readyState)if(200<=l.status&&299>=l.status)try{this.doImportVisio(l.response,b,c,d)}catch(v){c(v)}else c({})});l.send(f)}else try{this.doImportVisio(a,b,c,d)}catch(v){c(v)}}else this.spinner.stop(),this.handleError({message:mxResources.get("serviceUnavailableOrBlocked")})});this.doImportVisio||this.loadingExtensions||this.isOffline(!0)?f():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",f))};EditorUi.prototype.importGraphML=function(a,
|
|
|
|
|
b,c){c=null!=c?c:mxUtils.bind(this,function(a){this.handleError(a)});var d=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.doImportGraphML)try{this.doImportGraphML(a,b,c)}catch(z){c(z)}else this.spinner.stop(),this.handleError({message:mxResources.get("serviceUnavailableOrBlocked")})});this.doImportGraphML||this.loadingExtensions||this.isOffline(!0)?d():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",d))};EditorUi.prototype.exportVisio=function(){var a=mxUtils.bind(this,
|
|
|
|
|
function(){this.loadingExtensions=!1;if("undefined"!==typeof VsdxExport)try{(new VsdxExport(this)).exportCurrentDiagrams()||this.handleError({message:mxResources.get("unknownError")})}catch(l){this.handleError(l)}else this.spinner.stop(),this.handleError({message:mxResources.get("serviceUnavailableOrBlocked")})});"undefined"!==typeof VsdxExport||this.loadingExtensions||this.isOffline(!0)?a():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",a))};EditorUi.prototype.convertLucidChart=function(a,
|
|
|
|
|
b,c){var d=mxUtils.bind(this,function(){this.loadingExtensions=!1;if("undefined"!==typeof window.LucidImporter){try{EditorUi.logEvent({category:"LUCIDCHART-IMPORT-FILE",action:"size_"+a.length})}catch(z){}try{b(LucidImporter.importState(JSON.parse(a)))}catch(z){c(z)}}else c({message:mxResources.get("serviceUnavailableOrBlocked")})});"undefined"!==typeof window.LucidImporter||this.loadingExtensions||this.isOffline(!0)?window.setTimeout(d,0):(this.loadingExtensions=!0,"1"==urlParams.dev?mxscript("js/diagramly/Extensions.js",
|
|
|
|
|
d):mxscript("js/extensions.min.js",d))};EditorUi.prototype.insertAsPreText=function(a,b,c){var d=this.editor.graph,f=null;d.getModel().beginUpdate();try{f=d.insertVertex(null,null,"<pre>"+a+"</pre>",b,c,1,1,"text;html=1;align=center;verticalAlign=middle;"),d.updateCellSize(f,!0)}finally{d.getModel().endUpdate()}return f};EditorUi.prototype.insertTextAt=function(a,b,c,d,e,g,k){g=null!=g?g:!0;k=null!=k?k:!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,c,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(e||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var f=this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var l=this.extractGraphModelFromPng(a),p=this.importXml(l,b,c,g,!0);if(0<p.length)return p}if("data:image/svg+xml;"==a.substring(0,
|
|
|
|
|
19))try{if(l=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(l=a.substring(a.indexOf(",")+1),l=window.atob&&!mxClient.IS_SF?atob(l):Base64.decode(l,!0)):l=decodeURIComponent(a.substring(a.indexOf(",")+1)),p=this.importXml(l,b,c,g,!0),0<p.length)return p}catch(B){}this.loadImage(a,mxUtils.bind(this,function(d){if("data:"==a.substring(0,5))this.resizeImage(d,a,mxUtils.bind(this,function(a,d,e){f.setSelectionCell(f.insertVertex(null,null,"",f.snap(b),f.snap(c),d,e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
|
|
|
|
this.convertDataUri(a)+";"))}),k,this.maxImageSize);else{var e=Math.min(1,Math.min(this.maxImageSize/d.width,this.maxImageSize/d.height)),g=Math.round(d.width*e);d=Math.round(d.height*e);f.setSelectionCell(f.insertVertex(null,null,"",f.snap(b),f.snap(c),g,d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var e=null;f.getModel().beginUpdate();try{e=f.insertVertex(f.getDefaultParent(),
|
|
|
|
|
null,a,f.snap(b),f.snap(c),1,1,"text;"+(d?"html=1;":"")),f.updateCellSize(e),f.fireEvent(new mxEventObject("textInserted","cells",[e]))}finally{f.getModel().endUpdate()}f.setSelectionCell(e)}))}else{a=Graph.zapGremlins(mxUtils.trim(a));if(this.isCompatibleString(a))return this.importXml(a,b,c,g);if(0<a.length)if(this.isLucidChartData(a))this.convertLucidChart(a,mxUtils.bind(this,function(a){this.editor.graph.setSelectionCells(this.importXml(a,b,c,g))}),mxUtils.bind(this,function(a){this.handleError(a)}));
|
|
|
|
|
else{f=this.editor.graph;e=null;f.getModel().beginUpdate();try{e=f.insertVertex(f.getDefaultParent(),null,"",f.snap(b),f.snap(c),1,1,"text;"+(d?"html=1;":"")),f.fireEvent(new mxEventObject("textInserted","cells",[e])),"<"==a.charAt(0)&&a.indexOf(">")==a.length-1&&(a=mxUtils.htmlEntities(a)),a.length>this.maxTextBytes&&(a=a.substring(0,this.maxTextBytes)+"..."),e.value=a,f.updateCellSize(e),/\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(e.value)&&
|
|
|
|
|
f.setLinkForCell(e,e.value),e.geometry.width+=f.gridSize,e.geometry.height+=f.gridSize}finally{f.getModel().endUpdate()}return[e]}}return[]};EditorUi.prototype.formatFileSize=function(a){var b=-1;do a/=1024,b++;while(1024<a);return Math.max(a,.1).toFixed(1)+" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[b]};EditorUi.prototype.convertDataUri=function(a){if("data:"==a.substring(0,5)){var b=a.indexOf(";");0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1)))}return a};EditorUi.prototype.isRemoteFileFormat=
|
|
|
|
|
function(a,b){return/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(a)};EditorUi.prototype.isLucidChartData=function(a){return null!=a&&('{"state":"{\\"Properties\\":'==a.substring(0,26)||'{"Properties":'==a.substring(0,14))};EditorUi.prototype.importLocalFile=function(a,b){if(a&&Graph.fileSupport){if(null==this.importFileInputElt){var c=document.createElement("input");c.setAttribute("type","file");mxEvent.addListener(c,"change",mxUtils.bind(this,function(){null!=c.files&&(this.importFiles(c.files,
|
|
|
|
|
null,null,this.maxImageSize),c.type="",c.type="file",c.value="")}));c.style.display="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,b){if(null!=b&&Graph.fileSupport&&/(\.v(dx|sdx?))($|\?)/i.test(b)){var c=new Blob([a],
|
|
|
|
|
{type:"application/octet-stream"});this.importVisio(c,mxUtils.bind(this,function(a){this.importXml(a,0,0,!0)}),null,b)}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.importFile=
|
|
|
|
|
function(a,b,c,d,e,g,k,m,n,v,B){v=null!=v?v:!0;var f=!1,l=null,p=mxUtils.bind(this,function(a){var b=null;null!=a&&"<mxlibrary"==a.substring(0,10)?this.loadLibrary(new LocalLibrary(this,a,k)):b=this.importXml(a,c,d,v);null!=m&&m(b)});"image"==b.substring(0,5)?(n=!1,"image/png"==b.substring(0,9)&&(b=B?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(l=this.importXml(b,c,d,v),n=!0)),n||(l=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1))),v&&l.isGridEnabled()&&
|
|
|
|
|
(c=l.snap(c),d=l.snap(d)),l=[l.insertVertex(null,null,"",c,d,e,g,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";")])):/(\.*<graphml )/.test(a)?(f=!0,this.importGraphML(a,p)):null!=n&&null!=k&&(/(\.v(dx|sdx?))($|\?)/i.test(k)||/(\.vs(x|sx?))($|\?)/i.test(k))?(f=!0,this.importVisio(n,p)):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,k)?(f=!0,this.parseFile(null!=n?n:new Blob([a],{type:"application/octet-stream"}),
|
|
|
|
|
mxUtils.bind(this,function(a){4==a.readyState&&(200<=a.status&&299>=a.status?p(a.responseText):null!=m&&m(null))}),k)):/(\.v(sd|dx))($|\?)/i.test(k)||/(\.vs(s|x))($|\?)/i.test(k)||(l=this.insertTextAt(this.validateFileData(a),c,d,!0,null,v));f||null==m||m(l);return l};EditorUi.prototype.base64Encode=function(a){for(var b="",c=0,d=a.length,f,e,g;c<d;){f=a.charCodeAt(c++)&255;if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&
|
|
|
|
|
3)<<4);b+="==";break}e=a.charCodeAt(c++);if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(e&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&15)<<2);b+="=";break}g=a.charCodeAt(c++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&
|
|
|
|
|
3)<<4|(e&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&15)<<2|(g&192)>>6);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g&63)}return b};EditorUi.prototype.importFiles=function(a,b,c,d,e,g,k,m,n,v,B,q){b=null!=b?b:0;c=null!=c?c:0;d=null!=d?d:this.maxImageSize;v=null!=v?v:this.maxImageBytes;var f=null!=b&&null!=c,l=!0,p=!1;if(!mxClient.IS_CHROMEAPP&&null!=a)for(var t=B||this.resampleThreshold,u=0;u<a.length;u++)if("image/"==a[u].type.substring(0,
|
|
|
|
|
6)&&a[u].size>t){p=!0;break}var D=mxUtils.bind(this,function(){var p=this.editor.graph,n=p.gridSize;e=null!=e?e:mxUtils.bind(this,function(a,b,c,d,e,g,k,l,p){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,k)),null):this.importFile(a,b,c,d,e,g,k,l,p,f,q)});g=null!=g?g:mxUtils.bind(this,function(a){p.setSelectionCells(a)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var t=a.length,u=t,y=[],D=mxUtils.bind(this,function(a,
|
|
|
|
|
b){y[a]=b;if(0==--u){this.spinner.stop();if(null!=m)m(y);else{var c=[];p.getModel().beginUpdate();try{for(var d=0;d<y.length;d++){var f=y[d]();null!=f&&(c=c.concat(f))}}finally{p.getModel().endUpdate()}}g(c)}}),z=0;z<t;z++)mxUtils.bind(this,function(f){var g=a[f];if(null!=g){var m=new FileReader;m.onload=mxUtils.bind(this,function(a){if(null==k||k(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var m=a.target.result,t=m.indexOf(","),u=decodeURIComponent(escape(atob(m.substring(t+
|
|
|
|
|
1)))),y=mxUtils.parseXml(u),u=y.getElementsByTagName("svg");if(0<u.length){var u=u[0],z=q?null:u.getAttribute("content");null!=z&&"<"!=z.charAt(0)&&"%"!=z.charAt(0)&&(z=unescape(window.atob?atob(z):Base64.decode(z,!0)));null!=z&&"%"==z.charAt(0)&&(z=decodeURIComponent(z));null==z||"<mxfile "!==z.substring(0,8)&&"<mxGraphModel "!==z.substring(0,14)?D(f,mxUtils.bind(this,function(){try{if(m.substring(0,t+1),null!=y){var a=y.getElementsByTagName("svg");if(0<a.length){var k=a[0],l=parseFloat(k.getAttribute("width")),
|
|
|
|
|
v=parseFloat(k.getAttribute("height")),B=k.getAttribute("viewBox");if(null==B||0==B.length)k.setAttribute("viewBox","0 0 "+l+" "+v);else if(isNaN(l)||isNaN(v)){var u=B.split(" ");3<u.length&&(l=parseFloat(u[2]),v=parseFloat(u[3]))}m=this.createSvgDataUri(mxUtils.getXml(k));var q=Math.min(1,Math.min(d/Math.max(1,l)),d/Math.max(1,v)),D=e(m,g.type,b+f*n,c+f*n,Math.max(1,Math.round(l*q)),Math.max(1,Math.round(v*q)),g.name);if(isNaN(l)||isNaN(v)){var z=new Image;z.onload=mxUtils.bind(this,function(){l=
|
|
|
|
|
Math.max(1,z.width);v=Math.max(1,z.height);D[0].geometry.width=l;D[0].geometry.height=v;k.setAttribute("viewBox","0 0 "+l+" "+v);m=this.createSvgDataUri(mxUtils.getXml(k));var a=m.indexOf(";");0<a&&(m=m.substring(0,a)+m.substring(m.indexOf(",",a+1)));p.setCellStyles("image",m,[D[0]])});z.src=this.createSvgDataUri(mxUtils.getXml(k))}return D}}}catch(ga){}return null})):D(f,mxUtils.bind(this,function(){return e(z,"text/xml",b+f*n,c+f*n,0,0,g.name)}))}else D(f,mxUtils.bind(this,function(){return null}))}else{u=
|
|
|
|
|
!1;if("image/png"==g.type){var x=q?null:this.extractGraphModelFromPng(a.target.result);if(null!=x&&0<x.length){var E=new Image;E.src=a.target.result;D(f,mxUtils.bind(this,function(){return e(x,"text/xml",b+f*n,c+f*n,E.width,E.height,g.name)}));u=!0}}u||(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(k){this.resizeImage(k,a.target.result,mxUtils.bind(this,function(k,m,p){D(f,mxUtils.bind(this,function(){if(null!=k&&k.length<v){var t=l&&this.isResampleImage(a.target.result,B)?Math.min(1,Math.min(d/m,d/p)):1;return e(k,g.type,b+f*n,c+f*n,Math.round(m*t),Math.round(p*t),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),l,d,B)}),mxUtils.bind(this,function(){this.handleError({message:mxResources.get("invalidOrMissingFile")})})))}else e(a.target.result,
|
|
|
|
|
g.type,b+f*n,c+f*n,240,160,g.name,function(a){D(f,function(){return a})})});/(\.v(dx|sdx?))($|\?)/i.test(g.name)||/(\.vs(x|sx?))($|\?)/i.test(g.name)?e(null,g.type,b+f*n,c+f*n,240,160,g.name,function(a){D(f,function(){return a})},g):"image"==g.type.substring(0,5)?m.readAsDataURL(g):m.readAsText(g)}})(z)});if(p){p=[];for(u=0;u<a.length;u++)p.push(a[u]);a=p;this.confirmImageResize(function(a){l=a;D()},n)}else D()};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,c){c=null!=c?c:a.name;var d=new FormData;d.append("format","xml");d.append("upfile",a,c);var f=new XMLHttpRequest;f.open("POST",OPEN_URL);f.onreadystatechange=function(){b(f)};f.send(d);try{EditorUi.logEvent({category:"GLIFFY-IMPORT-FILE",action:"size_"+a.size})}catch(t){}};EditorUi.prototype.isResampleImage=function(a,
|
|
|
|
|
b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=function(a,b,c,d,e,g){e=null!=e?e:this.maxImageSize;var f=Math.max(1,a.width),k=Math.max(1,a.height);if(d&&this.isResampleImage(b,g))try{var l=Math.max(f/e,k/e);if(1<l){var m=Math.round(f/l),p=Math.round(k/l),n=document.createElement("canvas");n.width=m;n.height=p;n.getContext("2d").drawImage(a,0,0,m,p);var t=n.toDataURL();if(t.length<b.length){var q=document.createElement("canvas");q.width=m;q.height=p;var u=
|
|
|
|
|
q.toDataURL();t!==u&&(b=t,f=m,k=p)}}}catch(F){}c(b,f,k)};EditorUi.prototype.crcTable=[];for(var d=0;256>d;d++)for(var g=d,e=0;8>e;e++)g=1==(g&1)?3988292384^g>>>1:g>>>1,EditorUi.prototype.crcTable[d]=g;EditorUi.prototype.updateCRC=function(a,b,c,d){for(var f=0;f<d;f++)a=EditorUi.prototype.crcTable[(a^b.charCodeAt(c+f))&255]^a>>>8;return a};EditorUi.prototype.crc32=function(a){this.crcTable=this.crcTable||this.createCrcTable();for(var b=-1,c=0;c<a.length;c++)b=b>>>8^this.crcTable[(b^a.charCodeAt(c))&
|
|
|
|
|
255];return(b^-1)>>>0};EditorUi.prototype.writeGraphModelToPng=function(a,b,c,d,e){function f(a,b){var c=l;l+=b;return a.substring(c,l)}function g(a){a=f(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function k(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 l=0;if(f(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=e&&e();else if(f(a,
|
|
|
|
|
4),"IHDR"!=f(a,4))null!=e&&e();else{f(a,17);e=a.substring(0,l);do{var m=g(a);if("IDAT"==f(a,4)){e=a.substring(0,l-8);c=c+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+d;d=4294967295;d=this.updateCRC(d,b,0,4);d=this.updateCRC(d,c,0,c.length);e+=k(c.length)+b+c+k(d^4294967295);e+=a.substring(l-8,a.length);break}e+=a.substring(l-8,l-4+m);f(a,m);f(a,4)}while(m);return"data:image/png;base64,"+(window.btoa?btoa(e):Base64.encode(e,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){return Editor.extractGraphModelFromPng(a)};
|
|
|
|
|
EditorUi.prototype.loadImage=function(a,b,c){try{var d=new Image;d.onload=function(){b(d)};null!=c&&(d.onerror=c);d.src=a}catch(z){if(null!=c)c(z);else throw z;}};var k=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;b.getLinkTitle=function(b){return a.getLinkTitle(b)};b.customLinkClicked=function(b){var c=
|
|
|
|
|
!1;try{a.handleCustomLink(b),c=!0}catch(E){a.handleError(E)}return c};var c=this.clearDefaultStyle;this.clearDefaultStyle=function(){c.apply(this,arguments)};this.isOffline()||"undefined"===typeof window.EditDataDialog||(EditDataDialog.placeholderHelpLink="https://desk.draw.io/support/solutions/articles/16000051979");var d=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 d.apply(this,arguments)};var e=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)};e.call(this,a,c,d)};k.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 g=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:g.apply(this,
|
|
|
|
|
arguments)};var m=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))m.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 n=this.actions.get("print");
|
|
|
|
|
n.setEnabled(!mxClient.IS_IOS||!navigator.standalone);n.visible=n.isEnabled();if(!this.editor.chromeless||this.editor.editable){var q=function(){window.setTimeout(function(){v.innerHTML=" ";v.focus();document.execCommand("selectAll",!1,null)},0)};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");mxClient.IS_IE||b.container.addEventListener("paste",mxUtils.bind(this,function(a){var b=this.editor.graph;if(!mxEvent.isConsumed(a))try{for(var c=a.clipboardData||a.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 g=e[index];if("file"===
|
|
|
|
|
g.kind){if(b.isEditing())this.importFiles([g.getAsFile()],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]()});else{var k=this.editor.graph.getInsertPoint();this.importFiles([g.getAsFile()],k.x,k.y,this.maxImageSize);mxEvent.consume(a)}break}}}}catch(M){}}),!1);var v=document.createElement("div");v.setAttribute("autocomplete","off");v.setAttribute("autocorrect","off");v.setAttribute("autocapitalize",
|
|
|
|
|
"off");v.setAttribute("spellcheck","false");v.style.position="absolute";v.style.whiteSpace="nowrap";v.style.overflow="hidden";v.style.display="block";v.contentEditable=!0;mxUtils.setOpacity(v,0);v.style.width="1px";v.style.height="1px";v.innerHTML=" ";var B=!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)||B||(v.style.left=b.container.scrollLeft+10+"px",v.style.top=b.container.scrollTop+10+"px",b.container.appendChild(v),B=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){v.focus();document.execCommand("selectAll",!1,null)},0):(v.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(){!B||224!=c&&17!=c&&91!=c||(B=!1,b.isEditing()||null!=this.dialog||null==b.container||b.container.focus(),v.parentNode.removeChild(v),null==this.dialog&&mxUtils.clearSelection())}),0)}));mxEvent.addListener(v,"copy",mxUtils.bind(this,function(a){if(b.isEnabled())try{mxClipboard.copy(b),this.copyCells(v),q()}catch(I){this.handleError(I)}}));mxEvent.addListener(v,"cut",mxUtils.bind(this,function(a){if(b.isEnabled())try{mxClipboard.copy(b),
|
|
|
|
|
this.copyCells(v,!0),q()}catch(I){this.handleError(I)}}));mxEvent.addListener(v,"paste",mxUtils.bind(this,function(a){b.isEnabled()&&!b.isCellLocked(b.getDefaultParent())&&(v.innerHTML=" ",v.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,v);v.innerHTML=" "}),0))}),!0);var D=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==v?!0:D.apply(this,arguments)}}this.spinner=this.createSpinner(document.body.clientWidth/2-2,Math.max(document.body.clientHeight||
|
|
|
|
|
function(a){this.handleError(a)});var f=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.doImportVisio){var f=this.isRemoteVisioFormat(d);try{var e="UNKNOWN-VISIO",g=d.lastIndexOf(".");0<=g&&g<d.length&&(e=d.substring(g+1).toUpperCase());EditorUi.logEvent({category:e+"-MS-IMPORT-FILE",action:"filename_"+d,label:f?"remote":"local"})}catch(v){}if(f)if(null!=VSD_CONVERT_URL){f=new FormData;f.append("file1",a,d);var l=new XMLHttpRequest;l.open("POST",VSD_CONVERT_URL);l.responseType="blob";
|
|
|
|
|
this.addRemoteServiceSecurityCheck(l);l.onreadystatechange=mxUtils.bind(this,function(){if(4==l.readyState)if(200<=l.status&&299>=l.status)try{this.doImportVisio(l.response,b,c,d)}catch(v){c(v)}else c({})});l.send(f)}else c({message:"conf"==this.getServiceName()?mxResources.get("vsdNoConfig"):mxResources.get("serviceUnavailableOrBlocked")});else try{this.doImportVisio(a,b,c,d)}catch(v){c(v)}}else this.spinner.stop(),this.handleError({message:mxResources.get("serviceUnavailableOrBlocked")})});this.doImportVisio||
|
|
|
|
|
this.loadingExtensions||this.isOffline(!0)?f():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",f))};EditorUi.prototype.importGraphML=function(a,b,c){c=null!=c?c:mxUtils.bind(this,function(a){this.handleError(a)});var d=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.doImportGraphML)try{this.doImportGraphML(a,b,c)}catch(z){c(z)}else this.spinner.stop(),this.handleError({message:mxResources.get("serviceUnavailableOrBlocked")})});this.doImportGraphML||this.loadingExtensions||
|
|
|
|
|
this.isOffline(!0)?d():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",d))};EditorUi.prototype.exportVisio=function(){var a=mxUtils.bind(this,function(){this.loadingExtensions=!1;if("undefined"!==typeof VsdxExport)try{(new VsdxExport(this)).exportCurrentDiagrams()||this.handleError({message:mxResources.get("unknownError")})}catch(l){this.handleError(l)}else this.spinner.stop(),this.handleError({message:mxResources.get("serviceUnavailableOrBlocked")})});"undefined"!==typeof VsdxExport||
|
|
|
|
|
this.loadingExtensions||this.isOffline(!0)?a():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",a))};EditorUi.prototype.convertLucidChart=function(a,b,c){var d=mxUtils.bind(this,function(){this.loadingExtensions=!1;if("undefined"!==typeof window.LucidImporter){try{EditorUi.logEvent({category:"LUCIDCHART-IMPORT-FILE",action:"size_"+a.length})}catch(z){}try{b(LucidImporter.importState(JSON.parse(a)))}catch(z){c(z)}}else c({message:mxResources.get("serviceUnavailableOrBlocked")})});"undefined"!==
|
|
|
|
|
typeof window.LucidImporter||this.loadingExtensions||this.isOffline(!0)?window.setTimeout(d,0):(this.loadingExtensions=!0,"1"==urlParams.dev?mxscript("js/diagramly/Extensions.js",d):mxscript("js/extensions.min.js",d))};EditorUi.prototype.insertAsPreText=function(a,b,c){var d=this.editor.graph,f=null;d.getModel().beginUpdate();try{f=d.insertVertex(null,null,"<pre>"+a+"</pre>",b,c,1,1,"text;html=1;align=center;verticalAlign=middle;"),d.updateCellSize(f,!0)}finally{d.getModel().endUpdate()}return f};
|
|
|
|
|
EditorUi.prototype.insertTextAt=function(a,b,c,d,e,g,k){g=null!=g?g:!0;k=null!=k?k:!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,c,!0))}));else if("data:"==a.substring(0,5)||!this.isOffline()&&(e||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(a))){var f=
|
|
|
|
|
this.editor.graph;if("data:image/png;base64,"==a.substring(0,22)){var l=this.extractGraphModelFromPng(a),p=this.importXml(l,b,c,g,!0);if(0<p.length)return p}if("data:image/svg+xml;"==a.substring(0,19))try{if(l=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(l=a.substring(a.indexOf(",")+1),l=window.atob&&!mxClient.IS_SF?atob(l):Base64.decode(l,!0)):l=decodeURIComponent(a.substring(a.indexOf(",")+1)),p=this.importXml(l,b,c,g,!0),0<p.length)return p}catch(B){}this.loadImage(a,mxUtils.bind(this,
|
|
|
|
|
function(d){if("data:"==a.substring(0,5))this.resizeImage(d,a,mxUtils.bind(this,function(a,d,e){f.setSelectionCell(f.insertVertex(null,null,"",f.snap(b),f.snap(c),d,e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(a)+";"))}),k,this.maxImageSize);else{var e=Math.min(1,Math.min(this.maxImageSize/d.width,this.maxImageSize/d.height)),g=Math.round(d.width*e);d=Math.round(d.height*e);f.setSelectionCell(f.insertVertex(null,
|
|
|
|
|
null,"",f.snap(b),f.snap(c),g,d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";"))}}),mxUtils.bind(this,function(){var e=null;f.getModel().beginUpdate();try{e=f.insertVertex(f.getDefaultParent(),null,a,f.snap(b),f.snap(c),1,1,"text;"+(d?"html=1;":"")),f.updateCellSize(e),f.fireEvent(new mxEventObject("textInserted","cells",[e]))}finally{f.getModel().endUpdate()}f.setSelectionCell(e)}))}else{a=Graph.zapGremlins(mxUtils.trim(a));
|
|
|
|
|
if(this.isCompatibleString(a))return this.importXml(a,b,c,g);if(0<a.length)if(this.isLucidChartData(a))this.convertLucidChart(a,mxUtils.bind(this,function(a){this.editor.graph.setSelectionCells(this.importXml(a,b,c,g))}),mxUtils.bind(this,function(a){this.handleError(a)}));else{f=this.editor.graph;e=null;f.getModel().beginUpdate();try{e=f.insertVertex(f.getDefaultParent(),null,"",f.snap(b),f.snap(c),1,1,"text;"+(d?"html=1;":"")),f.fireEvent(new mxEventObject("textInserted","cells",[e])),"<"==a.charAt(0)&&
|
|
|
|
|
a.indexOf(">")==a.length-1&&(a=mxUtils.htmlEntities(a)),a.length>this.maxTextBytes&&(a=a.substring(0,this.maxTextBytes)+"..."),e.value=a,f.updateCellSize(e),/\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(e.value)&&f.setLinkForCell(e,e.value),e.geometry.width+=f.gridSize,e.geometry.height+=f.gridSize}finally{f.getModel().endUpdate()}return[e]}}return[]};
|
|
|
|
|
EditorUi.prototype.formatFileSize=function(a){var b=-1;do a/=1024,b++;while(1024<a);return Math.max(a,.1).toFixed(1)+" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[b]};EditorUi.prototype.convertDataUri=function(a){if("data:"==a.substring(0,5)){var b=a.indexOf(";");0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1)))}return a};EditorUi.prototype.isRemoteFileFormat=function(a,b){return/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(a)};EditorUi.prototype.isLucidChartData=function(a){return null!=
|
|
|
|
|
a&&('{"state":"{\\"Properties\\":'==a.substring(0,26)||'{"Properties":'==a.substring(0,14))};EditorUi.prototype.importLocalFile=function(a,b){if(a&&Graph.fileSupport){if(null==this.importFileInputElt){var c=document.createElement("input");c.setAttribute("type","file");mxEvent.addListener(c,"change",mxUtils.bind(this,function(){null!=c.files&&(this.importFiles(c.files,null,null,this.maxImageSize),c.type="",c.type="file",c.value="")}));c.style.display="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,b){if(null!=b&&Graph.fileSupport&&/(\.v(dx|sdx?))($|\?)/i.test(b)){var c=new Blob([a],{type:"application/octet-stream"});this.importVisio(c,mxUtils.bind(this,function(a){this.importXml(a,0,0,!0)}),null,b)}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.importFile=function(a,b,c,d,e,g,k,m,n,v,B){v=null!=v?v:!0;var f=!1,l=null,p=mxUtils.bind(this,function(a){var b=null;null!=a&&"<mxlibrary"==a.substring(0,10)?this.loadLibrary(new LocalLibrary(this,
|
|
|
|
|
a,k)):b=this.importXml(a,c,d,v);null!=m&&m(b)});"image"==b.substring(0,5)?(n=!1,"image/png"==b.substring(0,9)&&(b=B?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(l=this.importXml(b,c,d,v),n=!0)),n||(l=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1))),v&&l.isGridEnabled()&&(c=l.snap(c),d=l.snap(d)),l=[l.insertVertex(null,null,"",c,d,e,g,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
|
|
|
|
a+";")])):/(\.*<graphml )/.test(a)?(f=!0,this.importGraphML(a,p)):null!=n&&null!=k&&(/(\.v(dx|sdx?))($|\?)/i.test(k)||/(\.vs(x|sx?))($|\?)/i.test(k))?(f=!0,this.importVisio(n,p)):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,k)?(f=!0,this.parseFile(null!=n?n:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&(200<=a.status&&299>=a.status?p(a.responseText):null!=m&&m(null))}),k)):/(\.v(sd|dx))($|\?)/i.test(k)||/(\.vs(s|x))($|\?)/i.test(k)||
|
|
|
|
|
(l=this.insertTextAt(this.validateFileData(a),c,d,!0,null,v));f||null==m||m(l);return l};EditorUi.prototype.base64Encode=function(a){for(var b="",c=0,d=a.length,f,e,g;c<d;){f=a.charCodeAt(c++)&255;if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4);b+="==";break}e=a.charCodeAt(c++);if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);
|
|
|
|
|
b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(e&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&15)<<2);b+="=";break}g=a.charCodeAt(c++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(e&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&15)<<2|(g&192)>>6);b+=
|
|
|
|
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g&63)}return b};EditorUi.prototype.importFiles=function(a,b,c,d,e,g,k,m,n,v,B,q){b=null!=b?b:0;c=null!=c?c:0;d=null!=d?d:this.maxImageSize;v=null!=v?v:this.maxImageBytes;var f=null!=b&&null!=c,l=!0,p=!1;if(!mxClient.IS_CHROMEAPP&&null!=a)for(var t=B||this.resampleThreshold,u=0;u<a.length;u++)if("image/"==a[u].type.substring(0,6)&&a[u].size>t){p=!0;break}var D=mxUtils.bind(this,function(){var p=this.editor.graph,n=p.gridSize;
|
|
|
|
|
e=null!=e?e:mxUtils.bind(this,function(a,b,c,d,e,g,k,l,p){return null!=a&&"<mxlibrary"==a.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,a,k)),null):this.importFile(a,b,c,d,e,g,k,l,p,f,q)});g=null!=g?g:mxUtils.bind(this,function(a){p.setSelectionCells(a)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var t=a.length,u=t,y=[],D=mxUtils.bind(this,function(a,b){y[a]=b;if(0==--u){this.spinner.stop();if(null!=m)m(y);else{var c=[];p.getModel().beginUpdate();
|
|
|
|
|
try{for(var d=0;d<y.length;d++){var f=y[d]();null!=f&&(c=c.concat(f))}}finally{p.getModel().endUpdate()}}g(c)}}),z=0;z<t;z++)mxUtils.bind(this,function(f){var g=a[f];if(null!=g){var m=new FileReader;m.onload=mxUtils.bind(this,function(a){if(null==k||k(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var m=a.target.result,t=m.indexOf(","),u=decodeURIComponent(escape(atob(m.substring(t+1)))),y=mxUtils.parseXml(u),u=y.getElementsByTagName("svg");if(0<u.length){var u=u[0],
|
|
|
|
|
z=q?null:u.getAttribute("content");null!=z&&"<"!=z.charAt(0)&&"%"!=z.charAt(0)&&(z=unescape(window.atob?atob(z):Base64.decode(z,!0)));null!=z&&"%"==z.charAt(0)&&(z=decodeURIComponent(z));null==z||"<mxfile "!==z.substring(0,8)&&"<mxGraphModel "!==z.substring(0,14)?D(f,mxUtils.bind(this,function(){try{if(m.substring(0,t+1),null!=y){var a=y.getElementsByTagName("svg");if(0<a.length){var k=a[0],l=parseFloat(k.getAttribute("width")),v=parseFloat(k.getAttribute("height")),B=k.getAttribute("viewBox");if(null==
|
|
|
|
|
B||0==B.length)k.setAttribute("viewBox","0 0 "+l+" "+v);else if(isNaN(l)||isNaN(v)){var u=B.split(" ");3<u.length&&(l=parseFloat(u[2]),v=parseFloat(u[3]))}m=this.createSvgDataUri(mxUtils.getXml(k));var q=Math.min(1,Math.min(d/Math.max(1,l)),d/Math.max(1,v)),D=e(m,g.type,b+f*n,c+f*n,Math.max(1,Math.round(l*q)),Math.max(1,Math.round(v*q)),g.name);if(isNaN(l)||isNaN(v)){var z=new Image;z.onload=mxUtils.bind(this,function(){l=Math.max(1,z.width);v=Math.max(1,z.height);D[0].geometry.width=l;D[0].geometry.height=
|
|
|
|
|
v;k.setAttribute("viewBox","0 0 "+l+" "+v);m=this.createSvgDataUri(mxUtils.getXml(k));var a=m.indexOf(";");0<a&&(m=m.substring(0,a)+m.substring(m.indexOf(",",a+1)));p.setCellStyles("image",m,[D[0]])});z.src=this.createSvgDataUri(mxUtils.getXml(k))}return D}}}catch(ga){}return null})):D(f,mxUtils.bind(this,function(){return e(z,"text/xml",b+f*n,c+f*n,0,0,g.name)}))}else D(f,mxUtils.bind(this,function(){return null}))}else{u=!1;if("image/png"==g.type){var x=q?null:this.extractGraphModelFromPng(a.target.result);
|
|
|
|
|
if(null!=x&&0<x.length){var E=new Image;E.src=a.target.result;D(f,mxUtils.bind(this,function(){return e(x,"text/xml",b+f*n,c+f*n,E.width,E.height,g.name)}));u=!0}}u||(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(k){this.resizeImage(k,
|
|
|
|
|
a.target.result,mxUtils.bind(this,function(k,p,m){D(f,mxUtils.bind(this,function(){if(null!=k&&k.length<v){var t=l&&this.isResampleImage(a.target.result,B)?Math.min(1,Math.min(d/p,d/m)):1;return e(k,g.type,b+f*n,c+f*n,Math.round(p*t),Math.round(m*t),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),l,d,B)}),mxUtils.bind(this,function(){this.handleError({message:mxResources.get("invalidOrMissingFile")})})))}else e(a.target.result,g.type,b+f*n,c+f*n,240,160,g.name,
|
|
|
|
|
function(a){D(f,function(){return a})})});/(\.v(dx|sdx?))($|\?)/i.test(g.name)||/(\.vs(x|sx?))($|\?)/i.test(g.name)?e(null,g.type,b+f*n,c+f*n,240,160,g.name,function(a){D(f,function(){return a})},g):"image"==g.type.substring(0,5)?m.readAsDataURL(g):m.readAsText(g)}})(z)});if(p){p=[];for(u=0;u<a.length;u++)p.push(a[u]);a=p;this.confirmImageResize(function(a){l=a;D()},n)}else D()};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,c){c=null!=c?c:a.name;var d=new FormData;d.append("format","xml");d.append("upfile",a,c);var f=new XMLHttpRequest;f.open("POST",OPEN_URL);f.onreadystatechange=function(){b(f)};f.send(d);try{EditorUi.logEvent({category:"GLIFFY-IMPORT-FILE",action:"size_"+a.size})}catch(t){}};EditorUi.prototype.isResampleImage=function(a,b){b=null!=b?b:this.resampleThreshold;return a.length>b};EditorUi.prototype.resizeImage=
|
|
|
|
|
function(a,b,c,d,e,g){e=null!=e?e:this.maxImageSize;var f=Math.max(1,a.width),k=Math.max(1,a.height);if(d&&this.isResampleImage(b,g))try{var l=Math.max(f/e,k/e);if(1<l){var p=Math.round(f/l),m=Math.round(k/l),n=document.createElement("canvas");n.width=p;n.height=m;n.getContext("2d").drawImage(a,0,0,p,m);var t=n.toDataURL();if(t.length<b.length){var q=document.createElement("canvas");q.width=p;q.height=m;var u=q.toDataURL();t!==u&&(b=t,f=p,k=m)}}}catch(F){}c(b,f,k)};EditorUi.prototype.crcTable=[];
|
|
|
|
|
for(var d=0;256>d;d++)for(var g=d,e=0;8>e;e++)g=1==(g&1)?3988292384^g>>>1:g>>>1,EditorUi.prototype.crcTable[d]=g;EditorUi.prototype.updateCRC=function(a,b,c,d){for(var f=0;f<d;f++)a=EditorUi.prototype.crcTable[(a^b.charCodeAt(c+f))&255]^a>>>8;return a};EditorUi.prototype.crc32=function(a){this.crcTable=this.crcTable||this.createCrcTable();for(var b=-1,c=0;c<a.length;c++)b=b>>>8^this.crcTable[(b^a.charCodeAt(c))&255];return(b^-1)>>>0};EditorUi.prototype.writeGraphModelToPng=function(a,b,c,d,e){function f(a,
|
|
|
|
|
b){var c=l;l+=b;return a.substring(c,l)}function g(a){a=f(a,4);return a.charCodeAt(3)+(a.charCodeAt(2)<<8)+(a.charCodeAt(1)<<16)+(a.charCodeAt(0)<<24)}function k(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 l=0;if(f(a,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=e&&e();else if(f(a,4),"IHDR"!=f(a,4))null!=e&&e();else{f(a,17);e=a.substring(0,l);do{var p=g(a);if("IDAT"==f(a,
|
|
|
|
|
4)){e=a.substring(0,l-8);c=c+String.fromCharCode(0)+("zTXt"==b?String.fromCharCode(0):"")+d;d=4294967295;d=this.updateCRC(d,b,0,4);d=this.updateCRC(d,c,0,c.length);e+=k(c.length)+b+c+k(d^4294967295);e+=a.substring(l-8,a.length);break}e+=a.substring(l-8,l-4+p);f(a,p);f(a,4)}while(p);return"data:image/png;base64,"+(window.btoa?btoa(e):Base64.encode(e,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(a){return Editor.extractGraphModelFromPng(a)};EditorUi.prototype.loadImage=function(a,b,c){try{var d=
|
|
|
|
|
new Image;d.onload=function(){b(d)};null!=c&&(d.onerror=c);d.src=a}catch(z){if(null!=c)c(z);else throw z;}};var k=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;b.getLinkTitle=function(b){return a.getLinkTitle(b)};b.customLinkClicked=function(b){var c=!1;try{a.handleCustomLink(b),c=!0}catch(E){a.handleError(E)}return c};
|
|
|
|
|
var c=this.clearDefaultStyle;this.clearDefaultStyle=function(){c.apply(this,arguments)};this.isOffline()||"undefined"===typeof window.EditDataDialog||(EditDataDialog.placeholderHelpLink="https://desk.draw.io/support/solutions/articles/16000051979");var d=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 d.apply(this,arguments)};var e=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)};e.call(this,a,c,d)};k.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 g=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:g.apply(this,arguments)};var m=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))m.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 n=this.actions.get("print");n.setEnabled(!mxClient.IS_IOS||!navigator.standalone);n.visible=n.isEnabled();
|
|
|
|
|
if(!this.editor.chromeless||this.editor.editable){var q=function(){window.setTimeout(function(){v.innerHTML=" ";v.focus();document.execCommand("selectAll",!1,null)},0)};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");mxClient.IS_IE||b.container.addEventListener("paste",mxUtils.bind(this,function(a){var b=this.editor.graph;if(!mxEvent.isConsumed(a))try{for(var c=a.clipboardData||a.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 g=e[index];if("file"===g.kind){if(b.isEditing())this.importFiles([g.getAsFile()],
|
|
|
|
|
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]()});else{var k=this.editor.graph.getInsertPoint();this.importFiles([g.getAsFile()],k.x,k.y,this.maxImageSize);mxEvent.consume(a)}break}}}}catch(M){}}),!1);var v=document.createElement("div");v.setAttribute("autocomplete","off");v.setAttribute("autocorrect","off");v.setAttribute("autocapitalize","off");v.setAttribute("spellcheck",
|
|
|
|
|
"false");v.style.position="absolute";v.style.whiteSpace="nowrap";v.style.overflow="hidden";v.style.display="block";v.contentEditable=!0;mxUtils.setOpacity(v,0);v.style.width="1px";v.style.height="1px";v.innerHTML=" ";var B=!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)||B||(v.style.left=b.container.scrollLeft+10+"px",v.style.top=b.container.scrollTop+10+"px",b.container.appendChild(v),B=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){v.focus();document.execCommand("selectAll",!1,null)},0):(v.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(){!B||224!=c&&17!=c&&91!=c||(B=!1,b.isEditing()||null!=this.dialog||null==b.container||b.container.focus(),v.parentNode.removeChild(v),null==this.dialog&&mxUtils.clearSelection())}),0)}));mxEvent.addListener(v,"copy",mxUtils.bind(this,function(a){if(b.isEnabled())try{mxClipboard.copy(b),this.copyCells(v),q()}catch(I){this.handleError(I)}}));mxEvent.addListener(v,"cut",mxUtils.bind(this,function(a){if(b.isEnabled())try{mxClipboard.copy(b),this.copyCells(v,
|
|
|
|
|
!0),q()}catch(I){this.handleError(I)}}));mxEvent.addListener(v,"paste",mxUtils.bind(this,function(a){b.isEnabled()&&!b.isCellLocked(b.getDefaultParent())&&(v.innerHTML=" ",v.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,v);v.innerHTML=" "}),0))}),!0);var D=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==v?!0:D.apply(this,arguments)}}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,
|
|
|
|
@ -8704,43 +8705,43 @@ document.createElement("input"),this.styleInput.setAttribute("type","text"),this
|
|
|
|
|
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 H=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:H.apply(this,arguments)}}n=document.getElementById("geInfo");
|
|
|
|
|
null!=n&&n.parentNode.removeChild(n);if(Graph.fileSupport&&(!this.editor.chromeless||this.editor.editable)){var F=null;mxEvent.addListener(b.container,"dragleave",function(a){b.isEnabled()&&(null!=F&&(F.parentNode.removeChild(F),F=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(b.container,"dragover",mxUtils.bind(this,function(a){null==F&&(!mxClient.IS_IE||10<document.documentMode)&&(F=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!=F&&(F.parentNode.removeChild(F),F=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 k=
|
|
|
|
|
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 l=a.dataTransfer.getData("text/html"),c=document.createElement("div");c.innerHTML=l;var m=null,d=c.getElementsByTagName("img");null!=d&&1==d.length?(l=d[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(l)||(m=
|
|
|
|
|
!0)):(c=c.getElementsByTagName("a"),null!=c&&1==c.length&&(l=c[0].getAttribute("href")));var n=!0,p=mxUtils.bind(this,function(){b.setSelectionCells(this.insertTextAt(l,e,g,!0,m,null,n))});m&&l.length>this.resampleThreshold?this.confirmImageResize(function(a){n=a;p()},mxEvent.isControlDown(a)):p()}else null!=k&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)?this.loadImage(decodeURIComponent(k),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,
|
|
|
|
|
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 l=a.dataTransfer.getData("text/html"),c=document.createElement("div");c.innerHTML=l;var p=null,d=c.getElementsByTagName("img");null!=d&&1==d.length?(l=d[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(l)||(p=
|
|
|
|
|
!0)):(c=c.getElementsByTagName("a"),null!=c&&1==c.length&&(l=c[0].getAttribute("href")));var m=!0,n=mxUtils.bind(this,function(){b.setSelectionCells(this.insertTextAt(l,e,g,!0,p,null,m))});p&&l.length>this.resampleThreshold?this.confirmImageResize(function(a){m=a;n()},mxEvent.isControlDown(a)):n()}else null!=k&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(k)?this.loadImage(decodeURIComponent(k),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="+k+";"))}),mxUtils.bind(this,function(a){b.setSelectionCells(this.insertTextAt(k,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.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();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();this.addListener("gridColorChanged",mxUtils.bind(this,function(a,b){mxSettings.setGridColor(this.editor.graph.view.gridColor);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())),e=mxUtils.getXml(this.editor.graph.encodeCells(d));
|
|
|
|
|
mxUtils.setTextContent(a,encodeURIComponent(e));b?(c.removeCells(d,!1),c.lastPasteXml=null):(c.lastPasteXml=e,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,e=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(b):b.textContent),f=!1;try{var g=e.lastIndexOf("%3E");0<=g&&g<e.length-3&&(e=e.substring(0,g+3))}catch(C){}try{var c=b.getElementsByTagName("span"),k=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):
|
|
|
|
|
decodeURIComponent(e);this.isCompatibleString(k)&&(f=!0,e=k)}catch(C){}d.lastPasteXml==e?d.pasteCounter++:(d.lastPasteXml=e,d.pasteCounter=0);c=d.pasteCounter*d.gridSize;if(null!=e&&0<e.length&&(f||this.isCompatibleString(e)?d.setSelectionCells(this.importXml(e,c,c)):(f=d.getInsertPoint(),d.isMouseInsertPoint()&&(c=0,d.lastPasteXml==e&&0<d.pasteCounter&&d.pasteCounter--),d.setSelectionCells(this.insertTextAt(e,f.x+c,f.y+c,!0))),!d.isSelectionEmpty())){d.scrollCellToVisible(d.getSelectionCell());null!=
|
|
|
|
|
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 g=f.lastIndexOf("%3E");0<=g&&g<f.length-3&&(f=f.substring(0,g+3))}catch(C){}try{var c=b.getElementsByTagName("span"),k=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):
|
|
|
|
|
decodeURIComponent(f);this.isCompatibleString(k)&&(e=!0,f=k)}catch(C){}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(C){}}}}};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 f=document.documentElement;d=(e.clientWidth||f.clientWidth)-3;e=Math.max(e.clientHeight||0,f.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,
|
|
|
|
|
e=a.clientHeight;f=document.createElement("div");f.style.zIndex=mxPopupMenu.prototype.zIndex+2;f.style.border="3px dotted rgb(254, 137, 12)";f.style.pointerEvents="none";f.style.position="absolute";f.style.top=b+"px";f.style.left=c+"px";f.style.width=Math.max(0,d-3)+"px";f.style.height=Math.max(0,e-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(f):document.body.appendChild(f);return f};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,e=a.name;if(null!=
|
|
|
|
|
e&&0<e.length){!this.useCanvasForExport&&/(\.png)$/i.test(e)&&(e=e.substring(0,e.length-4)+".drawio");var f=mxUtils.bind(this,function(a){e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".drawio":e+".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,e))}catch(B){this.handleError(B,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,
|
|
|
|
|
e,b)});if(/(\.v(dx|sdx?))($|\?)/i.test(e)||/(\.vs(x|sx?))($|\?)/i.test(e))this.importVisio(a,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(/(\.*<graphml )/.test(d))this.importGraphML(d,mxUtils.bind(this,function(a){this.spinner.stop();f(a)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(d,e))this.parseFile(a,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?f(a.responseText):this.handleError({message:mxResources.get(413==
|
|
|
|
|
a.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))}));else if(this.isLucidChartData(d))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".drawio"),this.convertLucidChart(d,mxUtils.bind(this,function(a){this.spinner.stop();this.openLocalFile(a,e,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(v){this.handleError(v,mxResources.get("errorLoadingFile"))}}else"image/png"==a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)}}catch(v){this.handleError(v)}});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,c){var d=this.getCurrentFile(),e=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var d=mxUtils.parseXml(a);null!=d&&(this.editor.setGraphXml(d.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,c))});if(null!=a&&0<a.length)null==d||!d.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?e():
|
|
|
|
|
(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&null!=d&&d.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,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!=d&&d.isModified()?this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges")):e()})));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=[],c;for(c in a)b.push(c);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,e=d.getCellStyle(a);
|
|
|
|
|
c(mxStencilRegistry.getBasenameForStencil(e[mxConstants.STYLE_SHAPE]));d.model.isEdge(a)&&(c(mxMarker.getPackageForType(e[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(e[mxConstants.STYLE_ENDARROW])));for(var e=d.model.getChildCount(a),f=0;f<e;f++)this.addBasenamesForCell(d.model.getChildAt(a,f),b)};EditorUi.prototype.setGraphEnabled=function(a){this.diagramContainer.style.visibility=a?"":"hidden";this.formatContainer.style.visibility=a?"":"hidden";this.sidebarFooterContainer.style.display=
|
|
|
|
|
"#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,f;if(null==a){f=document.body;var e=document.documentElement;d=(f.clientWidth||e.clientWidth)-3;f=Math.max(f.clientHeight||0,e.clientHeight)-3}else b=a.offsetTop,c=a.offsetLeft,d=a.clientWidth,
|
|
|
|
|
f=a.clientHeight;e=document.createElement("div");e.style.zIndex=mxPopupMenu.prototype.zIndex+2;e.style.border="3px dotted rgb(254, 137, 12)";e.style.pointerEvents="none";e.style.position="absolute";e.style.top=b+"px";e.style.left=c+"px";e.style.width=Math.max(0,d-3)+"px";e.style.height=Math.max(0,f-3)+"px";null!=a&&a.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(e):document.body.appendChild(e);return e};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(B){this.handleError(B,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(v){this.handleError(v,mxResources.get("errorLoadingFile"))}}else"image/png"==a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,f,b)}}catch(v){this.handleError(v)}});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,c){var d=this.getCurrentFile(),f=mxUtils.bind(this,function(){window.openFile=null;if(null==b&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var d=mxUtils.parseXml(a);null!=d&&(this.editor.setGraphXml(d.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,a,b||this.defaultFilename,c))});if(null!=a&&0<a.length)null==d||!d.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?f():
|
|
|
|
|
(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&null!=d&&d.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!=d&&d.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=[],c;for(c in a)b.push(c);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.tabContainer&&(this.tabContainer.style.visibility=a?"":"hidden");a||(null!=this.actions.outlineWindow&&this.actions.outlineWindow.window.setVisible(!1),null!=this.actions.layersWindow&&this.actions.layersWindow.window.setVisible(!1),null!=this.menus.tagsWindow&&this.menus.tagsWindow.window.setVisible(!1),null!=this.menus.findWindow&&this.menus.findWindow.window.setVisible(!1))};
|
|
|
|
|
EditorUi.prototype.initializeEmbedMode=function(){this.setGraphEnabled(!1);(window.opener||window.parent)!=window&&("1"!=urlParams.spin||this.spinner.spin(document.body,mxResources.get("loading")))&&this.installMessageHandler(mxUtils.bind(this,function(a,b,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=a&&0<a.length?(this.setFileData(a),this.editor.isChromelessView()?this.editor.graph.isLightboxView()&&this.lightboxFit():this.showLayersDialog(),this.chromelessResize&&
|
|
|
|
|
this.chromelessResize()):(this.editor.graph.model.clear(),this.editor.fireEvent(new mxEventObject("resetGraphView")));this.editor.undoManager.clear();this.editor.modified=null!=c?c:!1;this.updateUi();window.self!==window.top&&window.focus();null!=this.format&&this.format.refresh()}))};EditorUi.prototype.showLayersDialog=function(){1<this.editor.graph.getModel().getChildCount(this.editor.graph.getModel().getRoot())&&(null==this.actions.layersWindow?this.actions.get("layers").funct():this.actions.layersWindow.window.setVisible(!0))};
|
|
|
|
|
EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,bounds:b.getGraphBounds(),currentPage:this.getSelectedPageIndex(),scale:b.view.scale,page:b.view.getBackgroundPageBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,d=!1,e=null,f=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?
|
|
|
|
|
null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,f);mxEvent.addListener(window,"message",mxUtils.bind(this,function(f){if(f.source==(window.opener||window.parent)){var k=f.data,l=mxUtils.bind(this,function(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/png;base64,"==a.substring(0,22)?a=this.extractGraphModelFromPng(a):"data:image/svg+xml;base64,"==
|
|
|
|
|
EditorUi.prototype.getPublicUrl=function(a,b){null!=a?a.getPublicUrl(b):b(null)};EditorUi.prototype.createLoadMessage=function(a){var b=this.editor.graph;return{event:a,pageVisible:b.pageVisible,translate:b.view.translate,bounds:b.getGraphBounds(),currentPage:this.getSelectedPageIndex(),scale:b.view.scale,page:b.view.getBackgroundPageBounds()}};EditorUi.prototype.installMessageHandler=function(a){var b=null,c=!1,d=!1,f=null,e=mxUtils.bind(this,function(a,b){this.editor.modified&&"0"!=urlParams.modified?
|
|
|
|
|
null!=urlParams.modified&&this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(urlParams.modified))):this.editor.setStatus("")});this.editor.graph.model.addListener(mxEvent.CHANGE,e);mxEvent.addListener(window,"message",mxUtils.bind(this,function(e){if(e.source==(window.opener||window.parent)){var k=e.data,l=mxUtils.bind(this,function(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"data:image/png;base64,"==a.substring(0,22)?a=this.extractGraphModelFromPng(a):"data:image/svg+xml;base64,"==
|
|
|
|
|
a.substring(0,26)?a=atob(a.substring(26)):"data:image/svg+xml;utf8,"==a.substring(0,24)&&(a=a.substring(24)),null!=a&&("%"==a.charAt(0)?a=decodeURIComponent(a):"<"!=a.charAt(0)&&(a=Graph.decompress(a)))}catch(R){}return a});if("json"==urlParams.proto){try{k=JSON.parse(k)}catch(K){k=null}if(null==k)return;if("dialog"==k.action){this.showError(null!=k.titleKey?mxResources.get(k.titleKey):k.title,null!=k.messageKey?mxResources.get(k.messageKey):k.message,null!=k.buttonKey?mxResources.get(k.buttonKey):
|
|
|
|
|
k.button);null!=k.modified&&(this.editor.modified=k.modified);return}if("prompt"==k.action){this.spinner.stop();l=new FilenameDialog(this,k.defaultValue||"",null!=k.okKey?mxResources.get(k.okKey):null,function(a){null!=a&&g.postMessage(JSON.stringify({event:"prompt",value:a,message:k}),"*")},null!=k.titleKey?mxResources.get(k.titleKey):k.title);this.showDialog(l.container,300,80,!0,!1);l.init();return}if("draft"==k.action){var m=l(k.xml);this.spinner.stop();l=new DraftDialog(this,mxResources.get("draftFound",
|
|
|
|
|
[k.name||this.defaultFilename]),m,mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"edit",message:k}),"*")}),mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"discard",message:k}),"*")}),k.editKey?mxResources.get(k.editKey):null,k.discardKey?mxResources.get(k.discardKey):null,k.ignore?mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"ignore",message:k}),
|
|
|
|
|
"*")}):null);this.showDialog(l.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{l.init()}catch(K){g.postMessage(JSON.stringify({event:"draft",error:K.toString(),message:k}),"*")}return}if("template"==k.action){this.spinner.stop();var l=1==k.enableRecent,m=1==k.enableSearch,n=1==k.enableCustomTemp,l=new NewDialog(this,!1,null!=k.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=k.callback?g.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){g.postMessage(JSON.stringify({event:"template",
|
|
|
|
|
xml:b,blank:b==this.emptyDiagramXml,name:c}),"*"):(a(b,e,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){g.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"==k.action){l=this.getDiagramTextContent();g.postMessage(JSON.stringify({event:"textContent",data:l,message:k}),"*");return}if("status"==k.action){null!=k.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(k.messageKey))):
|
|
|
|
|
null!=k.message&&this.editor.setStatus(mxUtils.htmlEntities(k.message));null!=k.modified&&(this.editor.modified=k.modified);return}if("spinner"==k.action){var p=null!=k.messageKey?mxResources.get(k.messageKey):k.message;null==k.show||k.show?this.spinner.spin(document.body,p):this.spinner.stop();return}if("export"==k.action){if("png"==k.format||"xmlpng"==k.format){if(null==k.spin&&null==k.spinKey||this.spinner.spin(document.body,null!=k.spinKey?mxResources.get(k.spinKey):k.spin)){var t=null!=k.xml?
|
|
|
|
|
k.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var q=this.editor.graph,u=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=k.format;b.message=k;b.data=a;b.xml=encodeURIComponent(t);g.postMessage(JSON.stringify(b),"*")}),z=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==k.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(Graph.compress(t))));q!=this.editor.graph&&q.container.parentNode.removeChild(q.container);
|
|
|
|
@ -8750,11 +8751,11 @@ null!=this.pages&&1<this.pages.length))l=this.getXmlFileData(),p.xml=mxUtils.get
|
|
|
|
|
k.spinKey||this.spinner.spin(document.body,null!=k.spinKey?mxResources.get(k.spinKey):k.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==k.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);g.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));
|
|
|
|
|
g.postMessage(JSON.stringify(p),"*")}));return}l="xmlsvg"==k.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(l));p.data=this.createSvgDataUri(l)}g.postMessage(JSON.stringify(p),"*")}return}if("load"==k.action)d=1==k.autosave,this.hideDialog(),null!=k.modified&&null==urlParams.modified&&(urlParams.modified=k.modified),null!=k.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=k.saveAndExit),null!=k.title&&null!=this.buttonContainer&&
|
|
|
|
|
(m=document.createElement("span"),mxUtils.write(m,k.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="6px",this.buttonContainer.style.right="25px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(m),this.embedFilenameSpan=m),k=null!=k.xmlpng?this.extractGraphModelFromPng(k.xmlpng):
|
|
|
|
|
k.xml;else{"remoteInvokeReady"==k.action?this.handleRemoteInvokeReady(g):"remoteInvoke"==k.action?this.handleRemoteInvoke(k):"remoteInvokeResponse"==k.action?this.handleRemoteInvokeResponse(k):g.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(k)}),"*");return}}var A=mxUtils.bind(this,function(f,k){c=!0;try{a(f,k)}catch(Y){this.handleError(Y)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var l=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&
|
|
|
|
|
1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=l();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=l();if(d!=e&&!c){var f=this.createLoadMessage("autosave");f.xml=d;d=JSON.stringify(f);(window.opener||window.parent).postMessage(d,"*")}e=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",
|
|
|
|
|
k.xml;else{"remoteInvokeReady"==k.action?this.handleRemoteInvokeReady(g):"remoteInvoke"==k.action?this.handleRemoteInvoke(k):"remoteInvokeResponse"==k.action?this.handleRemoteInvokeResponse(k):g.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(k)}),"*");return}}var A=mxUtils.bind(this,function(e,k){c=!0;try{a(e,k)}catch(Y){this.handleError(Y)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var l=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&
|
|
|
|
|
1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});f=l();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=l();if(d!=f&&!c){var e=this.createLoadMessage("autosave");e.xml=d;d=JSON.stringify(e);(window.opener||window.parent).postMessage(d,"*")}f=d}),this.editor.graph.model.addListener(mxEvent.CHANGE,b),this.editor.graph.addListener("gridSizeChanged",b),this.editor.graph.addListener("shadowVisibleChanged",b),this.addListener("pageFormatChanged",b),this.addListener("pageScaleChanged",
|
|
|
|
|
b),this.addListener("backgroundColorChanged",b),this.addListener("backgroundImageChanged",b),this.addListener("foldingEnabledChanged",b),this.addListener("mathEnabledChanged",b),this.addListener("gridEnabledChanged",b),this.addListener("guidesEnabledChanged",b),this.addListener("pageViewChanged",b));"1"!=urlParams.returnbounds&&"json"!=urlParams.proto||g.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")});null!=k&&"function"===typeof k.substring&&"data:application/vnd.visio;base64,"==
|
|
|
|
|
k.substring(0,34)?(l="0M8R4KGxGuE"==k.substring(34,45)?"raw.vsd":"raw.vsdx",this.importVisio(this.base64ToBlob(k.substring(k.indexOf(",")+1)),function(a){A(a,f)},mxUtils.bind(this,function(a){this.handleError(a)}),l)):null!=k&&"function"===typeof k.substring&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(k,"")?this.parseFile(new Blob([k],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&"<mxGraphModel"==a.responseText.substring(0,
|
|
|
|
|
13)&&A(a.responseText,f)}),""):null!=k&&"function"===typeof k.substring&&this.isLucidChartData(k)?this.convertLucidChart(k,mxUtils.bind(this,function(a){A(a)}),mxUtils.bind(this,function(a){this.handleError(a)})):(k=l(k),A(k,f))}}));var g=window.opener||window.parent,f="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";g.postMessage(f,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";
|
|
|
|
|
k.substring(0,34)?(l="0M8R4KGxGuE"==k.substring(34,45)?"raw.vsd":"raw.vsdx",this.importVisio(this.base64ToBlob(k.substring(k.indexOf(",")+1)),function(a){A(a,e)},mxUtils.bind(this,function(a){this.handleError(a)}),l)):null!=k&&"function"===typeof k.substring&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(k,"")?this.parseFile(new Blob([k],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&200<=a.status&&299>=a.status&&"<mxGraphModel"==a.responseText.substring(0,
|
|
|
|
|
13)&&A(a.responseText,e)}),""):null!=k&&"function"===typeof k.substring&&this.isLucidChartData(k)?this.convertLucidChart(k,mxUtils.bind(this,function(a){A(a)}),mxUtils.bind(this,function(a){this.handleError(a)})):(k=l(k),A(k,e))}}));var g=window.opener||window.parent,e="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";g.postMessage(e,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var a=document.createElement("div");a.style.display="inline-block";
|
|
|
|
|
a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=document.createElement("button");b.className="geBigButton";b.style.fontSize="12px";b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";"1"==urlParams.noSaveBtn?(mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),
|
|
|
|
|
a.appendChild(b)):(mxUtils.write(b,mxResources.get("save")),b.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)"),mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()})),a.appendChild(b),"1"==urlParams.saveAndExit&&(b=document.createElement("a"),mxUtils.write(b,mxResources.get("saveAndExit")),b.setAttribute("title",mxResources.get("saveAndExit")),b.style.fontSize="12px",b.style.marginLeft="6px",b.style.padding="4px",b.style.cursor="pointer",
|
|
|
|
|
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.style.fontSize="12px";b.style.marginLeft="6px";b.style.marginRight="20px";b.style.padding="4px";b.style.cursor="pointer";mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()}));a.appendChild(b);this.toolbar.container.appendChild(a);
|
|
|
|
@ -8804,7 +8805,7 @@ error:e});a=JSON.stringify({event:"remoteInvoke",funtionName:a,functionArgs:b,ms
|
|
|
|
|
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 f=this[c].apply(this,e);b([f])}}else b(null,"Invalid Call: "+c+" is not found.")}catch(A){b(null,"Invalid Call: An error occured, "+A.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,c){var d=this.getCurrentFile();null!=d?d.addComment(a,b,c):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)}})();
|
|
|
|
|
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,c,b,d,g,e){function k(){for(var a=C.getElementsByTagName("div"),b=0,c=0;c<a.length;c++)"none"!=a[c].style.display&&a[c].parentNode==C&&b++;v.style.display=0==b?"block":"none"}function m(a,b,c,d){function e(){b.removeChild(l);b.removeChild(m);g.style.display="block";f.style.display="block"}t={div:b,comment:a,saveCallback:c,deleteOnCancel:d};var f=b.querySelector(".geCommentTxt"),g=b.querySelector(".geCommentActionsList"),l=document.createElement("textarea");l.className=
|
|
|
|
|
"geCommentEditTxtArea";l.style.minHeight=f.offsetHeight+"px";l.value=a.content;b.insertBefore(l,f);var m=document.createElement("div");m.className="geCommentEditBtns";var n=mxUtils.button(mxResources.get("cancel"),function(){d?(b.parentNode.removeChild(b),k()):e();t=null});n.className="geCommentEditBtn";m.appendChild(n);var p=mxUtils.button(mxResources.get("save"),function(){f.innerHTML="";a.content=l.value;mxUtils.write(f,a.content);e();c(a);t=null});mxEvent.addListener(l,"keydown",mxUtils.bind(this,
|
|
|
|
|
function(a){mxEvent.isConsumed(a)||((mxEvent.isControlDown(a)||mxClient.IS_MAC&&mxEvent.isMetaDown(a))&&13==a.keyCode?(p.click(),mxEvent.consume(a)):27==a.keyCode&&(n.click(),mxEvent.consume(a)))}));p.focus();p.className="geCommentEditBtn gePrimaryBtn";m.appendChild(p);b.insertBefore(m,f);g.style.display="none";f.style.display="none";l.focus()}function n(b,c){c.innerHTML="";var d=a.timeSince(new Date(b.modifiedDate));null==d&&(d=mxResources.get("lessThanAMinute"));mxUtils.write(c,mxResources.get("timeAgo",
|
|
|
|
@ -8821,15 +8822,15 @@ v.style.cssText="display:none;padding-top:10px;text-align:center;";mxUtils.write
|
|
|
|
|
"none");if(!u){var D=x.cloneNode();D.innerHTML='<div class="geSprite geSprite-plus" style="display:inline-block;"></div>';D.setAttribute("title",mxResources.get("create")+"...");mxEvent.addListener(D,"click",function(b){function c(){m(d,e,function(b){q(e);a.addComment(b,function(a){b.id=a;J.push(b);l(e)},function(b){f(e);c();a.handleError(b,null,null,null,mxUtils.htmlEntities(mxResources.get("objectNotFound")))})},!0)}var d=a.newComment("",a.getCurrentUser()),e=p(d,J,null,0);c();b.preventDefault();
|
|
|
|
|
mxEvent.consume(b)});B.appendChild(D)}D=x.cloneNode();D.innerHTML='<img src="'+IMAGE_PATH+'/check.png" style="width: 16px; padding: 2px;">';D.setAttribute("title",mxResources.get("showResolved"));var y=!1;"dark"==uiTheme&&(D.style.filter="invert(100%)");mxEvent.addListener(D,"click",function(a){this.className=(y=!y)?"geButton geCheckedBtn":"geButton";H();a.preventDefault();mxEvent.consume(a)});B.appendChild(D);a.commentsRefreshNeeded()&&(D=x.cloneNode(),D.innerHTML='<img src="'+IMAGE_PATH+'/update16.png" style="width: 16px; padding: 2px;">',
|
|
|
|
|
D.setAttribute("title",mxResources.get("refresh")),"dark"==uiTheme&&(D.style.filter="invert(100%)"),mxEvent.addListener(D,"click",function(a){H();a.preventDefault();mxEvent.consume(a)}),B.appendChild(D));a.commentsSaveNeeded()&&(x=x.cloneNode(),x.innerHTML='<img src="'+IMAGE_PATH+'/save.png" style="width: 20px; padding: 2px;">',x.setAttribute("title",mxResources.get("save")),"dark"==uiTheme&&(x.style.filter="invert(100%)"),mxEvent.addListener(x,"click",function(a){e();a.preventDefault();mxEvent.consume(a)}),
|
|
|
|
|
B.appendChild(x));A.appendChild(B);var J=[],H=mxUtils.bind(this,function(){if(null!=t){t.div=t.div.cloneNode(!0);var b=t.div.querySelector(".geCommentEditTxtArea"),c=t.div.querySelector(".geCommentEditBtns");t.comment.content=b.value;b.parentNode.removeChild(b);c.parentNode.removeChild(c)}C.innerHTML='<div style="padding-top:10px;text-align:center;"><img src="'+IMAGE_PATH+'/spin.gif" valign="middle"> '+mxUtils.htmlEntities(mxResources.get("loading"))+"...</div>";z=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)});C.innerHTML="";C.appendChild(v);v.style.display="block";J=a;for(a=0;a<J.length;a++)b(J[a].replies),p(J[a],J,null,0,y);null!=t&&null==t.comment.id&&null==t.comment.pCommentId&&(C.appendChild(t.div),m(t.comment,t.div,t.saveCallback,t.deleteOnCancel))},
|
|
|
|
|
function(a){C.innerHTML=mxUtils.htmlEntities(mxResources.get("error")+(a&&a.message?": "+a.message:""))}):C.innerHTML=mxUtils.htmlEntities(mxResources.get("error"))});H();this.refreshComments=H;B=mxUtils.bind(this,function(){function a(b){var d=c[b.id];if(null!=d)for(n(b,d),d=0;null!=b.replies&&d<b.replies.length;d++)a(b.replies[d])}if(this.window.isVisible()){for(var b=C.querySelectorAll(".geCommentDate"),c={},d=0;d<b.length;d++){var e=b[d];c[e.getAttribute("data-commentId")]=e}for(d=0;d<J.length;d++)a(J[d])}});
|
|
|
|
|
setInterval(B,6E4);this.refreshCommentsTime=B;this.window=new mxWindow(mxResources.get("comments"),A,c,b,d,g,!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 F=mxUtils.bind(this,function(){var a=this.window.getX(),b=this.window.getY();this.window.setLocation(a,b)});mxEvent.addListener(window,"resize",F);this.destroy=function(){mxEvent.removeListener(window,"resize",F);this.window.destroy()}},
|
|
|
|
|
ConfirmDialog=function(a,c,b,d,g,e,k,m,n,q){var f=document.createElement("div");f.style.textAlign="center";var l=document.createElement("div");l.style.padding="6px";l.style.overflow="auto";l.style.maxHeight="44px";l.style.lineHeight="1.2em";mxClient.IS_QUIRKS&&(l.style.height="60px");mxUtils.write(l,c);f.appendChild(l);null!=q&&(l=document.createElement("div"),l.style.padding="6px 0 6px 0",c=document.createElement("img"),c.setAttribute("src",q),l.appendChild(c),f.appendChild(l));q=document.createElement("div");
|
|
|
|
|
q.style.textAlign="center";q.style.whiteSpace="nowrap";var p=document.createElement("input");p.setAttribute("type","checkbox");e=mxUtils.button(e||mxResources.get("cancel"),function(){a.hideDialog();null!=d&&d(p.checked)});e.className="geBtn";null!=m&&(e.innerHTML=m+"<br>"+e.innerHTML,e.style.paddingBottom="8px",e.style.paddingTop="8px",e.style.height="auto",e.style.width="40%");a.editor.cancelFirst&&q.appendChild(e);var u=mxUtils.button(g||mxResources.get("ok"),function(){a.hideDialog();null!=b&&
|
|
|
|
|
b(p.checked)});q.appendChild(u);null!=k?(u.innerHTML=k+"<br>"+u.innerHTML+"<br>",u.style.paddingBottom="8px",u.style.paddingTop="8px",u.style.height="auto",u.className="geBtn",u.style.width="40%"):u.className="geBtn gePrimaryBtn";a.editor.cancelFirst||q.appendChild(e);f.appendChild(q);n?(q.style.marginTop="10px",l=document.createElement("p"),l.style.marginTop="20px",l.appendChild(p),g=document.createElement("span"),mxUtils.write(g," "+mxResources.get("rememberThisSetting")),l.appendChild(g),f.appendChild(l),
|
|
|
|
|
mxEvent.addListener(g,"click",function(a){p.checked=!p.checked;mxEvent.consume(a)})):q.style.marginTop="12px";this.init=function(){u.focus()};this.container=f};EditorUi.DIFF_INSERT="i";EditorUi.DIFF_REMOVE="r";EditorUi.DIFF_UPDATE="u";EditorUi.prototype.codec=new mxCodec;EditorUi.prototype.viewStateProperties={background:!0,backgroundImage:!0,shadowVisible:!0,foldingEnabled:!0,pageScale:!0,mathEnabled:!0,pageFormat:!0};EditorUi.prototype.cellProperties={id:!0,value:!0,xmlValue:!0,vertex:!0,edge:!0,visible:!0,collapsed:!0,connectable:!0,parent:!0,children:!0,previous:!0,source:!0,target:!0,edges:!0,geometry:!0,style:!0,mxObjectId:!0,mxTransient:!0};
|
|
|
|
|
B.appendChild(x));A.appendChild(B);var J=[],H=mxUtils.bind(this,function(){this.hasError=!1;if(null!=t){t.div=t.div.cloneNode(!0);var b=t.div.querySelector(".geCommentEditTxtArea"),c=t.div.querySelector(".geCommentEditBtns");t.comment.content=b.value;b.parentNode.removeChild(b);c.parentNode.removeChild(c)}C.innerHTML='<div style="padding-top:10px;text-align:center;"><img src="'+IMAGE_PATH+'/spin.gif" valign="middle"> '+mxUtils.htmlEntities(mxResources.get("loading"))+"...</div>";z=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)});C.innerHTML="";C.appendChild(v);v.style.display="block";J=a;for(a=0;a<J.length;a++)b(J[a].replies),p(J[a],J,null,0,y);null!=t&&null==t.comment.id&&null==t.comment.pCommentId&&(C.appendChild(t.div),m(t.comment,t.div,t.saveCallback,
|
|
|
|
|
t.deleteOnCancel))},mxUtils.bind(this,function(a){C.innerHTML=mxUtils.htmlEntities(mxResources.get("error")+(a&&a.message?": "+a.message:""));this.hasError=!0})):C.innerHTML=mxUtils.htmlEntities(mxResources.get("error"))});H();this.refreshComments=H;B=mxUtils.bind(this,function(){function a(b){var d=c[b.id];if(null!=d)for(n(b,d),d=0;null!=b.replies&&d<b.replies.length;d++)a(b.replies[d])}if(this.window.isVisible()){for(var b=C.querySelectorAll(".geCommentDate"),c={},d=0;d<b.length;d++){var e=b[d];
|
|
|
|
|
c[e.getAttribute("data-commentId")]=e}for(d=0;d<J.length;d++)a(J[d])}});setInterval(B,6E4);this.refreshCommentsTime=B;this.window=new mxWindow(mxResources.get("comments"),A,c,b,d,g,!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 F=mxUtils.bind(this,function(){var a=this.window.getX(),b=this.window.getY();this.window.setLocation(a,b)});mxEvent.addListener(window,
|
|
|
|
|
"resize",F);this.destroy=function(){mxEvent.removeListener(window,"resize",F);this.window.destroy()}},ConfirmDialog=function(a,c,b,d,g,e,k,m,n,q){var f=document.createElement("div");f.style.textAlign="center";var l=document.createElement("div");l.style.padding="6px";l.style.overflow="auto";l.style.maxHeight="44px";l.style.lineHeight="1.2em";mxClient.IS_QUIRKS&&(l.style.height="60px");mxUtils.write(l,c);f.appendChild(l);null!=q&&(l=document.createElement("div"),l.style.padding="6px 0 6px 0",c=document.createElement("img"),
|
|
|
|
|
c.setAttribute("src",q),l.appendChild(c),f.appendChild(l));q=document.createElement("div");q.style.textAlign="center";q.style.whiteSpace="nowrap";var p=document.createElement("input");p.setAttribute("type","checkbox");e=mxUtils.button(e||mxResources.get("cancel"),function(){a.hideDialog();null!=d&&d(p.checked)});e.className="geBtn";null!=m&&(e.innerHTML=m+"<br>"+e.innerHTML,e.style.paddingBottom="8px",e.style.paddingTop="8px",e.style.height="auto",e.style.width="40%");a.editor.cancelFirst&&q.appendChild(e);
|
|
|
|
|
var u=mxUtils.button(g||mxResources.get("ok"),function(){a.hideDialog();null!=b&&b(p.checked)});q.appendChild(u);null!=k?(u.innerHTML=k+"<br>"+u.innerHTML+"<br>",u.style.paddingBottom="8px",u.style.paddingTop="8px",u.style.height="auto",u.className="geBtn",u.style.width="40%"):u.className="geBtn gePrimaryBtn";a.editor.cancelFirst||q.appendChild(e);f.appendChild(q);n?(q.style.marginTop="10px",l=document.createElement("p"),l.style.marginTop="20px",l.appendChild(p),g=document.createElement("span"),mxUtils.write(g,
|
|
|
|
|
" "+mxResources.get("rememberThisSetting")),l.appendChild(g),f.appendChild(l),mxEvent.addListener(g,"click",function(a){p.checked=!p.checked;mxEvent.consume(a)})):q.style.marginTop="12px";this.init=function(){u.focus()};this.container=f};EditorUi.DIFF_INSERT="i";EditorUi.DIFF_REMOVE="r";EditorUi.DIFF_UPDATE="u";EditorUi.prototype.codec=new mxCodec;EditorUi.prototype.viewStateProperties={background:!0,backgroundImage:!0,shadowVisible:!0,foldingEnabled:!0,pageScale:!0,mathEnabled:!0,pageFormat:!0};EditorUi.prototype.cellProperties={id:!0,value:!0,xmlValue:!0,vertex:!0,edge:!0,visible:!0,collapsed:!0,connectable:!0,parent:!0,children:!0,previous:!0,source:!0,target:!0,edges:!0,geometry:!0,style:!0,mxObjectId:!0,mxTransient:!0};
|
|
|
|
|
EditorUi.prototype.patchPages=function(a,c,b,d,g){var e={},k=[],m={},n={},q={},f={};if(null!=d&&null!=d[EditorUi.DIFF_UPDATE])for(var l in d[EditorUi.DIFF_UPDATE])e[l]=d[EditorUi.DIFF_UPDATE][l];if(null!=c[EditorUi.DIFF_REMOVE])for(d=0;d<c[EditorUi.DIFF_REMOVE].length;d++)n[c[EditorUi.DIFF_REMOVE][d]]=!0;if(null!=c[EditorUi.DIFF_INSERT])for(d=0;d<c[EditorUi.DIFF_INSERT].length;d++)m[c[EditorUi.DIFF_INSERT][d].previous]=c[EditorUi.DIFF_INSERT][d];if(null!=c[EditorUi.DIFF_UPDATE])for(l in c[EditorUi.DIFF_UPDATE])d=
|
|
|
|
|
c[EditorUi.DIFF_UPDATE][l],null!=d.previous&&(f[d.previous]=l);if(null!=a){var p="";for(d=0;d<a.length;d++){var u=a[d].getId();q[u]=a[d];null!=f[p]||n[u]||null!=c[EditorUi.DIFF_UPDATE]&&null!=c[EditorUi.DIFF_UPDATE][u]&&null!=c[EditorUi.DIFF_UPDATE][u].previous||(f[p]=u);p=u}}var z={},t=mxUtils.bind(this,function(a){var d=null!=a?a.getId():"";if(null!=a&&!z[d]){z[d]=!0;k.push(a);var l=null!=c[EditorUi.DIFF_UPDATE]?c[EditorUi.DIFF_UPDATE][d]:null;null!=l&&(this.updatePageRoot(a),null!=l.name&&a.setName(l.name),
|
|
|
|
|
null!=l.view&&this.patchViewState(a,l.view),null!=l.cells&&this.patchPage(a,l.cells,e[a.getId()],g),!b||null==l.cells&&null==l.view||(a.needsUpdate=!0))}a=f[d];null!=a&&(delete f[d],t(q[a]));a=m[d];null!=a&&(delete m[d],A(a))}),A=mxUtils.bind(this,function(a){a=mxUtils.parseXml(a.data).documentElement;a=new DiagramPage(a);this.updatePageRoot(a);var c=q[a.getId()];null==c?t(a):(c.root=a.root,this.currentPage==c?this.editor.graph.model.setRoot(c.root):b&&(c.needsUpdate=!0))});t();for(l in f)t(q[f[l]]),
|
|
|
|
@ -9513,20 +9514,20 @@ c):m&&"function"===typeof window.OneDriveClient&&b.addItem(mxResources.get("oneD
|
|
|
|
|
c);null!=a.gitLab&&b.addItem(mxResources.get("gitlab")+"...",null,function(){a.pickLibrary(App.MODE_GITLAB)},c);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){a.pickLibrary(App.MODE_TRELLO)},c):n&&"function"===typeof window.TrelloClient&&b.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);b.addSeparator(c);isLocalStorage&&"0"!=urlParams.browser&&b.addItem(mxResources.get("browser")+"...",null,function(){a.pickLibrary(App.MODE_BROWSER)},
|
|
|
|
|
c);b.addItem(mxResources.get("device")+"...",null,function(){a.pickLibrary(App.MODE_DEVICE)},c);a.isOffline()||(b.addSeparator(c),b.addItem(mxResources.get("url")+"...",null,function(){var b=new FilenameDialog(a,"",mxResources.get("open"),function(b){if(null!=b&&0<b.length&&a.spinner.spin(document.body,mxResources.get("loading"))){var c=b;a.editor.isCorsEnabledForUrl(b)||(c=PROXY_URL+"?url="+encodeURIComponent(b));mxUtils.get(c,function(c){if(200<=c.getStatus()&&299>=c.getStatus()){a.spinner.stop();
|
|
|
|
|
try{a.loadLibrary(new UrlLibrary(this,c.getText(),b))}catch(F){a.handleError(F,mxResources.get("errorLoadingFile"))}}else a.spinner.stop(),a.handleError(null,mxResources.get("errorLoadingFile"))},function(){a.spinner.stop();a.handleError(null,mxResources.get("errorLoadingFile"))})}},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},c));"1"==urlParams.confLib&&(b.addSeparator(c),b.addItem(mxResources.get("confluenceCloud")+"...",null,function(){a.showRemotelyStoredLibrary(mxResources.get("libraries"))},
|
|
|
|
|
c))})));this.put("edit",new Menu(mxUtils.bind(this,function(a,b){this.addMenuItems(a,"undo redo - cut copy paste delete - duplicate - find - editData editTooltip - editStyle editGeometry - edit - editLink openLink - selectVertices selectEdges selectAll selectNone - lockUnlock".split(" "))})));q=a.actions.addAction("comments",mxUtils.bind(this,function(){null==this.commentsWindow?(this.commentsWindow=new CommentsWindow(a,document.body.offsetWidth-380,120,300,350),this.commentsWindow.window.addListener("show",
|
|
|
|
|
function(){a.fireEvent(new mxEventObject("comments"))}),this.commentsWindow.window.addListener("hide",function(){a.fireEvent(new mxEventObject("comments"))}),this.commentsWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("comments"))):(this.commentsWindow.window.setVisible(!this.commentsWindow.window.isVisible()),this.commentsWindow.refreshCommentsTime())}));q.setToggleAction(!0);q.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.commentsWindow&&this.commentsWindow.window.isVisible()}));
|
|
|
|
|
a.editor.addListener("fileLoaded",mxUtils.bind(this,function(){null!=this.commentsWindow&&(this.commentsWindow.destroy(),this.commentsWindow=null)}));var q=this.get("viewPanels"),C=q.funct;q.funct=function(b,c){C.apply(this,arguments);a.commentsSupported()&&a.menus.addMenuItems(b,["comments"],c)};this.put("view",new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,(null!=this.editorUi.format?["formatPanel"]:[]).concat(["outline","layers"]).concat(a.commentsSupported()?["comments","-"]:["-"]));
|
|
|
|
|
this.addMenuItems(b,["-","search"],c);if(isLocalStorage||mxClient.IS_CHROMEAPP){var d=this.addMenuItem(b,"scratchpad",c);(!a.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000042367")}this.addMenuItems(b,"shapes - pageView pageScale - scrollbars tooltips - grid guides".split(" "),c);mxClient.IS_SVG&&(null==document.documentMode||9<document.documentMode)&&this.addMenuItem(b,"shadowVisible",c);this.addMenuItems(b,
|
|
|
|
|
"- connectionArrows connectionPoints - resetView zoomIn zoomOut".split(" "),c)})));this.put("extras",new Menu(mxUtils.bind(this,function(b,c){"1"!=urlParams.embed&&(this.addSubmenu("theme",b,c),b.addSeparator(c));this.addMenuItems(b,["copyConnect","collapseExpand","-"],c);if("undefined"!==typeof MathJax){var d=this.addMenuItem(b,"mathematicalTypesetting",c);(!a.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000032875")}"1"!=
|
|
|
|
|
urlParams.embed&&this.addMenuItems(b,["autosave"],c);this.addMenuItems(b,["-","editDiagram"],c);b.addSeparator(c);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&this.addMenuItems(b,["showStartScreen"],c);!a.isOfflineApp()&&isLocalStorage&&this.addMenuItem(b,"plugins",c);b.addSeparator(c);this.addMenuItem(b,"tags",c);b.addSeparator(c);"1"==urlParams.newTempDlg&&(a.actions.addAction("templates",function(){var b=new TemplatesDialog;a.showDialog(b.container,b.width,b.height,!0,!1,null,
|
|
|
|
|
!1,!0);b.init(a,function(a){console.log(a)},null,null,null,"user",function(a,b){setTimeout(function(){b?a([{url:"123",title:"Test 1Test 1Test 1Test 1Test 1Test 1Test 11Test 1Test 11Test 1Test 1dgdsgdfg fdg dfgdfg dfg dfg"},{url:"123",title:"Test 2",imgUrl:"https://www.google.com.eg/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"},{url:"123",title:"Test 3",changedBy:"Ashraf Teleb",lastModifiedOn:"Yesterday"},{url:"123",title:"Test 4"},{url:"123",title:"Test 5"},{url:"123",title:"Test 6"}]):
|
|
|
|
|
a([{url:"123",title:"Test 4",imgUrl:"https://images.pexels.com/photos/459225/pexels-photo-459225.jpeg"},{url:"123",title:"Test 5"},{url:"123",title:"Test 6"},{url:"123",title:"Test 1Test 1Test 1Test 1Test 1Test 1Test 11Test 1Test 11Test 1Test 1dgdsgdfg fdg dfgdfg dfg dfg"},{url:"123",title:"Test 2",imgUrl:"https://www.google.com.eg/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"},{url:"123",title:"Test 3",changedBy:"Ashraf Teleb",lastModifiedOn:"Yesterday"}]);console.log(b)},1E3)},function(a,
|
|
|
|
|
b,c){setTimeout(function(){b(c?[{url:"123",title:a+"Test 1Test 1Test 1Test 1Test 1Test 1Test 1"},{url:"123",title:a+"Test 2"},{url:"123",title:a+"Test 3"},{url:"123",title:a+"Test 4"},{url:"123",title:a+"Test 5"},{url:"123",title:a+"Test 6"}]:[{url:"123",title:a+"Test 5"},{url:"123",title:a+"Test 6"},{url:"123",title:a+"Test 1Test 1Test 1Test 1Test 1Test 1Test 1"},{url:"123",title:a+"Test 2"},{url:"123",title:a+"Test 3"},{url:"123",title:a+"Test 4"}])},2E3)},null)}),this.addMenuItem(b,"templates",
|
|
|
|
|
c))})));this.put("file",new Menu(mxUtils.bind(this,function(b,c){if("1"==urlParams.embed)this.addSubmenu("importFrom",b,c),this.addSubmenu("exportAs",b,c),this.addSubmenu("embed",b,c),"1"==urlParams.libraries&&(this.addMenuItems(b,["-"],c),this.addSubmenu("newLibrary",b,c),this.addSubmenu("openLibraryFrom",b,c)),a.isRevisionHistorySupported()&&this.addMenuItems(b,["-","revisionHistory"],c),this.addMenuItems(b,"- pageSetup print - rename save".split(" "),c),"1"==urlParams.saveAndExit&&this.addMenuItems(b,
|
|
|
|
|
["saveAndExit"],c),this.addMenuItems(b,["exit"],c);else{var d=this.editorUi.getCurrentFile();if(null!=d&&d.constructor==DriveFile){d.isRestricted()&&this.addMenuItems(b,["exportOptionsDisabled"],c);this.addMenuItems(b,["save","-","share"],c);var e=this.addMenuItem(b,"synchronize",c);(!a.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(e,"https://desk.draw.io/support/solutions/articles/16000087947");b.addSeparator(c)}else this.addMenuItems(b,["new"],c);this.addSubmenu("openFrom",
|
|
|
|
|
b,c);isLocalStorage&&this.addSubmenu("openRecent",b,c);null!=d&&d.constructor==DriveFile?this.addMenuItems(b,["new","-","rename","makeCopy","moveToFolder"],c):(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||null==d||d.constructor==LocalFile||(b.addSeparator(c),e=this.addMenuItem(b,"synchronize",c),(!a.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(e,"https://desk.draw.io/support/solutions/articles/16000087947")),this.addMenuItems(b,["-","save","saveAs"],c),this.addMenuItems(b,
|
|
|
|
|
["-","rename"],c),a.isOfflineApp()?navigator.onLine&&"1"!=urlParams.stealth&&this.addMenuItems(b,["upload"],c):(this.addMenuItems(b,["makeCopy"],c),null!=d&&d.constructor==OneDriveFile&&this.addMenuItems(b,["moveToFolder"],c)));b.addSeparator(c);this.addSubmenu("importFrom",b,c);this.addSubmenu("exportAs",b,c);b.addSeparator(c);this.addSubmenu("embed",b,c);this.addSubmenu("publish",b,c);b.addSeparator(c);this.addSubmenu("newLibrary",b,c);this.addSubmenu("openLibraryFrom",b,c);a.isRevisionHistorySupported()&&
|
|
|
|
|
this.addMenuItems(b,["-","revisionHistory"],c);this.addMenuItems(b,["-","pageSetup"],c);mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["print"],c);this.addMenuItems(b,["-","close"])}})))}})();function DiagramPage(a,c){this.node=a;null!=c?this.node.setAttribute("id",c):null==this.getId()&&this.node.setAttribute("id",Editor.guid())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute("id")};DiagramPage.prototype.getName=function(){return this.node.getAttribute("name")};
|
|
|
|
|
c))})));this.put("edit",new Menu(mxUtils.bind(this,function(a,b){this.addMenuItems(a,"undo redo - cut copy paste delete - duplicate - find - editData editTooltip - editStyle editGeometry - edit - editLink openLink - selectVertices selectEdges selectAll selectNone - lockUnlock".split(" "))})));q=a.actions.addAction("comments",mxUtils.bind(this,function(){if(null==this.commentsWindow)this.commentsWindow=new CommentsWindow(a,document.body.offsetWidth-380,120,300,350),this.commentsWindow.window.addListener("show",
|
|
|
|
|
function(){a.fireEvent(new mxEventObject("comments"))}),this.commentsWindow.window.addListener("hide",function(){a.fireEvent(new mxEventObject("comments"))}),this.commentsWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("comments"));else{var b=!this.commentsWindow.window.isVisible();this.commentsWindow.window.setVisible(b);this.commentsWindow.refreshCommentsTime();b&&this.commentsWindow.hasError&&this.commentsWindow.refreshComments()}}));q.setToggleAction(!0);q.setSelectedCallback(mxUtils.bind(this,
|
|
|
|
|
function(){return null!=this.commentsWindow&&this.commentsWindow.window.isVisible()}));a.editor.addListener("fileLoaded",mxUtils.bind(this,function(){null!=this.commentsWindow&&(this.commentsWindow.destroy(),this.commentsWindow=null)}));var q=this.get("viewPanels"),C=q.funct;q.funct=function(b,c){C.apply(this,arguments);a.commentsSupported()&&a.menus.addMenuItems(b,["comments"],c)};this.put("view",new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,(null!=this.editorUi.format?["formatPanel"]:
|
|
|
|
|
[]).concat(["outline","layers"]).concat(a.commentsSupported()?["comments","-"]:["-"]));this.addMenuItems(b,["-","search"],c);if(isLocalStorage||mxClient.IS_CHROMEAPP){var d=this.addMenuItem(b,"scratchpad",c);(!a.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000042367")}this.addMenuItems(b,"shapes - pageView pageScale - scrollbars tooltips - grid guides".split(" "),c);mxClient.IS_SVG&&(null==document.documentMode||
|
|
|
|
|
9<document.documentMode)&&this.addMenuItem(b,"shadowVisible",c);this.addMenuItems(b,"- connectionArrows connectionPoints - resetView zoomIn zoomOut".split(" "),c)})));this.put("extras",new Menu(mxUtils.bind(this,function(b,c){"1"!=urlParams.embed&&(this.addSubmenu("theme",b,c),b.addSeparator(c));this.addMenuItems(b,["copyConnect","collapseExpand","-"],c);if("undefined"!==typeof MathJax){var d=this.addMenuItem(b,"mathematicalTypesetting",c);(!a.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&
|
|
|
|
|
this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000032875")}"1"!=urlParams.embed&&this.addMenuItems(b,["autosave"],c);this.addMenuItems(b,["-","editDiagram"],c);b.addSeparator(c);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&this.addMenuItems(b,["showStartScreen"],c);!a.isOfflineApp()&&isLocalStorage&&this.addMenuItem(b,"plugins",c);b.addSeparator(c);this.addMenuItem(b,"tags",c);b.addSeparator(c);"1"==urlParams.newTempDlg&&(a.actions.addAction("templates",
|
|
|
|
|
function(){var b=new TemplatesDialog;a.showDialog(b.container,b.width,b.height,!0,!1,null,!1,!0);b.init(a,function(a){console.log(a)},null,null,null,"user",function(a,b){setTimeout(function(){b?a([{url:"123",title:"Test 1Test 1Test 1Test 1Test 1Test 1Test 11Test 1Test 11Test 1Test 1dgdsgdfg fdg dfgdfg dfg dfg"},{url:"123",title:"Test 2",imgUrl:"https://www.google.com.eg/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"},{url:"123",title:"Test 3",changedBy:"Ashraf Teleb",lastModifiedOn:"Yesterday"},
|
|
|
|
|
{url:"123",title:"Test 4"},{url:"123",title:"Test 5"},{url:"123",title:"Test 6"}]):a([{url:"123",title:"Test 4",imgUrl:"https://images.pexels.com/photos/459225/pexels-photo-459225.jpeg"},{url:"123",title:"Test 5"},{url:"123",title:"Test 6"},{url:"123",title:"Test 1Test 1Test 1Test 1Test 1Test 1Test 11Test 1Test 11Test 1Test 1dgdsgdfg fdg dfgdfg dfg dfg"},{url:"123",title:"Test 2",imgUrl:"https://www.google.com.eg/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"},{url:"123",title:"Test 3",
|
|
|
|
|
changedBy:"Ashraf Teleb",lastModifiedOn:"Yesterday"}]);console.log(b)},1E3)},function(a,b,c){setTimeout(function(){b(c?[{url:"123",title:a+"Test 1Test 1Test 1Test 1Test 1Test 1Test 1"},{url:"123",title:a+"Test 2"},{url:"123",title:a+"Test 3"},{url:"123",title:a+"Test 4"},{url:"123",title:a+"Test 5"},{url:"123",title:a+"Test 6"}]:[{url:"123",title:a+"Test 5"},{url:"123",title:a+"Test 6"},{url:"123",title:a+"Test 1Test 1Test 1Test 1Test 1Test 1Test 1"},{url:"123",title:a+"Test 2"},{url:"123",title:a+
|
|
|
|
|
"Test 3"},{url:"123",title:a+"Test 4"}])},2E3)},null)}),this.addMenuItem(b,"templates",c))})));this.put("file",new Menu(mxUtils.bind(this,function(b,c){if("1"==urlParams.embed)this.addSubmenu("importFrom",b,c),this.addSubmenu("exportAs",b,c),this.addSubmenu("embed",b,c),"1"==urlParams.libraries&&(this.addMenuItems(b,["-"],c),this.addSubmenu("newLibrary",b,c),this.addSubmenu("openLibraryFrom",b,c)),a.isRevisionHistorySupported()&&this.addMenuItems(b,["-","revisionHistory"],c),this.addMenuItems(b,"- pageSetup print - rename save".split(" "),
|
|
|
|
|
c),"1"==urlParams.saveAndExit&&this.addMenuItems(b,["saveAndExit"],c),this.addMenuItems(b,["exit"],c);else{var d=this.editorUi.getCurrentFile();if(null!=d&&d.constructor==DriveFile){d.isRestricted()&&this.addMenuItems(b,["exportOptionsDisabled"],c);this.addMenuItems(b,["save","-","share"],c);var e=this.addMenuItem(b,"synchronize",c);(!a.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(e,"https://desk.draw.io/support/solutions/articles/16000087947");b.addSeparator(c)}else this.addMenuItems(b,
|
|
|
|
|
["new"],c);this.addSubmenu("openFrom",b,c);isLocalStorage&&this.addSubmenu("openRecent",b,c);null!=d&&d.constructor==DriveFile?this.addMenuItems(b,["new","-","rename","makeCopy","moveToFolder"],c):(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||null==d||d.constructor==LocalFile||(b.addSeparator(c),e=this.addMenuItem(b,"synchronize",c),(!a.isOffline()||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&this.addLinkToItem(e,"https://desk.draw.io/support/solutions/articles/16000087947")),this.addMenuItems(b,
|
|
|
|
|
["-","save","saveAs"],c),this.addMenuItems(b,["-","rename"],c),a.isOfflineApp()?navigator.onLine&&"1"!=urlParams.stealth&&this.addMenuItems(b,["upload"],c):(this.addMenuItems(b,["makeCopy"],c),null!=d&&d.constructor==OneDriveFile&&this.addMenuItems(b,["moveToFolder"],c)));b.addSeparator(c);this.addSubmenu("importFrom",b,c);this.addSubmenu("exportAs",b,c);b.addSeparator(c);this.addSubmenu("embed",b,c);this.addSubmenu("publish",b,c);b.addSeparator(c);this.addSubmenu("newLibrary",b,c);this.addSubmenu("openLibraryFrom",
|
|
|
|
|
b,c);a.isRevisionHistorySupported()&&this.addMenuItems(b,["-","revisionHistory"],c);this.addMenuItems(b,["-","pageSetup"],c);mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["print"],c);this.addMenuItems(b,["-","close"])}})))}})();function DiagramPage(a,c){this.node=a;null!=c?this.node.setAttribute("id",c):null==this.getId()&&this.node.setAttribute("id",Editor.guid())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute("id")};DiagramPage.prototype.getName=function(){return this.node.getAttribute("name")};
|
|
|
|
|
DiagramPage.prototype.setName=function(a){null==a?this.node.removeAttribute("name"):this.node.setAttribute("name",a)};function RenamePage(a,c,b){this.ui=a;this.page=c;this.previous=this.name=b}RenamePage.prototype.execute=function(){var a=this.page.getName();this.page.setName(this.previous);this.name=this.previous;this.previous=a;this.ui.editor.graph.updatePlaceholders();this.ui.editor.fireEvent(new mxEventObject("pageRenamed"))};
|
|
|
|
|
function MovePage(a,c,b){this.ui=a;this.oldIndex=c;this.newIndex=b}MovePage.prototype.execute=function(){this.ui.pages.splice(this.newIndex,0,this.ui.pages.splice(this.oldIndex,1)[0]);var a=this.oldIndex;this.oldIndex=this.newIndex;this.newIndex=a;this.ui.editor.graph.updatePlaceholders();this.ui.editor.fireEvent(new mxEventObject("pageMoved"))};
|
|
|
|
|
function SelectPage(a,c,b){this.ui=a;this.previousPage=this.page=c;this.neverShown=!0;null!=c&&(this.neverShown=null==c.viewState,this.ui.updatePageRoot(c),null!=b&&(c.viewState=b,this.neverShown=!1))}
|
|
|
|
|