parent
93fda0f82e
commit
ba79760406
25 changed files with 2738 additions and 1630 deletions
|
@ -1,3 +1,11 @@
|
|||
26-JUN-2018: 8.8.7
|
||||
|
||||
- Fixes custom content view in Confluence Cloud
|
||||
- Disables click sidebar collapse
|
||||
- Uses inline window for text plugin
|
||||
- Adds showStartScreen in Chrome App
|
||||
- Disables plantUML when offline
|
||||
|
||||
21-JUN-2018: 8.8.6
|
||||
|
||||
- Improves detection of gliffy macro in conf cloud
|
||||
|
|
13
Dockerfile
13
Dockerfile
|
@ -1,13 +0,0 @@
|
|||
FROM frekele/ant:1.10.3-jdk8 as BUILD
|
||||
RUN mkdir /usr/build
|
||||
COPY src /usr/build/src
|
||||
COPY etc /usr/build/etc
|
||||
COPY war /usr/build/war
|
||||
COPY VERSION /usr/build
|
||||
RUN cd /usr/build/etc/build/
|
||||
RUN ant -file /usr/build/etc/build/build.xml war
|
||||
|
||||
FROM tomcat:9.0 as TARGET
|
||||
COPY --from=BUILD /usr/build/build/draw.war /usr/local/tomcat/webapps/
|
||||
EXPOSE 8080
|
||||
CMD ["catalina.sh", "run"]
|
10
README.md
10
README.md
|
@ -17,16 +17,6 @@ A development guide is being started on the GitHub project wiki. There is a [dra
|
|||
|
||||
The [mxGraph documentation](https://jgraph.github.io/mxgraph/) provides a lot of the docs for the bottom part of the stack. There is an [mxgraph tag on SO](http://stackoverflow.com/questions/tagged/mxgraph).
|
||||
|
||||
|
||||
Docker
|
||||
------
|
||||
After successful build, from the project directory run
|
||||
```bash
|
||||
docker build -t draw .
|
||||
docker run -d -p 8888:8080 draw
|
||||
```
|
||||
Now the app will be accessible at http://localhost:8888/draw/?https=0
|
||||
|
||||
Running
|
||||
-------
|
||||
The simplest way to run draw.io initially is to fork this project, [publish the master branch to GitHub pages](https://help.github.com/categories/github-pages-basics/) and the [pages sites](https://jgraph.github.io/drawio/src/main/webapp/index.html) will have the full editor functionality (sans the integrations).
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
8.8.6
|
||||
8.8.7
|
|
@ -1,7 +1,7 @@
|
|||
CACHE MANIFEST
|
||||
|
||||
# THIS FILE WAS GENERATED. DO NOT MODIFY!
|
||||
# 06/21/2018 06:20 PM
|
||||
# 06/26/2018 04:33 PM
|
||||
|
||||
app.html
|
||||
index.html?offline=1
|
||||
|
|
517
src/main/webapp/js/app.min.js
vendored
517
src/main/webapp/js/app.min.js
vendored
|
@ -103,7 +103,7 @@ window.mxLanguageMap=window.mxLanguageMap||{i18n:"",id:"Bahasa Indonesia",ms:"Ba
|
|||
ko:"한국어",ja:"日本語",zh:"中文(中国)","zh-tw":"中文(台灣)"};"undefined"===typeof window.mxBasePath&&(window.mxBasePath="mxgraph");if(null==window.mxLanguages){window.mxLanguages=[];for(var lang in mxLanguageMap)"en"!=lang&&window.mxLanguages.push(lang)}window.uiTheme=window.uiTheme||function(){var a=urlParams.ui;if(null==a&&"undefined"!==typeof JSON&&isLocalStorage)try{var b=localStorage.getItem(".drawio-config");null!=b&&(a=JSON.parse(b).ui||null)}catch(c){isLocalStorage=!1}return a}();
|
||||
function setCurrentXml(a,b){null!=window.parent&&null!=window.parent.openFile&&window.parent.openFile.setData(a,b)}
|
||||
(function(){if("undefined"!==typeof JSON&&isLocalStorage)try{var a=localStorage.getItem(".drawio-config"),b=!0;null!=a&&(b=JSON.parse(a).showStartScreen);0==b&&(urlParams.splash="0")}catch(c){}a=urlParams["export"];null!=a&&("http://"!=a.substring(0,7)&&"https://"!=a.substring(0,8)&&(a="http://"+a),EXPORT_URL=a);window.DRAWIO_LOG_URL=window.DRAWIO_LOG_URL||"";b=window.location.host;"test.draw.io"!=b&&(a=b.length-7,b=b.lastIndexOf("draw.io",a),-1!==b&&b===a&&(window.DRAWIO_LOG_URL="https://log.draw.io"))})();
|
||||
if("1"==urlParams.offline||"1"==urlParams.demo||"1"==urlParams.stealth||"1"==urlParams.local)urlParams.analytics="0",urlParams.picker="0",urlParams.gapi="0",urlParams.db="0",urlParams.od="0",urlParams.gh="0",urlParams.tr="0";if("1"==urlParams.offline||"1"==urlParams.local)urlParams.math="0";"1"==urlParams.lightbox&&(urlParams.chrome="0");window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
|
||||
if("1"==urlParams.offline||"1"==urlParams.demo||"1"==urlParams.stealth||"1"==urlParams.local)urlParams.picker="0",urlParams.gapi="0",urlParams.db="0",urlParams.od="0",urlParams.gh="0",urlParams.tr="0";if("1"==urlParams.offline||"1"==urlParams.local)urlParams.math="0";"1"==urlParams.lightbox&&(urlParams.chrome="0");window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"3.9.7",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&
|
||||
0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&&
|
||||
|
@ -2067,8 +2067,8 @@ this.getCssClassForMarker("end",b.currentEdgeStyle.shape,b.currentEdgeStyle[mxCo
|
|||
this.toolbar.setFontSize(c)}),b.getSelectionModel().addListener(mxEvent.CHANGE,a),b.getModel().addListener(mxEvent.CHANGE,a));b.addListener(mxEvent.CELLS_ADDED,function(a,c){var d=c.getProperty("cells"),e=c.getProperty("parent");b.getModel().isLayer(e)&&!b.isCellVisible(e)&&null!=d&&0<d.length&&b.getModel().setVisible(e,!0)});this.gestureHandler=mxUtils.bind(this,function(a){null!=this.currentMenu&&mxEvent.getSource(a)!=this.currentMenu.div&&this.hideCurrentMenu()});mxEvent.addGestureListeners(document,
|
||||
this.gestureHandler);this.resizeHandler=mxUtils.bind(this,function(){window.setTimeout(mxUtils.bind(this,function(){null!=this.editor.graph&&this.refresh()}),0)});mxEvent.addListener(window,"resize",this.resizeHandler);this.orientationChangeHandler=mxUtils.bind(this,function(){this.refresh()});mxEvent.addListener(window,"orientationchange",this.orientationChangeHandler);mxClient.IS_IOS&&!window.navigator.standalone&&(this.scrollHandler=mxUtils.bind(this,function(){window.scrollTo(0,0)}),mxEvent.addListener(window,
|
||||
"scroll",this.scrollHandler));this.editor.addListener("resetGraphView",mxUtils.bind(this,function(){this.resetScrollbars()}));this.addListener("gridEnabledChanged",mxUtils.bind(this,function(){b.view.validateBackground()}));this.addListener("backgroundColorChanged",mxUtils.bind(this,function(){b.view.validateBackground()}));b.addListener("gridSizeChanged",mxUtils.bind(this,function(){b.isGridEnabled()&&b.view.validateBackground()}));this.editor.resetGraph();this.init();this.open()};
|
||||
mxUtils.extend(EditorUi,mxEventSource);EditorUi.compactUi=!0;EditorUi.prototype.splitSize=mxClient.IS_TOUCH||mxClient.IS_POINTER?12:8;EditorUi.prototype.menubarHeight=30;EditorUi.prototype.formatEnabled=!0;EditorUi.prototype.formatWidth=240;EditorUi.prototype.toolbarHeight=34;EditorUi.prototype.footerHeight=28;EditorUi.prototype.sidebarFooterHeight=34;EditorUi.prototype.editButtonLink=null;EditorUi.prototype.hsplitPosition=640>=screen.width?118:208;EditorUi.prototype.allowAnimation=!0;
|
||||
EditorUi.prototype.lightboxMaxFitScale=2;EditorUi.prototype.lightboxVerticalDivider=4;
|
||||
mxUtils.extend(EditorUi,mxEventSource);EditorUi.compactUi=!0;EditorUi.prototype.splitSize=mxClient.IS_TOUCH||mxClient.IS_POINTER?12:8;EditorUi.prototype.menubarHeight=30;EditorUi.prototype.formatEnabled=!0;EditorUi.prototype.formatWidth=240;EditorUi.prototype.toolbarHeight=34;EditorUi.prototype.footerHeight=28;EditorUi.prototype.sidebarFooterHeight=34;EditorUi.prototype.hsplitPosition=640>=screen.width?118:208;EditorUi.prototype.allowAnimation=!0;EditorUi.prototype.lightboxMaxFitScale=2;
|
||||
EditorUi.prototype.lightboxVerticalDivider=4;EditorUi.prototype.hsplitClickEnabled=!1;
|
||||
EditorUi.prototype.init=function(){var a=this.editor.graph;mxEvent.addListener(a.container,"keydown",mxUtils.bind(this,function(a){this.onKeyDown(a)}));mxEvent.addListener(a.container,"keypress",mxUtils.bind(this,function(a){this.onKeyPress(a)}));this.addUndoListener();this.addBeforeUnloadListener();a.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(){this.updateActionStates()}));a.getModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(){this.updateActionStates()}));
|
||||
var c=a.setDefaultParent,d=this;this.editor.graph.setDefaultParent=function(){c.apply(this,arguments);d.updateActionStates()};a.editLink=d.actions.get("editLink").funct;this.updateActionStates();this.initClipboard();this.initCanvas();null!=this.format&&this.format.init()};EditorUi.prototype.onKeyDown=function(a){var c=this.editor.graph;9==a.which&&c.isEnabled()&&!mxEvent.isAltDown(a)&&(c.isEditing()?c.stopEditing(!1):c.selectCell(!mxEvent.isShiftDown(a)),mxEvent.consume(a))};
|
||||
EditorUi.prototype.onKeyPress=function(a){var c=this.editor.graph;!this.isImmediateEditingEvent(a)||c.isEditing()||c.isSelectionEmpty()||0===a.which||mxEvent.isAltDown(a)||mxEvent.isControlDown(a)||mxEvent.isMetaDown(a)||(c.escape(),c.startEditing(),mxClient.IS_FF&&(c=c.cellEditor,c.textarea.innerHTML=String.fromCharCode(a.which),a=document.createRange(),a.selectNodeContents(c.textarea),a.collapse(!1),c=window.getSelection(),c.removeAllRanges(),c.addRange(a)))};
|
||||
|
@ -2150,7 +2150,8 @@ this.container.appendChild(this.sidebarFooterContainer);this.container.appendChi
|
|||
!0,0,mxUtils.bind(this,function(a){this.hsplitPosition=a;this.refresh()})))};EditorUi.prototype.createStatusContainer=function(){var a=document.createElement("a");a.className="geItem geStatus";420>screen.width&&(a.style.maxWidth=Math.max(20,screen.width-320)+"px",a.style.overflow="hidden");return a};EditorUi.prototype.setStatusText=function(a){this.statusContainer.innerHTML=a};EditorUi.prototype.createToolbar=function(a){return new Toolbar(this,a)};
|
||||
EditorUi.prototype.createSidebar=function(a){return new Sidebar(this,a)};EditorUi.prototype.createFormat=function(a){return new Format(this,a)};EditorUi.prototype.createFooter=function(){return this.createDiv("geFooter")};EditorUi.prototype.createDiv=function(a){var c=document.createElement("div");c.className=a;return c};
|
||||
EditorUi.prototype.addSplitHandler=function(a,c,d,b){function f(a){if(null!=h){var e=new mxPoint(mxEvent.getClientX(a),mxEvent.getClientY(a));b(Math.max(0,g+(c?e.x-h.x:h.y-e.y)-d));mxEvent.consume(a);g!=m()&&(k=!0,l=null)}}function e(a){f(a);h=g=null}var h=null,g=null,k=!0,l=null;mxClient.IS_POINTER&&(a.style.touchAction="none");var m=mxUtils.bind(this,function(){var b=parseInt(c?a.style.left:a.style.bottom);c||(b=b+d-this.footerHeight);return b});mxEvent.addGestureListeners(a,function(a){h=new mxPoint(mxEvent.getClientX(a),
|
||||
mxEvent.getClientY(a));g=m();k=!1;mxEvent.consume(a)});mxEvent.addListener(a,"click",function(a){if(!k){var c=null!=l?l-d:0;l=m();b(c);mxEvent.consume(a)}});mxEvent.addGestureListeners(document,null,f,e);this.destroyFunctions.push(function(){mxEvent.removeGestureListeners(document,null,f,e)})};EditorUi.prototype.showDialog=function(a,c,d,b,f,e,h){this.editor.graph.tooltipHandler.hideTooltip();null==this.dialogs&&(this.dialogs=[]);this.dialog=new Dialog(this,a,c,d,b,f,e,h);this.dialogs.push(this.dialog)};
|
||||
mxEvent.getClientY(a));g=m();k=!1;mxEvent.consume(a)});mxEvent.addListener(a,"click",mxUtils.bind(this,function(a){if(!k&&this.hsplitClickEnabled){var c=null!=l?l-d:0;l=m();b(c);mxEvent.consume(a)}}));mxEvent.addGestureListeners(document,null,f,e);this.destroyFunctions.push(function(){mxEvent.removeGestureListeners(document,null,f,e)})};
|
||||
EditorUi.prototype.showDialog=function(a,c,d,b,f,e,h){this.editor.graph.tooltipHandler.hideTooltip();null==this.dialogs&&(this.dialogs=[]);this.dialog=new Dialog(this,a,c,d,b,f,e,h);this.dialogs.push(this.dialog)};
|
||||
EditorUi.prototype.hideDialog=function(a){null!=this.dialogs&&0<this.dialogs.length&&(this.dialogs.pop().close(a),this.dialog=0<this.dialogs.length?this.dialogs[this.dialogs.length-1]:null,null==this.dialog&&"hidden"!=this.editor.graph.container.style.visibility&&this.editor.graph.container.focus(),mxUtils.clearSelection(),this.editor.fireEvent(new mxEventObject("hideDialog")))};
|
||||
EditorUi.prototype.pickColor=function(a,c){var d=this.editor.graph,b=d.cellEditor.saveSelection(),f=new ColorDialog(this,a||"none",function(a){d.cellEditor.restoreSelection(b);c(a)},function(){d.cellEditor.restoreSelection(b)});this.showDialog(f.container,230,430,!0,!1);f.init()};
|
||||
EditorUi.prototype.openFile=function(){window.openFile=new OpenFile(mxUtils.bind(this,function(a){this.hideDialog(a)}));this.showDialog((new OpenDialog(this)).container,Editor.useLocalStorage?640:320,Editor.useLocalStorage?480:220,!0,!0,function(){window.openFile=null})};
|
||||
|
@ -6822,7 +6823,7 @@ null,null,this.getTagsForStencil("mxgraph.weblogos","blogger","web logos logo").
|
|||
66,65,"","Crowd",null,null,this.getTagsForStencil("mxgraph.weblogos","crowd logo","web logos logo").join(" ")),this.createVertexTemplateEntry("image;image=img/lib/atlassian/Crucible_Logo.svg;",61,61,"","Crucible",null,null,this.getTagsForStencil("mxgraph.weblogos","crucible logo","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dealsplus;fillColor=#935492",76,.2*333,"","Dealsplus",null,null,this.getTagsForStencil("mxgraph.weblogos","dealsplus","web logos logo").join(" ")),this.createVertexTemplateEntry(a+
|
||||
"designfloat;strokeColor=none",72,72,"","Designfloat",null,null,this.getTagsForStencil("mxgraph.weblogos","designfloat","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"deviantart;fillColor=#009544;strokeColor=none;",62,86.4,"","Deviantart",null,null,this.getTagsForStencil("mxgraph.weblogos","deviantart","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"digg;fillColor=#ffffff",58,56,"","Digg",null,null,this.getTagsForStencil("mxgraph.weblogos","digg","web logos logo").join(" ")),
|
||||
this.createVertexTemplateEntry(a+"diigo;fillColor=#2973D2;strokeColor=none",61.2,68.8,"","Diigo",null,null,this.getTagsForStencil("mxgraph.weblogos","diiigo","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dopplr;fillColor=#F9634D;strokeColor=none",102.4,102.4,"","Dopplr",null,null,this.getTagsForStencil("mxgraph.weblogos","dopplr","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"drawio2;fillColor=#1A5BA3",52.2,70.8,"","Draw.io",null,null,this.getTagsForStencil("mxgraph.weblogos",
|
||||
"drawio draw io draw.io","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"drawio3;fillColor=#1A5BA3;fontSize=15;fontColor=#1A5BA3;fontStyle=1",52.2,52.2,'draw<font color="#f08707">.io</font>',"Draw.io",null,null,this.getTagsForStencil("mxgraph.weblogos","drawio draw io draw.io","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dribbble;fillColor=#EB548D",67.4,67.2,"","Dribbble",null,null,this.getTagsForStencil("mxgraph.weblogos","dribbble","web logos logo").join(" ")),this.createVertexTemplateEntry(a+
|
||||
"drawio draw io draw.io","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"drawio3;fillColor=#1A5BA3;fontSize=15;fontColor=#1A5BA3;fontStyle=1",52.2,52.2,'draw.<font color="#f08707">io</font>',"Draw.io",null,null,this.getTagsForStencil("mxgraph.weblogos","drawio draw io draw.io","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dribbble;fillColor=#EB548D",67.4,67.2,"","Dribbble",null,null,this.getTagsForStencil("mxgraph.weblogos","dribbble","web logos logo").join(" ")),this.createVertexTemplateEntry(a+
|
||||
"dropbox;fillColor=#0287EA",73.4,62,"","Dropbox2",null,null,this.getTagsForStencil("mxgraph.weblogos","dropbox","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"drupal",60.6,69,"","Drupal",null,null,this.getTagsForStencil("mxgraph.weblogos","drupal","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dzone",.2*438,61.2,"","Dzone",null,null,this.getTagsForStencil("mxgraph.weblogos","dzone","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"ebay",81.2,34.4,"","Ebay",
|
||||
null,null,this.getTagsForStencil("mxgraph.weblogos","ebay","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"edmodo;fillColor=#276CB0;strokeColor=none",69.2,73.8,"","Edmodo",null,null,this.getTagsForStencil("mxgraph.weblogos","edmodo","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"evernote;fillColor=#3F3F3F",.2*317,75.2,"","Evernote",null,null,this.getTagsForStencil("mxgraph.weblogos","evernote","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"fancy;fillColor=#6DB3E3",
|
||||
39.2,79,"","Fancy",null,null,this.getTagsForStencil("mxgraph.weblogos","fancy","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"fark;fillColor=#B1B0C7;gradientColor=#ffffff;strokeColor=#B1B0C7",44.2,70.2,"","Fark",null,null,this.getTagsForStencil("mxgraph.weblogos","fark","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"fashiolista",.2*388,73.2,"","Fashiolista",null,null,this.getTagsForStencil("mxgraph.weblogos","fashiolista","web logos logo").join(" ")),this.createVertexTemplateEntry(a+
|
||||
|
@ -6923,15 +6924,15 @@ g=mxUtils.button(g||mxResources.get("cancel"),function(){a.hideDialog();null!=d&
|
|||
e.style.height="auto",e.className="geBtn",e.style.width="40%"):e.className="geBtn gePrimaryBtn";a.editor.cancelFirst||k.appendChild(g);f.appendChild(k);l?(k.style.marginTop="10px",k=document.createElement("p"),k.style.marginTop="20px",k.appendChild(n),h=document.createElement("span"),mxUtils.write(h," "+mxResources.get("rememberThisSetting")),k.appendChild(h),f.appendChild(k),mxEvent.addListener(h,"click",function(a){n.checked=!n.checked;mxEvent.consume(a)})):k.style.marginTop="16px";this.container=
|
||||
f},ErrorDialog=function(a,b,c,d,e,g,h,m,l,f,k){l=null!=l?l:!0;var n=document.createElement("div");n.style.textAlign="center";if(null!=b){var t=document.createElement("div");t.style.padding="0px";t.style.margin="0px";t.style.fontSize="18px";t.style.paddingBottom="16px";t.style.marginBottom="16px";t.style.borderBottom="1px solid #c0c0c0";t.style.color="gray";mxUtils.write(t,b);n.appendChild(t)}b=document.createElement("div");b.style.padding="6px";b.innerHTML=c;n.appendChild(b);c=document.createElement("div");
|
||||
c.style.marginTop="16px";c.style.textAlign="center";null!=g&&(b=mxUtils.button(mxResources.get("tryAgain"),function(){a.hideDialog();g()}),b.className="geBtn",c.appendChild(b),c.style.textAlign="center");null!=f&&(f=mxUtils.button(f,function(){null!=k&&k()}),f.className="geBtn",c.appendChild(f));var u=mxUtils.button(d,function(){l&&a.hideDialog();null!=e&&e()});u.className="geBtn";c.appendChild(u);null!=h&&(d=mxUtils.button(h,function(){l&&a.hideDialog();null!=m&&m()}),d.className="geBtn gePrimaryBtn",
|
||||
c.appendChild(d));this.init=function(){u.focus()};n.appendChild(c);this.container=n},EmbedDialog=function(a,b,c,d,e){d=document.createElement("div");var g=/^https?:\/\//.test(b)||/^mailto:\/\//.test(b);mxUtils.write(d,mxResources.get(5E5>b.length?g?"link":"mainEmbedNotice":"preview")+":");mxUtils.br(d);var h=document.createElement("div");h.style.position="absolute";h.style.top="30px";h.style.right="30px";h.style.color="gray";mxUtils.write(h,a.formatFileSize(b.length));d.appendChild(h);var m=document.createElement("textarea");
|
||||
m.setAttribute("autocomplete","off");m.setAttribute("autocorrect","off");m.setAttribute("autocapitalize","off");m.setAttribute("spellcheck","false");m.style.marginTop="10px";m.style.resize="none";m.style.height="150px";m.style.width="440px";m.style.border="1px solid gray";m.value=mxResources.get("updatingDocument");d.appendChild(m);mxUtils.br(d);this.init=function(){window.setTimeout(function(){5E5>b.length?(m.value=b,m.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?
|
||||
m.select():document.execCommand("selectAll",!1,null)):(m.setAttribute("readonly","true"),m.value=b.substring(0,340)+"... ("+mxResources.get("drawingTooLarge")+")")},0)};h=document.createElement("div");h.style.position="absolute";h.style.bottom="36px";h.style.right="32px";var l=null;!EmbedDialog.showPreviewOption||mxClient.IS_CHROMEAPP&&!g||navigator.standalone||!(g||mxClient.IS_SVG&&(null==document.documentMode||9<document.documentMode))||(l=mxUtils.button(mxResources.get(5E5>b.length?"preview":"openInNewWindow"),
|
||||
function(){var d=5E5>b.length?m.value:b;if(null!=e)e(d);else if(g)try{var f=a.openLink(d);null!=f&&(null==c||0<c)&&window.setTimeout(mxUtils.bind(this,function(){null!=f&&null!=f.location.href&&f.location.href.substring(0,8)!=d.substring(0,8)&&(f.close(),a.handleError({message:mxResources.get("drawingTooLarge")}))}),c||500)}catch(q){a.handleError({message:q.message||mxResources.get("drawingTooLarge")})}else{var k=window.open().document;k.writeln("<html><head><title>"+encodeURIComponent(mxResources.get("preview"))+
|
||||
'</title><meta charset="utf-8"></head><body>'+b+"</body></html>");k.close()}}),l.className="geBtn",h.appendChild(l));if(!g||7500<b.length){var f=mxUtils.button(mxResources.get("download"),function(){a.hideDialog();a.saveData("embed.txt","txt",b,"text/plain")});f.className="geBtn";h.appendChild(f)}if(g&&(!a.isOffline()||mxClient.IS_CHROMEAPP)){if(51200>b.length){var k=mxUtils.button("",function(){try{var b="https://www.facebook.com/sharer.php?p[url]="+encodeURIComponent(m.value);a.openLink(b)}catch(t){a.handleError({message:t.message||
|
||||
mxResources.get("drawingTooLarge")})}}),f=document.createElement("img");f.setAttribute("src",Editor.facebookImage);f.setAttribute("width","18");f.setAttribute("height","18");f.setAttribute("border","0");k.appendChild(f);k.setAttribute("title",mxResources.get("facebook")+" ("+a.formatFileSize(51200)+" max)");k.style.verticalAlign="bottom";k.style.paddingTop="4px";k.style.minWidth="46px";k.className="geBtn";h.appendChild(k)}7168>b.length&&(k=mxUtils.button("",function(){try{var b="https://twitter.com/intent/tweet?text="+
|
||||
encodeURIComponent("Check out the diagram I made using @drawio")+"&url="+encodeURIComponent(m.value);a.openLink(b)}catch(t){a.handleError({message:t.message||mxResources.get("drawingTooLarge")})}}),f=document.createElement("img"),f.setAttribute("src",Editor.tweetImage),f.setAttribute("width","18"),f.setAttribute("height","18"),f.setAttribute("border","0"),f.style.marginBottom="5px",k.appendChild(f),k.setAttribute("title",mxResources.get("twitter")+" ("+a.formatFileSize(7168)+" max)"),k.style.verticalAlign=
|
||||
"bottom",k.style.paddingTop="4px",k.style.minWidth="46px",k.className="geBtn",h.appendChild(k))}f=mxUtils.button(mxResources.get("close"),function(){a.hideDialog()});h.appendChild(f);k=mxUtils.button(mxResources.get("copy"),function(){m.focus();mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?m.select():document.execCommand("selectAll",!1,null);document.execCommand("copy");a.alert(mxResources.get("copiedToClipboard"))});5E5>b.length?mxClient.IS_SF||null!=document.documentMode?
|
||||
f.className="geBtn gePrimaryBtn":(h.appendChild(k),k.className="geBtn gePrimaryBtn",f.className="geBtn"):(h.appendChild(l),f.className="geBtn",l.className="geBtn gePrimaryBtn");d.appendChild(h);this.container=d};EmbedDialog.showPreviewOption=!0;
|
||||
c.appendChild(d));this.init=function(){u.focus()};n.appendChild(c);this.container=n},EmbedDialog=function(a,b,c,d,e,g){d=document.createElement("div");var h=/^https?:\/\//.test(b)||/^mailto:\/\//.test(b);null!=g?mxUtils.write(d,g):mxUtils.write(d,mxResources.get(5E5>b.length?h?"link":"mainEmbedNotice":"preview")+":");mxUtils.br(d);g=document.createElement("div");g.style.position="absolute";g.style.top="30px";g.style.right="30px";g.style.color="gray";mxUtils.write(g,a.formatFileSize(b.length));d.appendChild(g);
|
||||
var m=document.createElement("textarea");m.setAttribute("autocomplete","off");m.setAttribute("autocorrect","off");m.setAttribute("autocapitalize","off");m.setAttribute("spellcheck","false");m.style.marginTop="10px";m.style.resize="none";m.style.height="150px";m.style.width="440px";m.style.border="1px solid gray";m.value=mxResources.get("updatingDocument");d.appendChild(m);mxUtils.br(d);this.init=function(){window.setTimeout(function(){5E5>b.length?(m.value=b,m.focus(),mxClient.IS_GC||mxClient.IS_FF||
|
||||
5<=document.documentMode||mxClient.IS_QUIRKS?m.select():document.execCommand("selectAll",!1,null)):(m.setAttribute("readonly","true"),m.value=b.substring(0,340)+"... ("+mxResources.get("drawingTooLarge")+")")},0)};g=document.createElement("div");g.style.position="absolute";g.style.bottom="36px";g.style.right="32px";var l=null;!EmbedDialog.showPreviewOption||mxClient.IS_CHROMEAPP&&!h||navigator.standalone||!(h||mxClient.IS_SVG&&(null==document.documentMode||9<document.documentMode))||(l=mxUtils.button(mxResources.get(5E5>
|
||||
b.length?"preview":"openInNewWindow"),function(){var d=5E5>b.length?m.value:b;if(null!=e)e(d);else if(h)try{var f=a.openLink(d);null!=f&&(null==c||0<c)&&window.setTimeout(mxUtils.bind(this,function(){null!=f&&null!=f.location.href&&f.location.href.substring(0,8)!=d.substring(0,8)&&(f.close(),a.handleError({message:mxResources.get("drawingTooLarge")}))}),c||500)}catch(q){a.handleError({message:q.message||mxResources.get("drawingTooLarge")})}else{var k=window.open().document;k.writeln("<html><head><title>"+
|
||||
encodeURIComponent(mxResources.get("preview"))+'</title><meta charset="utf-8"></head><body>'+b+"</body></html>");k.close()}}),l.className="geBtn",g.appendChild(l));if(!h||7500<b.length){var f=mxUtils.button(mxResources.get("download"),function(){a.hideDialog();a.saveData("embed.txt","txt",b,"text/plain")});f.className="geBtn";g.appendChild(f)}if(h&&(!a.isOffline()||mxClient.IS_CHROMEAPP)){if(51200>b.length){var k=mxUtils.button("",function(){try{var b="https://www.facebook.com/sharer.php?p[url]="+
|
||||
encodeURIComponent(m.value);a.openLink(b)}catch(t){a.handleError({message:t.message||mxResources.get("drawingTooLarge")})}}),f=document.createElement("img");f.setAttribute("src",Editor.facebookImage);f.setAttribute("width","18");f.setAttribute("height","18");f.setAttribute("border","0");k.appendChild(f);k.setAttribute("title",mxResources.get("facebook")+" ("+a.formatFileSize(51200)+" max)");k.style.verticalAlign="bottom";k.style.paddingTop="4px";k.style.minWidth="46px";k.className="geBtn";g.appendChild(k)}7168>
|
||||
b.length&&(k=mxUtils.button("",function(){try{var b="https://twitter.com/intent/tweet?text="+encodeURIComponent("Check out the diagram I made using @drawio")+"&url="+encodeURIComponent(m.value);a.openLink(b)}catch(t){a.handleError({message:t.message||mxResources.get("drawingTooLarge")})}}),f=document.createElement("img"),f.setAttribute("src",Editor.tweetImage),f.setAttribute("width","18"),f.setAttribute("height","18"),f.setAttribute("border","0"),f.style.marginBottom="5px",k.appendChild(f),k.setAttribute("title",
|
||||
mxResources.get("twitter")+" ("+a.formatFileSize(7168)+" max)"),k.style.verticalAlign="bottom",k.style.paddingTop="4px",k.style.minWidth="46px",k.className="geBtn",g.appendChild(k))}f=mxUtils.button(mxResources.get("close"),function(){a.hideDialog()});g.appendChild(f);k=mxUtils.button(mxResources.get("copy"),function(){m.focus();mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?m.select():document.execCommand("selectAll",!1,null);document.execCommand("copy");a.alert(mxResources.get("copiedToClipboard"))});
|
||||
5E5>b.length?mxClient.IS_SF||null!=document.documentMode?f.className="geBtn gePrimaryBtn":(g.appendChild(k),k.className="geBtn gePrimaryBtn",f.className="geBtn"):(g.appendChild(l),f.className="geBtn",l.className="geBtn gePrimaryBtn");d.appendChild(g);this.container=d};EmbedDialog.showPreviewOption=!0;
|
||||
var GoogleSitesDialog=function(a,b){function c(){var a=null!=w.getTitle()?w.getTitle():this.defaultFilename;if(E.checked&&""!=t.value){var b="https://www.draw.io/gadget.xml?type=4&diagram="+encodeURIComponent(mxUtils.htmlEntities(t.value));null!=a&&(b+="&title="+encodeURIComponent(a));0<B.length&&(b+="&s="+B);""!=u.value&&"0"!=u.value&&(b+="&border="+u.value);""!=n.value&&(b+="&height="+n.value);b+="&pan="+(q.checked?"1":"0");b+="&zoom="+(v.checked?"1":"0");b+="&fit="+(A.checked?"1":"0");b+="&resize="+
|
||||
(p.checked?"1":"0");b+="&x0="+Number(k.value);b+="&y0="+l;e.mathEnabled&&(b+="&math=1");C.checked?b+="&edit=_blank":x.checked&&(b+="&edit="+encodeURIComponent(mxUtils.htmlEntities(window.location.href)));f.value=b}else w.constructor==DriveFile||w.constructor==DropboxFile?(b="https://www.draw.io/gadget.xml?embed=0&diagram=",""!=t.value?b+=encodeURIComponent(mxUtils.htmlEntities(t.value))+"&type=3":(b+=w.getHash().substring(1),b=w.constructor==DropboxFile?b+"&type=2":b+"&type=1"),null!=a&&(b+="&title="+
|
||||
encodeURIComponent(a)),""!=n.value&&(a=parseInt(n.value)+parseInt(k.value),b+="&height="+a),f.value=b):f.value=""}var d=document.createElement("div"),e=a.editor.graph,g=e.getGraphBounds(),h=e.view.scale,m=Math.floor(g.x/h-e.view.translate.x),l=Math.floor(g.y/h-e.view.translate.y);mxUtils.write(d,mxResources.get("googleGadget")+":");mxUtils.br(d);var f=document.createElement("input");f.setAttribute("type","text");f.style.marginBottom="8px";f.style.marginTop="2px";f.style.width="410px";d.appendChild(f);
|
||||
|
@ -7106,7 +7107,7 @@ h=document.createElement("tr"),m=document.createElement("td");m.style.whiteSpace
|
|||
k.select()};f.appendChild(k);h.appendChild(l);h.appendChild(f);g.appendChild(h);h=document.createElement("tr");l=document.createElement("td");f=document.createElement("td");mxUtils.write(l,mxResources.get("top")+":");var n=document.createElement("input");n.setAttribute("type","text");n.style.width="100px";n.value="0";f.appendChild(n);h.appendChild(l);h.appendChild(f);g.appendChild(h);h=document.createElement("tr");l=document.createElement("td");f=document.createElement("td");mxUtils.write(l,mxResources.get("right")+
|
||||
":");var t=document.createElement("input");t.setAttribute("type","text");t.style.width="100px";t.value="0";f.appendChild(t);h.appendChild(l);h.appendChild(f);g.appendChild(h);h=document.createElement("tr");l=document.createElement("td");f=document.createElement("td");mxUtils.write(l,mxResources.get("bottom")+":");var u=document.createElement("input");u.setAttribute("type","text");u.style.width="100px";u.value="0";f.appendChild(u);h.appendChild(l);h.appendChild(f);g.appendChild(h);h=document.createElement("tr");
|
||||
l=document.createElement("td");f=document.createElement("td");mxUtils.write(l,mxResources.get("circle")+":");h.appendChild(l);var q=document.createElement("input");q.setAttribute("type","checkbox");f.appendChild(q);h.appendChild(f);g.appendChild(h);e.appendChild(g);d.appendChild(e);var e=mxUtils.button(mxResources.get("cancel"),function(){a.hideDialog()}),v=new Image,x=mxUtils.button(mxResources.get("apply"),function(){a.hideDialog();var b=document.createElement("canvas"),d=b.getContext("2d"),f=v.width,
|
||||
e=v.height,g=parseInt(k.value),h=parseInt(n.value),f=Math.max(1,f-g-parseInt(t.value)),e=Math.max(1,e-h-parseInt(u.value));b.width=f;b.height=e;q.checked&&(d.fillStyle="#000000",d.arc(f/2,e/2,Math.min(f/2,e/2),0,2*Math.PI),d.fill(),d.globalCompositeOperation="source-in");d.drawImage(v,g,h,f,e,0,0,f,e);c(b.toDataURL())});x.setAttribute("disabled","disabled");v.onload=function(){x.removeAttribute("disabled");m.innerHTML="";mxUtils.write(m,mxResources.get("width")+": "+v.width+" "+mxResources.get("height")+
|
||||
e=v.height,g=parseInt(k.value),x=parseInt(n.value),f=Math.max(1,f-g-parseInt(t.value)),e=Math.max(1,e-x-parseInt(u.value));b.width=f;b.height=e;q.checked&&(d.fillStyle="#000000",d.arc(f/2,e/2,Math.min(f/2,e/2),0,2*Math.PI),d.fill(),d.globalCompositeOperation="source-in");d.drawImage(v,g,x,f,e,0,0,f,e);c(b.toDataURL())});x.setAttribute("disabled","disabled");v.onload=function(){x.removeAttribute("disabled");m.innerHTML="";mxUtils.write(m,mxResources.get("width")+": "+v.width+" "+mxResources.get("height")+
|
||||
": "+v.height)};v.src=b;mxEvent.addListener(d,"keypress",function(a){13==a.keyCode&&x.click()});b=document.createElement("div");b.style.marginTop="20px";b.style.textAlign="right";a.editor.cancelFirst?(b.appendChild(e),b.appendChild(x)):(b.appendChild(x),b.appendChild(e));d.appendChild(b);this.container=d},EditGeometryDialog=function(a,b){var c=a.editor.graph,d=1==b.length?c.getCellGeometry(b[0]):null,e=document.createElement("div"),g=document.createElement("table"),h=document.createElement("tbody"),
|
||||
m=document.createElement("tr"),l=document.createElement("td"),f=document.createElement("td");g.style.paddingLeft="6px";mxUtils.write(l,mxResources.get("left")+":");var k=document.createElement("input");k.setAttribute("type","text");k.style.width="100px";k.value=null!=d?d.x:"";this.init=function(){k.focus();k.select()};f.appendChild(k);m.appendChild(l);m.appendChild(f);h.appendChild(m);m=document.createElement("tr");l=document.createElement("td");f=document.createElement("td");mxUtils.write(l,mxResources.get("top")+
|
||||
":");var n=document.createElement("input");n.setAttribute("type","text");n.style.width="100px";n.value=null!=d?d.y:"";f.appendChild(n);m.appendChild(l);m.appendChild(f);h.appendChild(m);m=document.createElement("tr");l=document.createElement("td");f=document.createElement("td");mxUtils.write(l,mxResources.get("width")+":");var t=document.createElement("input");t.setAttribute("type","text");t.style.width="100px";t.value=null!=d?d.width:"";f.appendChild(t);m.appendChild(l);m.appendChild(f);h.appendChild(m);
|
||||
|
@ -7186,8 +7187,8 @@ function(a){this.editorUi.actions.get("editShape").funct()})),b.setAttribute("ti
|
|||
"3";Graph.prototype.edgeMode="move"!=urlParams.edge;var t=Graph.prototype.init;Graph.prototype.init=function(){function a(a){b=a;if(mxClient.IS_QUIRKS||7==document.documentMode||8==document.documentMode)b=mxUtils.clone(a)}t.apply(this,arguments);var b=null;mxEvent.addListener(this.container,"mouseenter",a);mxEvent.addListener(this.container,"mousemove",a);mxEvent.addListener(this.container,"mouseleave",function(a){b=null});this.isMouseInsertPoint=function(){return null!=b};var c=this.getInsertPoint;
|
||||
this.getInsertPoint=function(){return null!=b?this.getPointForEvent(b):c.apply(this,arguments)};var d=this.layoutManager.getLayout;this.layoutManager.getLayout=function(a){var b=this.graph.view.getState(a),b=null!=b?b.style:this.graph.getCellStyle(a);if("undefined"!=typeof mxRackContainer&&"rack"==b.childLayout){var c=new mxStackLayout(this.graph,!1);c.setChildGeometry=function(a,b){b.height=Math.max(b.height,20);if(1<b.height/20){var c=b.height%20;b.height+=10<c?20-c:-c}this.graph.getModel().setGeometry(a,
|
||||
b)};c.fill=!0;c.unitSize=mxRackContainer.unitSize|20;c.marginLeft=b.marginLeft||0;c.marginRight=b.marginRight||0;c.marginTop=b.marginTop||0;c.marginBottom=b.marginBottom||0;c.resizeParent=!1;return c}return d.apply(this,arguments)}};var u=Graph.prototype.loadStylesheet;Graph.prototype.loadStylesheet=function(){u.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++)null!=a.actions[b].open&&(this.isCustomLink(a.actions[b].open)?this.customLinkClicked(a.actions[b].open):this.openLink(a.actions[b].open));this.model.beginUpdate();try{for(b=0;b<a.actions.length;b++)this.handleLinkAction(a.actions[b])}finally{this.model.endUpdate()}}};Graph.prototype.handleLinkAction=function(a){var b=[];null!=a.select&&this.isEnabled()&&(b=this.getCellsForAction(a.select),this.setSelectionCells(b));null!=a.scroll&&(b=this.getCellsForAction(a.scroll));null!=
|
||||
a.toggle&&this.toggleCells(this.getCellsForAction(a.toggle));null!=a.show&&this.setCellsVisible(this.getCellsForAction(a.show),!0);null!=a.hide&&this.setCellsVisible(this.getCellsForAction(a.hide),!1);null!=a.highlight&&(b=this.getCellsForAction(a.highlight),this.highlightCells(b,a.highlight.color,a.highlight.duration,a.highlight.opacity));0<b.length&&this.scrollCellToVisible(b[0])};Graph.prototype.getCellsForAction=function(a){return this.getCellsById(a.cells).concat(this.getCellsForTags(a.tags))};
|
||||
0;b<a.actions.length;b++)null!=a.actions[b].open&&(this.isCustomLink(a.actions[b].open)?this.customLinkClicked(a.actions[b].open):this.openLink(a.actions[b].open));this.model.beginUpdate();try{for(b=0;b<a.actions.length;b++)this.handleLinkAction(a.actions[b])}finally{this.model.endUpdate()}}};Graph.prototype.handleLinkAction=function(a){var b=[];null!=a.select&&this.isEnabled()&&(b=this.getCellsForAction(a.select),this.setSelectionCells(b));null!=a.highlight&&(b=this.getCellsForAction(a.highlight),
|
||||
this.highlightCells(b,a.highlight.color,a.highlight.duration,a.highlight.opacity));null!=a.toggle&&this.toggleCells(this.getCellsForAction(a.toggle));null!=a.show&&this.setCellsVisible(this.getCellsForAction(a.show),!0);null!=a.hide&&this.setCellsVisible(this.getCellsForAction(a.hide),!1);null!=a.scroll&&(b=this.getCellsForAction(a.scroll));0<b.length&&this.scrollCellToVisible(b[0])};Graph.prototype.getCellsForAction=function(a){return this.getCellsById(a.cells).concat(this.getCellsForTags(a.tags))};
|
||||
Graph.prototype.getCellsById=function(a){var b=[];if(null!=a)for(var c=0;c<a.length;c++)if("*"==a[c])var d=this.getDefaultParent(),b=b.concat(this.model.filterDescendants(function(a){return a!=d},d));else{var f=this.model.getCell(a[c]);null!=f&&b.push(f)}return b};Graph.prototype.getCellsForTags=function(a,b,c){var d=[];if(null!=a){b=null!=b?b:this.model.getDescendants(this.model.getRoot());c=null!=c?c:"tags";for(var f=0;f<b.length;f++)if(this.model.isVertex(b[f])||this.model.isEdge(b[f])){var k=
|
||||
null!=b[f].value&&"object"==typeof b[f].value?mxUtils.trim(b[f].value.getAttribute(c)||""):"",e=!0;if(0<k.length)for(var k=k.toLowerCase().split(" "),n=0;n<a.length&&e;n++)var p=mxUtils.trim(a[n]).toLowerCase(),e=e&&(0==p.length||0<=mxUtils.indexOf(k,p));else e=0==a.length;e&&d.push(b[f])}}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,d){for(var f=0;f<a.length;f++)this.highlightCell(a[f],b,c,d)};Graph.prototype.highlightCell=function(a,b,c,d){b=null!=b?b:mxConstants.DEFAULT_VALID_COLOR;c=null!=c?c:1E3;a=this.view.getState(a);if(null!=a){var f=Math.max(5,mxUtils.getValue(a.style,mxConstants.STYLE_STROKEWIDTH,1)+4),k=new mxCellHighlight(this,b,f,!1);null!=
|
||||
|
@ -7223,7 +7224,7 @@ k.appendChild(h);e=document.createElement("div");e.style.cssText="text-align:rig
|
|||
d(!1)}),q.className="geBtn",e.appendChild(q));q=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){a.hideDialog();d(!0)});q.className="geBtn gePrimaryBtn";e.appendChild(q);a.editor.cancelFirst||e.appendChild(h);k.appendChild(e);this.container=k};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))}})();
|
||||
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,c,d){d.ui=a.ui;return c};a.afterDecode=function(a,c,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="8.8.6";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname)&&"support.draw.io"!=window.location.hostname;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.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';
|
||||
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,c,d){d.ui=a.ui;return c};a.afterDecode=function(a,c,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="8.8.7";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname)&&"support.draw.io"!=window.location.hostname;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.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.sidebarFooterHeight=36;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.currentFile=null;EditorUi.prototype.printPdfExport=
|
||||
!1;EditorUi.prototype.pdfPageExport=!0;EditorUi.prototype.formatEnabled="0"!=urlParams.format;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(u){}try{var b=document.createElement("canvas"),c=new Image;c.onload=function(){try{b.getContext("2d").drawImage(c,0,0);var a=b.toDataURL("image/png");EditorUi.prototype.useCanvasForExport=
|
||||
|
@ -7274,25 +7275,25 @@ function(){this.isScratchpadEnabled()&&(null==this.scratchpad?this.getLocalData(
|
|||
a&&(this.removeLibrarySidebar(a.getHash()),a.constructor!=LocalLibrary&&mxSettings.removeCustomLibrary(a.getHash()),".scratchpad"==a.title&&(this.scratchpad=null))};EditorUi.prototype.removeLibrarySidebar=function(a){var b=this.sidebar.palettes[a];if(null!=b){for(var c=0;c<b.length;c++)b[c].parentNode.removeChild(b[c]);delete this.sidebar.palettes[a]}};EditorUi.prototype.repositionLibrary=function(a){var b=this.sidebar.container;if(null==a){var c=this.sidebar.palettes["L.scratchpad"];null==c&&(c=
|
||||
this.sidebar.palettes.search);null!=c&&(a=c[c.length-1].nextSibling)}a=null!=a?a:b.firstChild.nextSibling.nextSibling;var c=b.lastChild,d=c.previousSibling;b.insertBefore(c,a);b.insertBefore(d,c)};EditorUi.prototype.loadLibrary=function(a){var b=mxUtils.parseXml(a.getData());if("mxlibrary"==b.documentElement.nodeName){var c=JSON.parse(mxUtils.getTextContent(b.documentElement));this.libraryLoaded(a,c,b.documentElement.getAttribute("title"))}else throw{message:mxResources.get("notALibraryFile")};};
|
||||
EditorUi.prototype.getLibraryStorageHint=function(a){return""};EditorUi.prototype.libraryLoaded=function(a,b,c){if(null!=this.sidebar){a.constructor!=LocalLibrary&&mxSettings.addCustomLibrary(a.getHash());".scratchpad"==a.title&&(this.scratchpad=a);var d=this.sidebar.palettes[a.getHash()],d=null!=d?d[d.length-1].nextSibling:null;this.removeLibrarySidebar(a.getHash());var f=null,e=mxUtils.bind(this,function(b,c){if(0==b.length&&a.isEditable())null==f&&(f=document.createElement("div"),mxUtils.setPrefixedStyle(f.style,
|
||||
"borderRadius","6px"),f.style.border="3px dotted lightGray",f.style.textAlign="center",f.style.padding="8px",f.style.color="#B3B3B3",mxUtils.write(f,mxResources.get("dragElementsHere"))),c.appendChild(f);else for(var d=0;d<b.length;d++){var e=b[d],k=e.data;if(null!=k){var k=this.convertDataUri(k),n="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==e.aspect&&(n+="aspect=fixed;");c.appendChild(this.sidebar.createVertexTemplate(n+"image="+k,e.w,e.h,"",e.title||"",!1,
|
||||
"borderRadius","6px"),f.style.border="3px dotted lightGray",f.style.textAlign="center",f.style.padding="8px",f.style.color="#B3B3B3",mxUtils.write(f,mxResources.get("dragElementsHere"))),c.appendChild(f);else for(var d=0;d<b.length;d++){var e=b[d],k=e.data;if(null!=k){var k=this.convertDataUri(k),g="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==e.aspect&&(g+="aspect=fixed;");c.appendChild(this.sidebar.createVertexTemplate(g+"image="+k,e.w,e.h,"",e.title||"",!1,
|
||||
!1,!0))}else null!=e.xml&&(k=this.stringToCells(this.editor.graph.decompress(e.xml)),0<k.length&&c.appendChild(this.sidebar.createVertexTemplateFromCells(k,e.w,e.h,e.title||"",!0,!1,!0)))}});if(null!=this.sidebar&&null!=b)for(var k=0;k<b.length;k++)mxUtils.bind(this,function(a){var b=a.data;null!=b&&null!=a.title?this.sidebar.addEntry(a.title,mxUtils.bind(this,function(){b=this.convertDataUri(b);var c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;imageAspect=0;";"fixed"==a.aspect&&(c+=
|
||||
"aspect=fixed;");return this.sidebar.createVertexTemplate(c+"image="+b,a.w,a.h,"",a.title||"",!1,!1,!0)})):null!=a.xml&&null!=a.title&&this.sidebar.addEntry(a.title,mxUtils.bind(this,function(){var b=this.stringToCells(this.editor.graph.decompress(a.xml));return this.sidebar.createVertexTemplateFromCells(b,a.w,a.h,a.title||"",!0,!1,!0)}))})(b[k]);c=null!=c&&0<c.length?c:a.getTitle();var n=this.sidebar.addPalette(a.getHash(),c,!0,mxUtils.bind(this,function(a){e(b,a)}));this.repositionLibrary(d);var g=
|
||||
n.parentNode.previousSibling;c=g.getAttribute("title");null!=c&&0<c.length&&".scratchpad"!=a.title&&g.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+c);var p=document.createElement("div");p.style.position="absolute";p.style.right="0px";p.style.top="0px";p.style.padding="8px";mxClient.IS_QUIRKS||8==document.documentMode||(p.style.backgroundColor="inherit");g.style.position="relative";var h=document.createElement("img");h.setAttribute("src",Dialog.prototype.closeImage);h.setAttribute("title",
|
||||
"aspect=fixed;");return this.sidebar.createVertexTemplate(c+"image="+b,a.w,a.h,"",a.title||"",!1,!1,!0)})):null!=a.xml&&null!=a.title&&this.sidebar.addEntry(a.title,mxUtils.bind(this,function(){var b=this.stringToCells(this.editor.graph.decompress(a.xml));return this.sidebar.createVertexTemplateFromCells(b,a.w,a.h,a.title||"",!0,!1,!0)}))})(b[k]);c=null!=c&&0<c.length?c:a.getTitle();var g=this.sidebar.addPalette(a.getHash(),c,!0,mxUtils.bind(this,function(a){e(b,a)}));this.repositionLibrary(d);var n=
|
||||
g.parentNode.previousSibling;c=n.getAttribute("title");null!=c&&0<c.length&&".scratchpad"!=a.title&&n.setAttribute("title",this.getLibraryStorageHint(a)+"\n"+c);var p=document.createElement("div");p.style.position="absolute";p.style.right="0px";p.style.top="0px";p.style.padding="8px";mxClient.IS_QUIRKS||8==document.documentMode||(p.style.backgroundColor="inherit");n.style.position="relative";var h=document.createElement("img");h.setAttribute("src",Dialog.prototype.closeImage);h.setAttribute("title",
|
||||
mxResources.get("close"));h.setAttribute("valign","absmiddle");h.setAttribute("border","0");h.style.margin="0 3px";var m=null;if(".scratchpad"!=a.title||this.closableScratchpad)p.appendChild(h),mxEvent.addListener(h,"click",mxUtils.bind(this,function(b){if(!mxEvent.isConsumed(b)){var c=mxUtils.bind(this,function(){this.closeLibrary(a)});null!=m?this.confirm(mxResources.get("allChangesLost"),null,c,mxResources.get("cancel"),mxResources.get("discardChanges")):c();mxEvent.consume(b)}}));if(a.isEditable()){var l=
|
||||
this.editor.graph,w=null,J=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),n,b,a,a.getMode());mxEvent.consume(c)}),y=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=w&&null!=w.parentNode&&w.parentNode.removeChild(w),w=h.cloneNode(!1),w.setAttribute("src",Editor.spinImage),w.setAttribute("title",mxResources.get("saving")),w.style.cursor="default",w.style.marginRight="2px",w.style.marginTop="-2px",p.insertBefore(w,p.firstChild),g.style.paddingRight=18*p.childNodes.length+
|
||||
"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=w&&null!=w.parentNode&&(w.parentNode.removeChild(w),g.style.paddingRight=18*p.childNodes.length+"px")})):null==m&&(m=h.cloneNode(!1),m.setAttribute("src",IMAGE_PATH+"/download.png"),m.setAttribute("title",mxResources.get("save")),p.insertBefore(m,p.firstChild),mxEvent.addListener(m,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==m||a.isModified()||
|
||||
(g.style.paddingRight=18*p.childNodes.length+"px",m.parentNode.removeChild(m),m=null)});mxEvent.consume(c)})),g.style.paddingRight=18*p.childNodes.length+"px")}),D=mxUtils.bind(this,function(a,c,d,e){a=l.cloneCells(mxUtils.sortCells(l.model.getTopmostCells(a)));for(var k=0;k<a.length;k++){var g=l.getCellGeometry(a[k]);null!=g&&g.translate(-c.x,-c.y)}n.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,e||"",!0,!1,!1));a={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),
|
||||
this.editor.graph,w=null,J=mxUtils.bind(this,function(c){this.showLibraryDialog(a.getTitle(),g,b,a,a.getMode());mxEvent.consume(c)}),y=mxUtils.bind(this,function(c){a.setModified(!0);a.isAutosave()?(null!=w&&null!=w.parentNode&&w.parentNode.removeChild(w),w=h.cloneNode(!1),w.setAttribute("src",Editor.spinImage),w.setAttribute("title",mxResources.get("saving")),w.style.cursor="default",w.style.marginRight="2px",w.style.marginTop="-2px",p.insertBefore(w,p.firstChild),n.style.paddingRight=18*p.childNodes.length+
|
||||
"px",this.saveLibrary(a.getTitle(),b,a,a.getMode(),!0,!0,function(){null!=w&&null!=w.parentNode&&(w.parentNode.removeChild(w),n.style.paddingRight=18*p.childNodes.length+"px")})):null==m&&(m=h.cloneNode(!1),m.setAttribute("src",IMAGE_PATH+"/download.png"),m.setAttribute("title",mxResources.get("save")),p.insertBefore(m,p.firstChild),mxEvent.addListener(m,"click",mxUtils.bind(this,function(c){this.saveLibrary(a.getTitle(),b,a,a.getMode(),a.constructor==LocalLibrary,!0,function(){null==m||a.isModified()||
|
||||
(n.style.paddingRight=18*p.childNodes.length+"px",m.parentNode.removeChild(m),m=null)});mxEvent.consume(c)})),n.style.paddingRight=18*p.childNodes.length+"px")}),D=mxUtils.bind(this,function(a,c,d,e){a=l.cloneCells(mxUtils.sortCells(l.model.getTopmostCells(a)));for(var k=0;k<a.length;k++){var n=l.getCellGeometry(a[k]);null!=n&&n.translate(-c.x,-c.y)}g.appendChild(this.sidebar.createVertexTemplateFromCells(a,c.width,c.height,e||"",!0,!1,!1));a={xml:this.editor.graph.compress(mxUtils.getXml(this.editor.graph.encodeCells(a))),
|
||||
w:c.width,h:c.height};null!=e&&(a.title=e);b.push(a);y(d);null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)}),H=mxUtils.bind(this,function(a){if(l.isSelectionEmpty())l.getRubberband().isActive()?(l.getRubberband().execute(a),l.getRubberband().reset()):this.showError(mxResources.get("error"),mxResources.get("nothingIsSelected"),mxResources.get("ok"));else{var b=l.getSelectionCells(),c=l.view.getBounds(b),d=l.view.scale;c.x/=d;c.y/=d;c.width/=d;c.height/=d;c.x-=l.view.translate.x;
|
||||
c.y-=l.view.translate.y;D(b,c)}mxEvent.consume(a)});n.style.border="3px solid transparent";mxEvent.addGestureListeners(n,function(){},mxUtils.bind(this,function(a){l.isMouseDown&&null!=l.panningManager&&null!=l.graphHandler.shape&&(l.graphHandler.shape.node.style.visibility="hidden",null!=f?f.style.border="3px dotted rgb(254, 137, 12)":n.style.border="3px dotted rgb(254, 137, 12)",n.style.cursor="copy",l.panningManager.stop(),l.autoScroll=!1,null!=l.graphHandler.guide&&l.graphHandler.guide.setVisible(!1),
|
||||
null!=l.graphHandler.hint&&(l.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,function(a){l.isMouseDown&&null!=l.panningManager&&null!=l.graphHandler&&(n.style.border="3px solid transparent",null!=f&&(f.style.border="3px dotted lightGray"),n.style.cursor="default",this.sidebar.showTooltips=!0,l.panningManager.stop(),l.graphHandler.reset(),l.isMouseDown=!1,l.autoScroll=!0,H(a),mxEvent.consume(a))}));mxEvent.addListener(n,"mouseleave",mxUtils.bind(this,function(a){l.isMouseDown&&
|
||||
null!=l.graphHandler.shape&&(l.graphHandler.shape.node.style.visibility="visible",n.style.border="3px solid transparent",n.style.cursor="",l.autoScroll=!0,null!=l.graphHandler.guide&&l.graphHandler.guide.setVisible(!0),null!=l.graphHandler.hint&&(l.graphHandler.hint.style.visibility="visible"),null!=f&&(f.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(n,"dragover",mxUtils.bind(this,function(a){null!=f?f.style.border="3px dotted rgb(254, 137, 12)":n.style.border="3px dotted rgb(254, 137, 12)";
|
||||
a.dataTransfer.dropEffect="copy";n.style.cursor="copy";this.sidebar.hideTooltip();a.stopPropagation();a.preventDefault()})),mxEvent.addListener(n,"drop",mxUtils.bind(this,function(a){n.style.border="3px solid transparent";n.style.cursor="";null!=f&&(f.style.border="3px dotted lightGray");0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,k,g,p,h,m,t,l){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,h),c)],c[0].vertex=!0,D(c,new mxRectangle(0,0,p,h),a,mxEvent.isAltDown(a)?null:m.substring(0,m.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var v=!1,q=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var k=mxUtils.parseXml(c);if("mxlibrary"==k.documentElement.nodeName)try{var g=JSON.parse(mxUtils.getTextContent(k.documentElement));e(g,n);b=b.concat(g);y(a);
|
||||
this.spinner.stop();v=!0}catch(U){}else if("mxfile"==k.documentElement.nodeName)try{for(var p=k.documentElement.getElementsByTagName("diagram"),k=0;k<p.length;k++){var g=mxUtils.getTextContent(p[k]),h=this.stringToCells(this.editor.graph.decompress(g)),m=this.editor.graph.getBoundingBoxFromGeometry(h);D(h,new mxRectangle(0,0,m.width,m.height),a)}v=!0}catch(U){null!=window.console&&console.log("error in drop handler:",U)}}v||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));
|
||||
c.y-=l.view.translate.y;D(b,c)}mxEvent.consume(a)});g.style.border="3px solid transparent";mxEvent.addGestureListeners(g,function(){},mxUtils.bind(this,function(a){l.isMouseDown&&null!=l.panningManager&&null!=l.graphHandler.shape&&(l.graphHandler.shape.node.style.visibility="hidden",null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)",g.style.cursor="copy",l.panningManager.stop(),l.autoScroll=!1,null!=l.graphHandler.guide&&l.graphHandler.guide.setVisible(!1),
|
||||
null!=l.graphHandler.hint&&(l.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(a))}),mxUtils.bind(this,function(a){l.isMouseDown&&null!=l.panningManager&&null!=l.graphHandler&&(g.style.border="3px solid transparent",null!=f&&(f.style.border="3px dotted lightGray"),g.style.cursor="default",this.sidebar.showTooltips=!0,l.panningManager.stop(),l.graphHandler.reset(),l.isMouseDown=!1,l.autoScroll=!0,H(a),mxEvent.consume(a))}));mxEvent.addListener(g,"mouseleave",mxUtils.bind(this,function(a){l.isMouseDown&&
|
||||
null!=l.graphHandler.shape&&(l.graphHandler.shape.node.style.visibility="visible",g.style.border="3px solid transparent",g.style.cursor="",l.autoScroll=!0,null!=l.graphHandler.guide&&l.graphHandler.guide.setVisible(!0),null!=l.graphHandler.hint&&(l.graphHandler.hint.style.visibility="visible"),null!=f&&(f.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(g,"dragover",mxUtils.bind(this,function(a){null!=f?f.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)";
|
||||
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.border="3px solid transparent";g.style.cursor="";null!=f&&(f.style.border="3px dotted lightGray");0<a.dataTransfer.files.length&&this.importFiles(a.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,d,k,n,p,h,m,t,l){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,h),c)],c[0].vertex=!0,D(c,new mxRectangle(0,0,p,h),a,mxEvent.isAltDown(a)?null:m.substring(0,m.lastIndexOf(".")).replace(/_/g," ")),null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null);else{var v=!1,q=mxUtils.bind(this,function(c,d){if(null!=c&&"text/xml"==d){var k=mxUtils.parseXml(c);if("mxlibrary"==k.documentElement.nodeName)try{var n=JSON.parse(mxUtils.getTextContent(k.documentElement));e(n,g);b=b.concat(n);y(a);
|
||||
this.spinner.stop();v=!0}catch(U){}else if("mxfile"==k.documentElement.nodeName)try{for(var p=k.documentElement.getElementsByTagName("diagram"),k=0;k<p.length;k++){var n=mxUtils.getTextContent(p[k]),h=this.stringToCells(this.editor.graph.decompress(n)),m=this.editor.graph.getBoundingBoxFromGeometry(h);D(h,new mxRectangle(0,0,m.width,m.height),a)}v=!0}catch(U){null!=window.console&&console.log("error in drop handler:",U)}}v||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));
|
||||
null!=f&&null!=f.parentNode&&0<b.length&&(f.parentNode.removeChild(f),f=null)});null!=l&&null!=m&&(/(\.vsdx?)($|\?)/i.test(m)||/(\.vssx)($|\?)/i.test(m))?this.importVisio(l,function(a){q(a,"text/xml")},null,m):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,m)&&null!=l?this.parseFile(l,mxUtils.bind(this,function(a){4==a.readyState&&(this.spinner.stop(),200<=a.status&&299>=a.status?q(a.responseText,"text/xml"):this.handleError({message:mxResources.get(413==a.status?"drawingTooLarge":
|
||||
"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):q(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(n,"dragleave",function(a){null!=f?f.style.border="3px dotted lightGray":(n.style.border="3px solid transparent",n.style.cursor="");a.stopPropagation();a.preventDefault()}));h=h.cloneNode(!1);h.setAttribute("src",Editor.editImage);h.setAttribute("title",mxResources.get("edit"));p.insertBefore(h,p.firstChild);mxEvent.addListener(h,"click",J);mxEvent.addListener(n,
|
||||
"dblclick",function(a){mxEvent.getSource(a)==n&&J(a)});c=h.cloneNode(!1);c.setAttribute("src",Editor.plusImage);c.setAttribute("title",mxResources.get("add"));p.insertBefore(c,p.firstChild);mxEvent.addListener(c,"click",H);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;",mxUtils.write(c,"?"),mxEvent.addGestureListeners(c,
|
||||
mxUtils.bind(this,function(a){this.openLink(EditorUi.scratchpadHelpLink);mxEvent.consume(a)})),p.insertBefore(c,p.firstChild))}g.appendChild(p);g.style.paddingRight=18*p.childNodes.length+"px"}};"1"==urlParams.offline||EditorUi.isElectronApp?EditorUi.prototype.footerHeight=4:("1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var a=document.getElementById("geFooter");
|
||||
"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):q(c,d)}}));a.stopPropagation();a.preventDefault()})),mxEvent.addListener(g,"dragleave",function(a){null!=f?f.style.border="3px dotted lightGray":(g.style.border="3px solid transparent",g.style.cursor="");a.stopPropagation();a.preventDefault()}));h=h.cloneNode(!1);h.setAttribute("src",Editor.editImage);h.setAttribute("title",mxResources.get("edit"));p.insertBefore(h,p.firstChild);mxEvent.addListener(h,"click",J);mxEvent.addListener(g,
|
||||
"dblclick",function(a){mxEvent.getSource(a)==g&&J(a)});c=h.cloneNode(!1);c.setAttribute("src",Editor.plusImage);c.setAttribute("title",mxResources.get("add"));p.insertBefore(c,p.firstChild);mxEvent.addListener(c,"click",H);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;",mxUtils.write(c,"?"),mxEvent.addGestureListeners(c,
|
||||
mxUtils.bind(this,function(a){this.openLink(EditorUi.scratchpadHelpLink);mxEvent.consume(a)})),p.insertBefore(c,p.firstChild))}n.appendChild(p);n.style.paddingRight=18*p.childNodes.length+"px"}};"1"==urlParams.offline||EditorUi.isElectronApp?EditorUi.prototype.footerHeight=4:("1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var a=document.getElementById("geFooter");
|
||||
if(null!=a){a.style.visibility="visible";var b=document.createElement("img");b.setAttribute("border","0");b.setAttribute("src",Dialog.prototype.closeImage);b.setAttribute("title",mxResources.get("hide"));a.appendChild(b);mxClient.IS_QUIRKS&&(b.style.position="relative",b.style.styleFloat="right",b.style.top="-30px",b.style.left="164px",b.style.cursor="pointer");mxEvent.addListener(b,"click",mxUtils.bind(this,function(){this.hideFooter()}))}return a});EditorUi.initTheme=function(){"atlas"==uiTheme?
|
||||
(mxClient.link("stylesheet",STYLE_PATH+"/atlas.css"),"undefined"!==typeof Toolbar&&(Toolbar.prototype.unselectedBackground=mxClient.IS_QUIRKS?"none":"linear-gradient(rgb(255, 255, 255) 0px, rgb(242, 242, 242) 100%)",Toolbar.prototype.selectedBackground="rgb(242, 242, 242)"),Editor.prototype.initialTopSpacing=3,EditorUi.prototype.menubarHeight=41,EditorUi.prototype.toolbarHeight=38,EditorUi.prototype.hsplitPosition=188,Sidebar.prototype.thumbWidth=46,Sidebar.prototype.thumbHeight=46,Sidebar.prototype.thumbPadding=
|
||||
5<=document.documentMode?0:1,Sidebar.prototype.thumbBorder=2):"dark"==uiTheme&&(mxClient.link("stylesheet",STYLE_PATH+"/dark.css"),Dialog.backdropColor="#2a2a2a",Graph.prototype.defaultThemeName="darkTheme",Graph.prototype.defaultPageBackgroundColor="#2a2a2a",Graph.prototype.defaultGraphBackground=null,Graph.prototype.defaultPageBorderColor="#505759",Graph.prototype.svgShadowColor="#e0e0e0",Graph.prototype.svgShadowOpacity="0.6",Graph.prototype.svgShadowSize="0.8",Graph.prototype.svgShadowBlur="1.4",
|
||||
|
@ -7327,27 +7328,27 @@ mxUtils.bind(this,function(){mxUtils.popup(d)}))});this.convertMath(this.editor.
|
|||
"disabled");g&&(a.appendChild(f),c=document.createElement("span"),mxUtils.write(c,b),a.appendChild(c),e||mxUtils.br(a),mxEvent.addListener(c,"click",mxUtils.bind(this,function(a){"disabled"!=f.getAttribute("disabled")&&(f.checked=!f.checked,mxEvent.consume(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(){k.innerHTML='<div style="width:100%;height:100%;box-sizing:border-box;'+(null!=f&&f!=mxConstants.NONE?"border:1px solid black;background-color:"+f:"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 e=document.createElement("option");e.setAttribute("value","auto");mxUtils.write(e,mxResources.get("automatic"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","blank");mxUtils.write(e,mxResources.get("openInNewWindow"));d.appendChild(e);e=document.createElement("option");e.setAttribute("value","self");mxUtils.write(e,mxResources.get("openInThisWindow"));d.appendChild(e);b&&(e=document.createElement("option"),e.setAttribute("value",
|
||||
"frame"),mxUtils.write(e,mxResources.get("openInThisWindow")+" ("+mxResources.get("iframe")+")"),d.appendChild(e));a.appendChild(d);mxUtils.write(a,mxResources.get("borderColor")+":");var f="#0000ff",k=null,k=mxUtils.button("",mxUtils.bind(this,function(a){this.pickColor(f||"none",function(a){f=a;c()});mxEvent.consume(a)}));c();k.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";k.style.marginLeft="4px";k.style.height="22px";k.style.width="22px";k.style.position="relative";k.style.top=mxClient.IS_IE||
|
||||
mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";k.className="geColorBtn";a.appendChild(k);mxUtils.br(a);return{getColor:function(){return f},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=function(a,b,c,d,e,g,h,m){var f=this.getCurrentFile(),k=[];d&&(k.push("lightbox=1"),"auto"!=a&&k.push("target="+a),null!=b&&b!=mxConstants.NONE&&k.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),null!=e&&0<e.length&&k.push("edit="+encodeURIComponent(e)),g&&
|
||||
getEditSelect:function(){return e}}};EditorUi.prototype.addLinkSection=function(a,b){function c(){k.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",k=null,k=mxUtils.button("",mxUtils.bind(this,function(a){this.pickColor(e||"none",function(a){e=a;c()});mxEvent.consume(a)}));c();k.style.padding=mxClient.IS_FF?"4px 2px 4px 2px":"4px";k.style.marginLeft="4px";k.style.height="22px";k.style.width="22px";k.style.position="relative";k.style.top=mxClient.IS_IE||
|
||||
mxClient.IS_IE11||mxClient.IS_EDGE?"6px":"1px";k.className="geColorBtn";a.appendChild(k);mxUtils.br(a);return{getColor:function(){return e},getTarget:function(){return d.value},focus:function(){d.focus()}}};EditorUi.prototype.createLink=function(a,b,c,d,e,g,h,m){var f=this.getCurrentFile(),k=[];d&&(k.push("lightbox=1"),"auto"!=a&&k.push("target="+a),null!=b&&b!=mxConstants.NONE&&k.push("highlight="+("#"==b.charAt(0)?b.substring(1):b)),null!=e&&0<e.length&&k.push("edit="+encodeURIComponent(e)),g&&
|
||||
k.push("layers=1"),this.editor.graph.foldingEnabled&&k.push("nav=1"));if(c&&null!=this.pages&&null!=this.currentPage)for(a=0;a<this.pages.length;a++)if(this.pages[a]==this.currentPage){0<a&&k.push("page="+a);break}a=!0;null!=h?c="#U"+encodeURIComponent(h):(f=this.getCurrentFile(),m||null==f||f.constructor!=window.DriveFile?c="#R"+encodeURIComponent(c?this.getFileData(!0,null,null,null,null,null,null,!0):this.editor.graph.compress(mxUtils.getXml(this.editor.getGraphXml()))):(c="#"+f.getHash(),a=!1));
|
||||
a&&null!=f&&null!=f.getTitle()&&f.getTitle()!=this.defaultFilename&&k.push("title="+encodeURIComponent(f.getTitle()));return(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||!/.*\.draw\.io$/.test(window.location.hostname)?"https://www.draw.io/":"https://"+window.location.host+"/")+(0<k.length?"?"+k.join("&"):"")+c};EditorUi.prototype.createHtml=function(a,b,c,d,e,g,h,m,l,p,A){this.getBasenames();var f={};""!=e&&e!=mxConstants.NONE&&(f.highlight=e);"auto"!==d&&(f.target=d);l||(f.lightbox=!1);f.nav=this.editor.graph.foldingEnabled;
|
||||
c=parseInt(c);isNaN(c)||100==c||(f.zoom=c/100);c=[];h&&(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&&(l&&c.push("lightbox"),f.toolbar=c.join(" "));null!=p&&0<p.length&&(f.edit=p);null!=a?f.url=a:f.xml=this.getFileData(!0,null,null,null,null,!h);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):"";A(b,'<script type="text/javascript" src="'+(0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1":"https://www.draw.io/embed2.js?")+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/js/viewer.min.js")+'">\x3c/script>')};EditorUi.prototype.showHtmlDialog=function(a,b,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");
|
||||
mxUtils.write(f,mxResources.get("html"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(f);var k=document.createElement("div");k.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var g=document.createElement("input");g.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";g.setAttribute("value","url");g.setAttribute("type","radio");g.setAttribute("name","type-embedhtmldialog");f=g.cloneNode(!0);f.setAttribute("value",
|
||||
"copy");k.appendChild(f);var n=document.createElement("span");mxUtils.write(n,mxResources.get("includeCopyOfMyDiagram"));k.appendChild(n);mxUtils.br(k);k.appendChild(g);n=document.createElement("span");mxUtils.write(n,mxResources.get("publicDiagramUrl"));k.appendChild(n);var p=this.getCurrentFile();null==c&&null!=p&&p.constructor==window.DriveFile&&(n=document.createElement("a"),n.style.paddingLeft="12px",n.style.color="gray",n.setAttribute("href","javascript:void(0);"),mxUtils.write(n,mxResources.get("share")),
|
||||
k.appendChild(n),mxEvent.addListener(n,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(p.getId())})));f.setAttribute("checked","checked");null==c&&g.setAttribute("disabled","disabled");e.appendChild(k);var h=this.addLinkSection(e),m=this.addCheckbox(e,mxResources.get("zoom"),!0,null,!0);mxUtils.write(e,":");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="100%";e.appendChild(l);var t=this.addCheckbox(e,mxResources.get("fit"),!0),k=null!=this.pages&&1<this.pages.length,J=J=this.addCheckbox(e,mxResources.get("allPages"),k,!k),y=this.addCheckbox(e,mxResources.get("layers"),!0),D=this.addCheckbox(e,mxResources.get("lightbox"),!0),H=this.addEditButton(e,D),z=H.getEditInput();z.style.marginBottom="16px";mxEvent.addListener(D,"change",function(){D.checked?z.removeAttribute("disabled"):z.setAttribute("disabled","disabled");z.checked&&D.checked?
|
||||
H.getEditSelect().removeAttribute("disabled"):H.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){d(g.checked?c:null,m.checked,l.value,h.getTarget(),h.getColor(),t.checked,J.checked,y.checked,D.checked,H.getLink())}),null,a,b);this.showDialog(a.container,340,384,!0,!0);f.focus()};EditorUi.prototype.showPublishLinkDialog=function(a,b,c,d,e,g){var f=document.createElement("div");f.style.whiteSpace="nowrap";var k=document.createElement("h3");
|
||||
mxUtils.htmlEntities(JSON.stringify(f))+'"></div>';a=null!=a?"&fetch="+encodeURIComponent(a):"";A(b,'<script type="text/javascript" src="'+(0<a.length?("1"==urlParams.dev?"https://test.draw.io/embed2.js?dev=1":"https://www.draw.io/embed2.js?")+a:"1"==urlParams.dev?"https://test.draw.io/js/viewer.min.js":"https://www.draw.io/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 k=document.createElement("div");k.style.cssText="border-bottom:1px solid lightGray;padding-bottom:8px;margin-bottom:12px;";var g=document.createElement("input");g.style.cssText="margin-right:8px;margin-top:8px;margin-bottom:8px;";g.setAttribute("value","url");g.setAttribute("type","radio");g.setAttribute("name","type-embedhtmldialog");e=g.cloneNode(!0);e.setAttribute("value",
|
||||
"copy");k.appendChild(e);var n=document.createElement("span");mxUtils.write(n,mxResources.get("includeCopyOfMyDiagram"));k.appendChild(n);mxUtils.br(k);k.appendChild(g);n=document.createElement("span");mxUtils.write(n,mxResources.get("publicDiagramUrl"));k.appendChild(n);var p=this.getCurrentFile();null==c&&null!=p&&p.constructor==window.DriveFile&&(n=document.createElement("a"),n.style.paddingLeft="12px",n.style.color="gray",n.setAttribute("href","javascript:void(0);"),mxUtils.write(n,mxResources.get("share")),
|
||||
k.appendChild(n),mxEvent.addListener(n,"click",mxUtils.bind(this,function(){this.hideDialog();this.drive.showPermissions(p.getId())})));e.setAttribute("checked","checked");null==c&&g.setAttribute("disabled","disabled");f.appendChild(k);var h=this.addLinkSection(f),m=this.addCheckbox(f,mxResources.get("zoom"),!0,null,!0);mxUtils.write(f,":");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="100%";f.appendChild(l);var t=this.addCheckbox(f,mxResources.get("fit"),!0),k=null!=this.pages&&1<this.pages.length,J=J=this.addCheckbox(f,mxResources.get("allPages"),k,!k),y=this.addCheckbox(f,mxResources.get("layers"),!0),D=this.addCheckbox(f,mxResources.get("lightbox"),!0),H=this.addEditButton(f,D),z=H.getEditInput();z.style.marginBottom="16px";mxEvent.addListener(D,"change",function(){D.checked?z.removeAttribute("disabled"):z.setAttribute("disabled","disabled");z.checked&&D.checked?
|
||||
H.getEditSelect().removeAttribute("disabled"):H.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,f,mxUtils.bind(this,function(){d(g.checked?c:null,m.checked,l.value,h.getTarget(),h.getColor(),t.checked,J.checked,y.checked,D.checked,H.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 k=document.createElement("h3");
|
||||
mxUtils.write(k,a||mxResources.get("link"));k.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";f.appendChild(k);var n=this.getCurrentFile(),k="https://desk.draw.io/support/solutions/articles/16000051941";a=0;if(null!=n&&n.constructor==window.DriveFile&&!b){a=80;var k="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 h=document.createElement("div");h.style.whiteSpace="normal";mxUtils.write(h,mxResources.get("linkAccountRequired"));p.appendChild(h);h=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(n.getId())}));h.style.marginTop="12px";h.className="geBtn";p.appendChild(h);f.appendChild(p);h=document.createElement("a");h.style.paddingLeft="12px";h.style.color="gray";h.style.fontSize="11px";h.setAttribute("href","javascript:void(0);");mxUtils.write(h,mxResources.get("check"));
|
||||
p.appendChild(h);mxEvent.addListener(h,"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 m=null,l=null;if(null!=c||null!=d)a+=30,mxUtils.write(f,mxResources.get("width")+":"),m=document.createElement("input"),
|
||||
m.setAttribute("type","text"),m.style.marginRight="16px",m.style.width="50px",m.style.marginLeft="6px",m.style.marginRight="16px",m.style.marginBottom="10px",m.value="100%",f.appendChild(m),mxUtils.write(f,mxResources.get("height")+":"),l=document.createElement("input"),l.setAttribute("type","text"),l.style.width="50px",l.style.marginLeft="6px",l.style.marginBottom="10px",l.value=d+"px",f.appendChild(l),mxUtils.br(f);var t=this.addLinkSection(f,g);c=null!=this.pages&&1<this.pages.length;var q=null;
|
||||
if(null==n||n.constructor!=window.DriveFile||b)q=this.addCheckbox(f,mxResources.get("allPages"),c,!c);var u=this.addCheckbox(f,mxResources.get("lightbox"),!0),D=this.addEditButton(f,u),H=D.getEditInput(),z=this.addCheckbox(f,mxResources.get("layers"),!0);z.style.marginLeft=H.style.marginLeft;z.style.marginBottom="16px";z.style.marginTop="8px";mxEvent.addListener(u,"change",function(){u.checked?(z.removeAttribute("disabled"),H.removeAttribute("disabled")):(z.setAttribute("disabled","disabled"),H.setAttribute("disabled",
|
||||
"disabled"));H.checked&&u.checked?D.getEditSelect().removeAttribute("disabled"):D.getEditSelect().setAttribute("disabled","disabled")});b=new CustomDialog(this,f,mxUtils.bind(this,function(){e(t.getTarget(),t.getColor(),null==q?!0:q.checked,u.checked,D.getLink(),z.checked,null!=m?m.value:null,null!=l?l.value:null)}),null,mxResources.get("create"),k);this.showDialog(b.container,340,254+a,!0,!0);null!=m?(m.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?m.select():
|
||||
document.execCommand("selectAll",!1,null)):t.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(f);var k=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),g=d?null:this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),
|
||||
!0),f=this.editor.graph,n=d?null:this.addCheckbox(e,mxResources.get("transparentBackground"),f.background==mxConstants.NONE||null==f.background);null!=n&&(n.style.marginBottom="16px");a=new CustomDialog(this,e,mxUtils.bind(this,function(){c(!k.checked,null!=g?g.checked:!1,null!=n?n.checked:!1)}),null,a,b);this.showDialog(a.container,300,d?100:186,!0,!0)};EditorUi.prototype.showExportDialog=function(a,b,c,d,e,g,h,m){h=null!=h?h:!0;var f=document.createElement("div");f.style.whiteSpace="nowrap";var k=
|
||||
document.execCommand("selectAll",!1,null)):t.focus()};EditorUi.prototype.showRemoteExportDialog=function(a,b,c,d){var f=document.createElement("div");f.style.whiteSpace="nowrap";var e=document.createElement("h3");mxUtils.write(e,mxResources.get("image"));e.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";f.appendChild(e);var k=this.addCheckbox(f,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),g=d?null:this.addCheckbox(f,mxResources.get("includeCopyOfMyDiagram"),
|
||||
!0),e=this.editor.graph,n=d?null:this.addCheckbox(f,mxResources.get("transparentBackground"),e.background==mxConstants.NONE||null==e.background);null!=n&&(n.style.marginBottom="16px");a=new CustomDialog(this,f,mxUtils.bind(this,function(){c(!k.checked,null!=g?g.checked:!1,null!=n?n.checked:!1)}),null,a,b);this.showDialog(a.container,300,d?100:186,!0,!0)};EditorUi.prototype.showExportDialog=function(a,b,c,d,e,g,h,m){h=null!=h?h:!0;var f=document.createElement("div");f.style.whiteSpace="nowrap";var k=
|
||||
this.editor.graph,n="jpeg"==m?196:300,l=document.createElement("h3");mxUtils.write(l,a);l.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";f.appendChild(l);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 q=document.createElement("input");q.setAttribute("type","text");q.style.marginRight="16px";q.style.width="60px";q.style.marginLeft="4px";q.value=this.lastExportBorder||"0";f.appendChild(q);mxUtils.br(f);var v=this.addCheckbox(f,mxResources.get("transparentBackground"),k.background==mxConstants.NONE||null==k.background,null,null,"jpeg"!=m),u=this.addCheckbox(f,mxResources.get("selectionOnly"),!1,k.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),n+=26,mxEvent.addListener(u,"change",function(){u.checked?x.removeAttribute("disabled"):x.setAttribute("disabled","disabled")}));k.isSelectionEmpty()||(x.setAttribute("checked","checked"),x.defaultChecked=!0);var H=this.addCheckbox(f,mxResources.get("shadow"),k.shadowVisible),z=document.createElement("input");z.style.marginTop=
|
||||
|
@ -7362,15 +7363,15 @@ EditorUi.prototype.createEmbedSvg=function(a,b,c,d,e,g,h){var f=this.editor.grap
|
|||
(e?"&edit=_blank":"")+(g?"&layers=1":"")+"');}})(this);\"",l+="cursor:pointer;");a&&(l+="max-width:100%;");this.convertImages(f,mxUtils.bind(this,function(a){h('<img src="'+this.createSvgDataUri(mxUtils.getXml(a))+'"'+(""!=l?' style="'+l+'"':"")+m+"/>")}))}else l="",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('https://www.draw.io/?client=1&lightbox=1"+
|
||||
(e?"&edit=_blank":"")+(g?"&layers=1":"")+"');}}})(this);"),l+="cursor:pointer;"),a&&(a=parseInt(f.getAttribute("width")),b=parseInt(f.getAttribute("height")),f.setAttribute("viewBox","0 0 "+a+" "+b),l+="max-width:100%;max-height:"+b+"px;",f.removeAttribute("height")),""!=l&&f.setAttribute("style",l),h(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){d()};EditorUi.prototype.decodeNodeIntoGraph=function(a,b){if(null!=a){var c=null;if("diagram"==a.nodeName)c=a;else if("mxfile"==a.nodeName){var d=a.getElementsByTagName("diagram");if(0<
|
||||
d.length){var c=d[0],e=b.getGlobalVariable;b.getGlobalVariable=function(a){return"page"==a?c.getAttribute("name")||mxResources.get("pageWithNumber",[1]):"pagenumber"==a?1:e.apply(this,arguments)}}}null!=c&&(d=b.decompress(mxUtils.getTextContent(c)),null!=d&&0<d.length&&(a=mxUtils.parseXml(d).documentElement))}d=this.editor.graph;try{this.editor.graph=b,this.editor.setGraphXml(a)}catch(q){}finally{this.editor.graph=d}return a};EditorUi.prototype.getEmbeddedPng=function(a,b,c){var d=this.editor.graph,
|
||||
e=null;if(null!=c&&0<c.length)d=this.createTemporaryGraph(this.editor.graph.getStylesheet()),document.body.appendChild(d.container),this.decodeNodeIntoGraph(this.editor.extractGraphModel(mxUtils.parseXml(c).documentElement,!0),d),e=c;else if(null!=this.pages&&this.currentPage!=this.pages[0]){var d=this.createTemporaryGraph(d.getStylesheet()),f=d.getGlobalVariable,k=this.pages[0];d.getGlobalVariable=function(a){return"page"==a?k.getName():"pagenumber"==a?1:f.apply(this,arguments)};document.body.appendChild(d.container);
|
||||
d.model.setRoot(k.root)}this.exportToCanvas(mxUtils.bind(this,function(c){try{null==e&&(e=this.getFileData(!0));var f=c.toDataURL("image/png"),f=this.writeGraphModelToPng(f,"zTXt","mxGraphModel",atob(this.editor.graph.compress(e)));a(f.substring(f.lastIndexOf(",")+1));d!=this.editor.graph&&d.container.parentNode.removeChild(d.container)}catch(p){null!=b&&b(p)}}),null,null,null,mxUtils.bind(this,function(a){null!=b&&b(a)}),null,null,null,null,d.shadowVisible,null,d)};EditorUi.prototype.getEmbeddedSvg=
|
||||
d.length){var c=d[0],f=b.getGlobalVariable;b.getGlobalVariable=function(a){return"page"==a?c.getAttribute("name")||mxResources.get("pageWithNumber",[1]):"pagenumber"==a?1:f.apply(this,arguments)}}}null!=c&&(d=b.decompress(mxUtils.getTextContent(c)),null!=d&&0<d.length&&(a=mxUtils.parseXml(d).documentElement))}d=this.editor.graph;try{this.editor.graph=b,this.editor.setGraphXml(a)}catch(q){}finally{this.editor.graph=d}return a};EditorUi.prototype.getEmbeddedPng=function(a,b,c){var d=this.editor.graph,
|
||||
f=null;if(null!=c&&0<c.length)d=this.createTemporaryGraph(this.editor.graph.getStylesheet()),document.body.appendChild(d.container),this.decodeNodeIntoGraph(this.editor.extractGraphModel(mxUtils.parseXml(c).documentElement,!0),d),f=c;else if(null!=this.pages&&this.currentPage!=this.pages[0]){var d=this.createTemporaryGraph(d.getStylesheet()),e=d.getGlobalVariable,k=this.pages[0];d.getGlobalVariable=function(a){return"page"==a?k.getName():"pagenumber"==a?1:e.apply(this,arguments)};document.body.appendChild(d.container);
|
||||
d.model.setRoot(k.root)}this.exportToCanvas(mxUtils.bind(this,function(c){try{null==f&&(f=this.getFileData(!0));var e=c.toDataURL("image/png"),e=this.writeGraphModelToPng(e,"zTXt","mxGraphModel",atob(this.editor.graph.compress(f)));a(e.substring(e.lastIndexOf(",")+1));d!=this.editor.graph&&d.container.parentNode.removeChild(d.container)}catch(p){null!=b&&b(p)}}),null,null,null,mxUtils.bind(this,function(a){null!=b&&b(a)}),null,null,null,null,d.shadowVisible,null,d)};EditorUi.prototype.getEmbeddedSvg=
|
||||
function(a,b,c,d,e,g,h){h=b.background;h==mxConstants.NONE&&(h=null);b=b.getSvg(h,null,null,null,null,g);null!=a&&b.setAttribute("content",a);null!=c&&b.setAttribute("resource",c);if(null!=e)this.convertImages(b,mxUtils.bind(this,function(a){e((d?"":'<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n')+mxUtils.getXml(a))}));else return(d?"":'<?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(b)};EditorUi.prototype.exportImage=function(a,b,c,d,e,g,h,m,l){l=null!=l?l:"png";if(this.spinner.spin(document.body,mxResources.get("exporting"))){var f=this.editor.graph.isSelectionEmpty();c=null!=c?c:f;null==this.thumbImageCache&&(this.thumbImageCache={});try{this.exportToCanvas(mxUtils.bind(this,function(a){this.spinner.stop();try{this.saveCanvas(a,e?this.getFileData(!0,null,null,null,c,m):null,l)}catch(E){"Invalid image"==E.message?this.downloadFile(l):this.handleError(E)}}),null,
|
||||
this.thumbImageCache,null,mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a)}),null,c,a||1,b,d,null,null,g,h)}catch(A){this.spinner.stop(),this.handleError(A)}}};EditorUi.prototype.loadFonts=function(a){if(null!=this.editor.fontCss&&null==this.editor.resolvedFontCss){var b=function(a){return a.replace(RegExp("^[\\s\"']+","g"),"").replace(RegExp("[\\s\"']+$","g"),"")},c=this.editor.fontCss.split("url("),d=0,e={},f=mxUtils.bind(this,function(){if(0==d){for(var f=[c[0]],k=1;k<c.length;k++){var g=
|
||||
c[k].indexOf(")");f.push('url("');f.push(e[b(c[k].substring(0,g))]);f.push('"'+c[k].substring(g))}this.editor.resolvedFontCss=f.join("");a()}});if(0<c.length)for(var g=1;g<c.length;g++){var h=c[g].indexOf(")"),m=null,p=c[g].indexOf("format(",h);0<p&&(m=b(c[g].substring(p+7,c[g].indexOf(")",p))));mxUtils.bind(this,function(a){if(null==e[a]){e[a]=a;d++;var b="application/x-font-ttf";if("svg"==m||/(\.svg)($|\?)/i.test(a))b="image/svg+xml";else if("otf"==m||"embedded-opentype"==m||/(\.otf)($|\?)/i.test(a))b=
|
||||
"application/x-font-opentype";else if("woff"==m||/(\.woff)($|\?)/i.test(a))b="application/font-woff";else if("woff2"==m||/(\.woff2)($|\?)/i.test(a))b="application/font-woff2";else if("eot"==m||/(\.eot)($|\?)/i.test(a))b="application/vnd.ms-fontobject";else if("sfnt"==m||/(\.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){e[a]=b;d--;f()}),mxUtils.bind(this,
|
||||
function(a){d--;f()}),!0,null,"data:"+b+";charset=utf-8;base64,")}})(b(c[g].substring(0,h)),m)}}else a()};EditorUi.prototype.exportToCanvas=function(a,b,c,d,e,g,h,m,l,p,A,E,B,w){g=null!=g?g:!0;E=null!=E?E:this.editor.graph;B=null!=B?B:0;var f=l?null:E.background;f==mxConstants.NONE&&(f=null);null==f&&(f=d);null==f&&0==l&&(f=this.editor.graph.defaultPageBackgroundColor);this.convertImages(E.getSvg(f,null,null,w,null,null!=h?h:!0),mxUtils.bind(this,function(c){var d=new Image;d.onload=mxUtils.bind(this,
|
||||
this.thumbImageCache,null,mxUtils.bind(this,function(a){this.spinner.stop();this.handleError(a)}),null,c,a||1,b,d,null,null,g,h)}catch(A){this.spinner.stop(),this.handleError(A)}}};EditorUi.prototype.loadFonts=function(a){if(null!=this.editor.fontCss&&null==this.editor.resolvedFontCss){var b=function(a){return a.replace(RegExp("^[\\s\"']+","g"),"").replace(RegExp("[\\s\"']+$","g"),"")},c=this.editor.fontCss.split("url("),d=0,f={},e=mxUtils.bind(this,function(){if(0==d){for(var e=[c[0]],k=1;k<c.length;k++){var g=
|
||||
c[k].indexOf(")");e.push('url("');e.push(f[b(c[k].substring(0,g))]);e.push('"'+c[k].substring(g))}this.editor.resolvedFontCss=e.join("");a()}});if(0<c.length)for(var g=1;g<c.length;g++){var h=c[g].indexOf(")"),m=null,p=c[g].indexOf("format(",h);0<p&&(m=b(c[g].substring(p+7,c[g].indexOf(")",p))));mxUtils.bind(this,function(a){if(null==f[a]){f[a]=a;d++;var b="application/x-font-ttf";if("svg"==m||/(\.svg)($|\?)/i.test(a))b="image/svg+xml";else if("otf"==m||"embedded-opentype"==m||/(\.otf)($|\?)/i.test(a))b=
|
||||
"application/x-font-opentype";else if("woff"==m||/(\.woff)($|\?)/i.test(a))b="application/font-woff";else if("woff2"==m||/(\.woff2)($|\?)/i.test(a))b="application/font-woff2";else if("eot"==m||/(\.eot)($|\?)/i.test(a))b="application/vnd.ms-fontobject";else if("sfnt"==m||/(\.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){f[a]=b;d--;e()}),mxUtils.bind(this,
|
||||
function(a){d--;e()}),!0,null,"data:"+b+";charset=utf-8;base64,")}})(b(c[g].substring(0,h)),m)}}else a()};EditorUi.prototype.exportToCanvas=function(a,b,c,d,e,g,h,m,l,p,A,E,B,w){g=null!=g?g:!0;E=null!=E?E:this.editor.graph;B=null!=B?B:0;var f=l?null:E.background;f==mxConstants.NONE&&(f=null);null==f&&(f=d);null==f&&0==l&&(f=this.editor.graph.defaultPageBackgroundColor);this.convertImages(E.getSvg(f,null,null,w,null,null!=h?h:!0),mxUtils.bind(this,function(c){var d=new Image;d.onload=mxUtils.bind(this,
|
||||
function(){try{var k=document.createElement("canvas"),p=parseInt(c.getAttribute("width")),h=parseInt(c.getAttribute("height"));m=null!=m?m:1;null!=b&&(m=g?Math.min(1,Math.min(3*b/(4*h),b/p)):b/p);p=Math.ceil(m*p)+2*B;h=Math.ceil(m*h)+2*B;k.setAttribute("width",p);k.setAttribute("height",h);var n=k.getContext("2d");null!=f&&(n.beginPath(),n.rect(0,0,p,h),n.fillStyle=f,n.fill());n.scale(m,m);mxClient.IS_SF?window.setTimeout(function(){n.drawImage(d,B/m,B/m);a(k)},0):(n.drawImage(d,B/m,B/m),a(k))}catch(M){null!=
|
||||
e&&e(M)}});d.onerror=function(a){null!=e&&e(a)};try{p&&this.editor.graph.addSvgShadow(c);var k=mxUtils.bind(this,function(){if(null!=this.editor.resolvedFontCss){var a=document.createElement("style");a.setAttribute("type","text/css");a.innerHTML=this.editor.resolvedFontCss;c.getElementsByTagName("defs")[0].appendChild(a)}this.convertMath(E,c,!0,mxUtils.bind(this,function(){d.src=this.createSvgDataUri(mxUtils.getXml(c))}))});this.loadFonts(k)}catch(z){null!=e&&e(z)}}),c,A)};EditorUi.prototype.createImageUrlConverter=
|
||||
function(){var a=new mxUrlConverter;a.updateBaseUrl();var b=a.convert,c=this;a.convert=function(d){if(null!=d){var e="http://"==d.substring(0,7)||"https://"==d.substring(0,8);e&&!navigator.onLine?d=c.svgBrokenImage.src:!e||d.substring(0,a.baseUrl.length)==a.baseUrl||c.crossOriginImages&&c.isCorsEnabledForUrl(d)?"chrome-extension://"!=d.substring(0,19)&&(d=b.apply(this,arguments)):d=PROXY_URL+"?url="+encodeURIComponent(d)}return d};return a};EditorUi.prototype.convertImages=function(a,b,c,d){null==
|
||||
|
@ -7383,122 +7384,122 @@ null!=this.pages);if(null!=h&&"mxfile"==h.nodeName&&null!=this.pages){var p=h.ge
|
|||
h.nodeName&&(f=k.importGraphModel(h,b,c,d))}}catch(B){throw e||this.handleError(B,mxResources.get("invalidOrMissingFile")),B;}return f};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 e=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.doImportVisio)if(/(\.vsd)($|\?)/i.test(d)&&null!=VSD_CONVERT_URL){var e=new FormData;e.append("file1",a,d);var f=new XMLHttpRequest;f.open("POST",VSD_CONVERT_URL);f.responseType=
|
||||
"blob";f.onreadystatechange=mxUtils.bind(this,function(){if(4==f.readyState)if(200<=f.status&&299>=f.status)try{this.doImportVisio(f.response,b,c)}catch(x){c(x)}else c({})});f.send(e)}else try{this.doImportVisio(a,b,c)}catch(x){c(x)}});this.doImportVisio||this.loadingExtensions||this.isOffline()?e():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",e))};EditorUi.prototype.exportVisio=function(){var a=mxUtils.bind(this,function(){this.loadingExtensions=!1;if("undefined"!==typeof VsdxExport)try{(new VsdxExport(this)).exportCurrentDiagrams()}catch(k){this.handleError(k)}});
|
||||
"undefined"!==typeof VsdxExport||this.loadingExtensions||this.isOffline()?a():(this.loadingExtensions=!0,mxscript("js/extensions.min.js",a))};EditorUi.prototype.importLucidChart=function(a,b,c,d,e){var f=mxUtils.bind(this,function(){this.loadingExtensions=!1;if(this.pasteLucidChart)try{this.insertLucidChart(a,b,c,d,e)}catch(v){this.handleError(v)}finally{null!=e&&e()}});this.pasteLucidChart||this.loadingExtensions||this.isOffline()?window.setTimeout(f,0):(this.loadingExtensions=!0,"1"==urlParams.dev?
|
||||
mxscript("js/diagramly/Extensions.js",f):mxscript("js/extensions.min.js",f))};EditorUi.prototype.insertLucidChart=function(a,b,c,d,e){e=JSON.parse(a);a=[];if(null!=e.state){e=JSON.parse(e.state);for(var f in e.Pages)a.push(e.Pages[f]);a.sort(function(a,b){return a.Properties.Order<b.Properties.Order?-1:a.Properties.Order>b.Properties.Order?1:0})}else a.push(e);if(0<a.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(a[0],b,c,d),null!=this.pages){var k=this.currentPage;
|
||||
for(b=1;b<a.length;b++)this.insertPage(),this.pasteLucidChart(a[b]);this.selectPage(k)}}finally{this.editor.graph.getModel().endUpdate()}}};EditorUi.prototype.insertTextAt=function(a,b,c,d,e,g,h){g=null!=g?g:!0;h=null!=h?h:!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,
|
||||
mxscript("js/diagramly/Extensions.js",f):mxscript("js/extensions.min.js",f))};EditorUi.prototype.insertLucidChart=function(a,b,c,d,e){e=JSON.parse(a);a=[];if(null!=e.state){e=JSON.parse(e.state);for(var f in e.Pages)a.push(e.Pages[f]);a.sort(function(a,b){return a.Properties.Order<b.Properties.Order?-1:a.Properties.Order>b.Properties.Order?1:0})}else a.push(e);if(0<a.length){this.editor.graph.getModel().beginUpdate();try{if(this.pasteLucidChart(a[0],b,c,d),null!=this.pages){var g=this.currentPage;
|
||||
for(b=1;b<a.length;b++)this.insertPage(),this.pasteLucidChart(a[b]);this.selectPage(g)}}finally{this.editor.graph.getModel().endUpdate()}}};EditorUi.prototype.insertTextAt=function(a,b,c,d,e,g,h){g=null!=g?g:!0;h=null!=h?h:!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 k=this.extractGraphModelFromPng(a),p=this.importXml(k,b,c,g,!0);if(0<p.length)return p}if("data:image/svg+xml;"==a.substring(0,19))try{if(k=null,"data:image/svg+xml;base64,"==a.substring(0,26)?(k=a.substring(a.indexOf(",")+1),k=window.atob&&!mxClient.IS_SF?atob(k):Base64.decode(k,!0)):k=decodeURIComponent(a.substring(a.indexOf(",")+
|
||||
1)),p=this.importXml(k,b,c,g,!0),0<p.length)return p}catch(A){}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)+";"))}),h,this.maxImageSize);else{var e=Math.min(1,Math.min(this.maxImageSize/d.width,this.maxImageSize/
|
||||
d.height)),k=Math.round(d.width*e);d=Math.round(d.height*e);f.setSelectionCell(f.insertVertex(null,null,"",f.snap(b),f.snap(c),k,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=this.editor.graph.zapGremlins(mxUtils.trim(a));if(this.isCompatibleString(a))return this.importXml(a,b,c,g);if(0<a.length)if('{"state":"{\\"Properties\\":'==a.substring(0,26))this.importLucidChart(a,b,c,g);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])),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.importLocalFile=function(a,b){if(a&&Graph.fileSupport&&(!mxClient.IS_IE&&!mxClient.IS_IE11||0>navigator.appVersion.indexOf("Windows NT 6.1"))){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.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&&/(\.vsdx?)($|\?)/i.test(b)){var c=new Blob([a],{type:"application/octet-stream"});
|
||||
this.importVisio(c,mxUtils.bind(this,function(a){this.importXml(a)}),null,b)}else this.editor.graph.setSelectionCells(this.importXml(a))}));this.showDialog((new OpenDialog(this)).container,360,220,!0,!0,function(){window.openFile=null});if(!b){var e=this.dialog,f=e.close;this.dialog.close=mxUtils.bind(this,function(a){Editor.useLocalStorage=d;f.apply(e,arguments);a&&null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()})}}};EditorUi.prototype.importFile=function(a,b,c,d,e,g,h,m,l,p,
|
||||
A){p=null!=p?p:!0;var f=!1,k=null,n=mxUtils.bind(this,function(a){var b=null;null!=a&&"<mxlibrary"==a.substring(0,10)?this.loadLibrary(new LocalLibrary(this,a,h)):b=this.importXml(a,c,d,p);null!=m&&m(b)});"image"==b.substring(0,5)?(l=!1,"image/png"==b.substring(0,9)&&(b=A?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(k=this.importXml(b,c,d,p),l=!0)),l||(k=this.editor.graph,b=a.indexOf(";"),0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1))),p&&k.isGridEnabled()&&(c=k.snap(c),d=
|
||||
k.snap(d)),k=[k.insertVertex(null,null,"",c,d,e,g,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";")])):/(\.*<graphml )/.test(a)&&"undefined"!==typeof window.mxGraphMlCodec?(new mxGraphMlCodec).decode(a,mxUtils.bind(this,function(a){a=this.importXml(a,c,d,p);null!=m&&m(a)})):null!=l&&null!=h&&(/(\.vsdx?)($|\?)/i.test(h)||/(\.vssx)($|\?)/i.test(h))?(f=!0,this.importVisio(l,n)):!this.isOffline()&&(new XMLHttpRequest).upload&&
|
||||
this.isRemoteFileFormat(a,h)?(f=!0,this.parseFile(null!=l?l:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&(200<=a.status&&299>=a.status?n(a.responseText):null!=m&&m(null))}),h)):/(\.vsd)($|\?)/i.test(h)||(k=this.insertTextAt(this.validateFileData(a),c,d,!0,null,p));f||null==m||m(k);return k};EditorUi.prototype.base64Encode=function(a){for(var b="",c=0,d=a.length,e,f,g;c<d;){e=a.charCodeAt(c++)&255;if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4);b+="==";break}f=a.charCodeAt(c++);if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(f&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&15)<<2);b+="=";break}g=a.charCodeAt(c++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>
|
||||
2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(f&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&15)<<2|(g&192)>>6);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g&63)}return b};EditorUi.prototype.importFiles=function(a,b,c,d,e,g,h,m,l,p,A,E){b=null!=b?b:0;c=null!=c?c:0;d=null!=d?d:this.maxImageSize;p=null!=p?p:this.maxImageBytes;var f=null!=b&&null!=c,k=!0,n=!1;if(!mxClient.IS_CHROMEAPP&&
|
||||
null!=a)for(var t=A||this.resampleThreshold,q=0;q<a.length;q++)if("image/"==a[q].type.substring(0,6)&&a[q].size>t){n=!0;break}var v=mxUtils.bind(this,function(){var n=this.editor.graph,l=n.gridSize;e=null!=e?e:mxUtils.bind(this,function(a,b,c,d,e,g,k,h,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,h,p,f,E)});g=null!=g?g:mxUtils.bind(this,function(a){n.setSelectionCells(a)});if(this.spinner.spin(document.body,
|
||||
mxResources.get("loading")))for(var t=a.length,q=t,v=[],u=mxUtils.bind(this,function(a,b){v[a]=b;if(0==--q){this.spinner.stop();if(null!=m)m(v);else{var c=[];n.getModel().beginUpdate();try{for(var d=0;d<v.length;d++){var e=v[d]();null!=e&&(c=c.concat(e))}}finally{n.getModel().endUpdate()}}g(c)}}),x=0;x<t;x++)mxUtils.bind(this,function(f){var g=a[f],m=new FileReader;m.onload=mxUtils.bind(this,function(a){if(null==h||h(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var m=
|
||||
a.target.result,t=m.indexOf(","),q=decodeURIComponent(escape(atob(m.substring(t+1)))),v=mxUtils.parseXml(q),q=v.getElementsByTagName("svg");if(0<q.length){var q=q[0],z=E?null:q.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)?u(f,mxUtils.bind(this,function(){try{if(m.substring(0,t+1),null!=v){var a=
|
||||
v.getElementsByTagName("svg");if(0<a.length){var h=a[0],p=parseFloat(h.getAttribute("width")),A=parseFloat(h.getAttribute("height")),q=h.getAttribute("viewBox");if(null==q||0==q.length)h.setAttribute("viewBox","0 0 "+p+" "+A);else if(isNaN(p)||isNaN(A)){var u=q.split(" ");3<u.length&&(p=parseFloat(u[2]),A=parseFloat(u[3]))}m=this.createSvgDataUri(mxUtils.getXml(h));var z=Math.min(1,Math.min(d/Math.max(1,p)),d/Math.max(1,A)),x=e(m,g.type,b+f*l,c+f*l,Math.max(1,Math.round(p*z)),Math.max(1,Math.round(A*
|
||||
z)),g.name,k);if(isNaN(p)||isNaN(A)){var E=new Image;E.onload=mxUtils.bind(this,function(){p=Math.max(1,E.width);A=Math.max(1,E.height);x[0].geometry.width=p;x[0].geometry.height=A;h.setAttribute("viewBox","0 0 "+p+" "+A);m=this.createSvgDataUri(mxUtils.getXml(h));var a=m.indexOf(";");0<a&&(m=m.substring(0,a)+m.substring(m.indexOf(",",a+1)));n.setCellStyles("image",m,[x[0]])});E.src=this.createSvgDataUri(mxUtils.getXml(h))}return x}}}catch(da){}return null})):u(f,mxUtils.bind(this,function(){return e(z,
|
||||
"text/xml",b+f*l,c+f*l,0,0,g.name)}))}}else{q=!1;if("image/png"==g.type){var x=E?null:this.extractGraphModelFromPng(a.target.result);if(null!=x&&0<x.length){var J=new Image;J.src=a.target.result;u(f,mxUtils.bind(this,function(){return e(x,"text/xml",b+f*l,c+f*l,J.width,J.height,g.name)}));q=!0}}q||(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(h){this.resizeImage(h,a.target.result,mxUtils.bind(this,function(h,m,n){u(f,mxUtils.bind(this,function(){if(null!=h&&h.length<p){var t=k&&this.isResampleImage(a.target.result,A)?Math.min(1,Math.min(d/m,d/n)):1;return e(h,g.type,b+f*l,c+f*l,Math.round(m*t),Math.round(n*t),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),k,d,A)}),mxUtils.bind(this,
|
||||
function(){this.handleError({message:mxResources.get("invalidOrMissingFile")})})))}else e(a.target.result,g.type,b+f*l,c+f*l,240,160,g.name,function(a){u(f,function(){return a})})});/(\.vsdx?)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?e(null,g.type,b+f*l,c+f*l,240,160,g.name,function(a){u(f,function(){return a})},g):"image"==g.type.substring(0,5)?m.readAsDataURL(g):m.readAsText(g)})(x)});n?this.confirmImageResize(function(a){k=a;v()},l):v()};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,e=function(d,e){if(d||b)mxSettings.setResizeImages(d?e:null),mxSettings.save();c();a(e)};null==d||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){e(a,!0)},function(a){e(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):e(!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 e=new XMLHttpRequest;e.open("POST",OPEN_URL);e.onreadystatechange=function(){b(e)};e.send(d)};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 h=Math.max(f/e,k/e);if(1<h){var p=Math.round(f/h),m=Math.round(k/h),n=document.createElement("canvas");n.width=p;n.height=m;n.getContext("2d").drawImage(a,0,0,p,m);var l=n.toDataURL();if(l.length<b.length){var t=document.createElement("canvas");t.width=p;t.height=m;var q=t.toDataURL();l!==q&&(b=l,f=p,k=m)}}}catch(y){}c(b,f,k)};
|
||||
EditorUi.prototype.crcTable=[];for(var c=0;256>c;c++)for(var d=c,e=0;8>e;e++)d=1==(d&1)?3988292384^d>>>1:d>>>1,EditorUi.prototype.crcTable[c]=d;EditorUi.prototype.updateCRC=function(a,b,c,d){for(var e=0;e<d;e++)a=EditorUi.prototype.crcTable[(a^b[c+e])&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=h;h+=b;return a.substring(c,h)}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 h=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,h);do{var p=
|
||||
g(a);if("IDAT"==f(a,4)){e=a.substring(0,h-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(h-8,a.length);break}e+=a.substring(h-8,h-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){var b=null;try{var c=a.substring(a.indexOf(",")+1),d=window.atob&&!mxClient.IS_SF?
|
||||
atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(a,c,e){a=d.substring(a+8,a+8+e);"zTXt"==c?(e=a.indexOf(String.fromCharCode(0)),"mxGraphModel"==a.substring(0,e)&&(a=this.editor.graph.bytesToString(pako.inflateRaw(a.substring(e+2))).replace(/\+/g," "),null!=a&&0<a.length&&(b=a))):"tEXt"==c&&(a=a.split(String.fromCharCode(0)),1<a.length&&"mxGraphModel"==a[0]&&(b=a[1]));if(null!=b||"IDAT"==c)return!0}))}catch(u){}null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));null!=b&&
|
||||
"%"==b.charAt(0)&&(b=decodeURIComponent(b));return b};EditorUi.prototype.loadImage=function(a,b,c){var d=new Image;d.onload=function(){b(d)};null!=c&&(d.onerror=c);d.src=a};var g=EditorUi.prototype.init;EditorUi.prototype.init=function(){"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){try{a.handleCustomLink(b)}catch(H){a.handleError(H)}};this.isOffline()||
|
||||
"undefined"===typeof window.EditDataDialog||(EditDataDialog.placeholderHelpLink="https://desk.draw.io/support/solutions/articles/16000051979");var c=a.editor.getEditBlankUrl;this.editor.getEditBlankUrl=function(b){b=null!=b?b:"";if(null!=a.pages&&null!=a.currentPage)for(var d=0;d<a.pages.length;d++)if(a.pages[d]==a.currentPage){0<d&&(b+=(0<b.length?"&":"?")+"page="+d);break}"1"==urlParams.dev&&(b+=(0<b.length?"&":"?")+"dev=1&drawdev=1");return c.apply(this,arguments)};var d=b.addClickHandler;b.addClickHandler=
|
||||
function(a,c,e){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)};d.call(this,a,c,e)};g.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 e=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:e.apply(this,arguments)};var h=b.createLinkForHint;b.createLinkForHint=function(a,c){null!=a&&b.isCustomLink(a)&&(c=b.getLinkTitle(a));var d=h.call(this,a,c);null!=a&&b.isCustomLink(a)&&mxEvent.addListener(d,
|
||||
"click",function(c){b.customLinkClicked(a);mxEvent.consume(c)});return d};var m=b.labelLinkClicked;b.labelLinkClicked=function(a,c,d){var e=c.getAttribute("href");if(null==e||!b.isCustomLink(e)||!mxEvent.isTouchEvent(d)&&mxEvent.isPopupTrigger(d))m.apply(this,arguments);else{if(!b.isEnabled()||null!=a&&b.isCellLocked(a.cell))b.customLinkClicked(e),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 l=this.actions.get("print");l.setEnabled(!mxClient.IS_IOS||!navigator.standalone);l.visible=l.isEnabled();if(!this.editor.chromeless||this.editor.editable){var C=function(){window.setTimeout(function(){p.innerHTML=" ";p.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_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,e=0;e<c.types.length;e++)if("text/"===c.types[e].substring(0,5)){d=!0;break}if(!d){var f=c.items;for(index in f){var g=f[index];if("file"===g.kind){if(b.isEditing())this.importFiles([g.getAsFile()],
|
||||
0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,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(Z){}}),!1);var p=document.createElement("div");p.style.position="absolute";p.style.whiteSpace="nowrap";p.style.overflow="hidden";p.style.display="block";p.contentEditable=!0;mxUtils.setOpacity(p,
|
||||
0);p.style.width="1px";p.style.height="1px";p.innerHTML=" ";var A=!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)||
|
||||
A||(p.style.left=b.container.scrollLeft+10+"px",p.style.top=b.container.scrollTop+10+"px",b.container.appendChild(p),A=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){p.focus();document.execCommand("selectAll",!1,null)},0):(p.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(){!A||224!=c&&17!=c&&91!=c||(A=!1,b.isEditing()||null!=this.dialog||null==b.container||b.container.focus(),
|
||||
p.parentNode.removeChild(p),mxUtils.clearSelection())}),0)}));mxEvent.addListener(p,"copy",mxUtils.bind(this,function(a){b.isEnabled()&&(mxClipboard.copy(b),this.copyCells(p),C())}));mxEvent.addListener(p,"cut",mxUtils.bind(this,function(a){b.isEnabled()&&(this.copyCells(p,!0),C())}));mxEvent.addListener(p,"paste",mxUtils.bind(this,function(a){b.isEnabled()&&!b.isCellLocked(b.getDefaultParent())&&(p.innerHTML=" ",p.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,p);p.innerHTML=
|
||||
" "}),0))}),!0);var E=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==p?!0:E.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,e,f,g){b.insertImage(a,
|
||||
f,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 e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,d)),e/Math.max(1,a));b.insertImage(decodeURIComponent(c),
|
||||
d*e,a*e)})):document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));a.stopPropagation();a.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){l=document.createElement("div");l.style.position="absolute";
|
||||
l.style.top="95px";l.style.left="250px";l.style.width="2000px";l.style.height="30px";l.style.background="whiteSmoke";document.body.appendChild(l);var B=document.createElement("div");B.style.position="absolute";B.style.top="125px";B.style.left="220px";B.style.width="30px";B.style.height="1000px";B.style.background="whiteSmoke";document.body.appendChild(B);var w=document.createElement("div");w.style.position="absolute";w.style.top="95px";w.style.left="220px";w.style.width="30px";w.style.height="30px";
|
||||
w.style.background="whiteSmoke";document.body.appendChild(w);this.vRuler=new mxRuler(this.editor.graph,B,!0);this.hRuler=new mxRuler(this.editor.graph,l,!1)}if("1"==urlParams.test){l=document.getElementById("geFooter");null!=l&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",
|
||||
this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),l.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility=
|
||||
"visible"}else this.styleInput.style.visibility="hidden"})));var J=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:J.apply(this,arguments)}}l=document.getElementById("geInfo");null!=l&&l.parentNode.removeChild(l);if(Graph.fileSupport&&(!this.editor.chromeless||this.editor.editable)){var y=null;mxEvent.addListener(b.container,"dragleave",function(a){b.isEnabled()&&(null!=y&&(y.parentNode.removeChild(y),y=null),a.stopPropagation(),a.preventDefault())});
|
||||
mxEvent.addListener(b.container,"dragover",mxUtils.bind(this,function(a){null==y&&(!mxClient.IS_IE||10<document.documentMode)&&(y=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!=y&&(y.parentNode.removeChild(y),y=null);if(b.isEnabled()){var c=mxUtils.convertPoint(b.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),d=b.view.translate,e=b.view.scale,
|
||||
f=c.x/e-d.x,g=c.y/e-d.y;mxEvent.isAltDown(a)&&(g=f=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,f,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,f,g,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var h=
|
||||
a.dataTransfer.getData("text/html"),c=document.createElement("div");c.innerHTML=h;var p=null,d=c.getElementsByTagName("img");null!=d&&1==d.length?(h=d[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(h)||(p=!0)):(c=c.getElementsByTagName("a"),null!=c&&1==c.length&&(h=c[0].getAttribute("href")));var m=!0,n=mxUtils.bind(this,function(){b.setSelectionCells(this.insertTextAt(h,f,g,!0,p,null,m))});p&&h.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,"",f,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,
|
||||
f,g,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&b.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),f,g,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();"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(",");(a=this.getPageById(a.substring(b+1)))&&this.selectPage(a)}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.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle();this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle();this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[]));this.addListener("styleChanged",mxUtils.bind(this,function(a,b){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);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.importLucidChart(d,0,0),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.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?"https://www.draw.io/":"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){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)+".xml");var f=mxUtils.bind(this,function(a){e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".xml":e+".xml";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(A){this.handleError(A,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b)});if(/(\.vsdx?)($|\?)/i.test(e)||/(\.vssx)($|\?)/i.test(e))this.importVisio(a,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('{"state":"{\\"Properties\\":'==d.substring(0,26))/(\.json)$/i.test(e)&&(e=e.substring(0,e.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,e,b),this.importLucidChart(d,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));
|
||||
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(p){this.handleError(p,mxResources.get("errorLoadingFile"))}}else"image/png"==a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)}});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))});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(){this.confirm(mxResources.get("allChangesLost"),
|
||||
null,e,mxResources.get("cancel"),mxResources.get("discardChanges"))}))))};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=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,scale:b.view.scale,page:b.view.getBackgroundPageBounds(),bounds:b.getGraphBounds()}};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){function h(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"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=this.editor.graph.decompress(a)))}catch(L){}return a}if(f.source==(window.opener||window.parent)){var p=f.data;if("json"==urlParams.proto){try{p=JSON.parse(p)}catch(F){p=null}if(null==p)return;if("dialog"==p.action){this.showError(null!=p.titleKey?mxResources.get(p.titleKey):p.title,null!=p.messageKey?mxResources.get(p.messageKey):p.message,null!=p.buttonKey?mxResources.get(p.buttonKey):p.button);null!=p.modified&&
|
||||
(this.editor.modified=p.modified);return}if("prompt"==p.action){this.spinner.stop();var k=new FilenameDialog(this,p.defaultValue||"",null!=p.okKey?mxResources.get(p.okKey):null,function(a){null!=a&&g.postMessage(JSON.stringify({event:"prompt",value:a,message:p}),"*")},null!=p.titleKey?mxResources.get(p.titleKey):p.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==p.action){k=null;k="data:image/png;base64,"==p.xml.substring(0,22)?this.extractGraphModelFromPng(p.xml):h(p.xml);
|
||||
this.spinner.stop();k=new DraftDialog(this,mxResources.get("draftFound",[p.name||this.defaultFilename]),k,mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"edit",message:p}),"*")}),mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"discard",message:p}),"*")}),p.editKey?mxResources.get(p.editKey):null,p.discardKey?mxResources.get(p.discardKey):null,p.ignore?mxUtils.bind(this,function(){this.hideDialog();
|
||||
g.postMessage(JSON.stringify({event:"draft",result:"ignore",message:p}),"*")}):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{k.init()}catch(F){g.postMessage(JSON.stringify({event:"draft",error:F.toString(),message:p}),"*")}return}if("template"==p.action){this.spinner.stop();var k=1==p.enableRecent,m=1==p.enableSearch,k=new NewDialog(this,!1,null!=p.callback,mxUtils.bind(this,function(b,c){b=b||this.emptyDiagramXml;null!=p.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,k?mxUtils.bind(this,function(a){this.recentReadyCallback=a;g.postMessage(JSON.stringify({event:"recentDocs"}),"*")}):null,m?mxUtils.bind(this,function(a,b){this.searchReadyCallback=b;g.postMessage(JSON.stringify({event:"searchDocs",searchStr:a}),"*")}):null,function(a,b,c){g.postMessage(JSON.stringify({event:"template",
|
||||
docUrl:a,info:b,name:c}),"*")});this.showDialog(k.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));k.init();return}if("searchDocsList"==p.action)this.searchReadyCallback(p.list,p.errorMsg);else if("recentDocsList"==p.action)this.recentReadyCallback(p.list,p.errorMsg);else{if("status"==p.action){null!=p.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(p.messageKey))):null!=p.message&&this.editor.setStatus(mxUtils.htmlEntities(p.message));
|
||||
null!=p.modified&&(this.editor.modified=p.modified);return}if("spinner"==p.action){var l=null!=p.messageKey?mxResources.get(p.messageKey):p.message;null==p.show||p.show?this.spinner.spin(document.body,l):this.spinner.stop();return}if("export"==p.action){if("png"==p.format||"xmlpng"==p.format){if(null==p.spin&&null==p.spinKey||this.spinner.spin(document.body,null!=p.spinKey?mxResources.get(p.spinKey):p.spin)){var n=null!=p.xml?p.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var q=this.editor.graph,
|
||||
t=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=p.format;b.message=p;b.data=a;b.xml=encodeURIComponent(n);g.postMessage(JSON.stringify(b),"*")}),v=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==p.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(this.editor.graph.compress(n))));q!=this.editor.graph&&q.container.parentNode.removeChild(q.container);t(a)});if(this.isExportToCanvas()){if(null!=
|
||||
this.pages&&this.currentPage!=this.pages[0]){var q=this.createTemporaryGraph(q.getStylesheet()),u=q.getGlobalVariable,z=this.pages[0];q.getGlobalVariable=function(a){return"page"==a?z.getName():"pagenumber"==a?1:u.apply(this,arguments)};document.body.appendChild(q.container);q.model.setRoot(z.root)}this.exportToCanvas(mxUtils.bind(this,function(a){v(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){v(null)}),null,null,null,null,null,null,q)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+
|
||||
("xmlpng"==p.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(n)))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?t("data:image/png;base64,"+a.getText()):v(null)}),mxUtils.bind(this,function(){v(null)}))}}else{null!=p.xml&&0<p.xml.length&&this.setFileData(p.xml);l=this.createLoadMessage("export");if("html2"==p.format||"html"==p.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))k=this.getXmlFileData(),l.xml=mxUtils.getXml(k),l.data=
|
||||
this.getFileData(null,null,!0,null,null,null,k),l.format=p.format;else if("html"==p.format)n=this.editor.getGraphXml(),l.data=this.getHtml(n,this.editor.graph),l.xml=mxUtils.getXml(n),l.format=p.format;else{mxSvgCanvas2D.prototype.foAltText=null;k=this.editor.graph.background;k==mxConstants.NONE&&(k=null);l.xml=this.getFileData(!0);l.format="svg";if(p.embedImages||null==p.embedImages){if(null==p.spin&&null==p.spinKey||this.spinner.spin(document.body,null!=p.spinKey?mxResources.get(p.spinKey):p.spin))this.editor.graph.setEnabled(!1),
|
||||
"xmlsvg"==p.format?this.getEmbeddedSvg(l.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();l.data=this.createSvgDataUri(a);g.postMessage(JSON.stringify(l),"*")})):this.convertImages(this.editor.graph.getSvg(k),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();l.data=this.createSvgDataUri(mxUtils.getXml(a));g.postMessage(JSON.stringify(l),"*")}));return}k="xmlsvg"==p.format?this.getEmbeddedSvg(this.getFileData(!0),
|
||||
this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(k));l.data=this.createSvgDataUri(k)}g.postMessage(JSON.stringify(l),"*")}return}if("load"==p.action)d=1==p.autosave,this.hideDialog(),null!=p.modified&&null==urlParams.modified&&(urlParams.modified=p.modified),null!=p.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=p.saveAndExit),null!=p.title&&null!=this.buttonContainer&&(k=document.createElement("span"),mxUtils.write(k,p.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight=
|
||||
"12px",this.buttonContainer.style.paddingTop="12px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(k),this.embedFilenameSpan=k),p=null!=p.xmlpng?this.extractGraphModelFromPng(p.xmlpng):null!=p.xml&&"data:image/png;base64,"==p.xml.substring(0,22)?this.extractGraphModelFromPng(p.xml):p.xml;else{g.postMessage(JSON.stringify({error:"unknownMessage",
|
||||
data:JSON.stringify(p)}),"*");return}}}p=h(p);c=!0;try{a(p,f)}catch(F){this.handleError(F)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var x=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});e=x();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=x();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",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")),"*")}}));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";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?
|
||||
"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=document.createElement("button");mxUtils.write(b,mxResources.get("save"));b.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)");b.className="geBigButton";b.style.fontSize="12px";b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";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);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),
|
||||
null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(a,b){try{var c=a.split("\n"),d=[];if(0<c.length){var e={},f=null,g=null,h="",k="auto",p="auto",m=null,l=null,B=40,w=40,J=0,y=this.editor.graph;y.getGraphBounds();for(var D=function(){null!=b?b(aa):(y.setSelectionCells(aa),y.scrollCellToVisible(y.getSelectionCell()))},H=y.getFreeInsertPoint(),z=H.x,I=H.y,H=I,F=null,
|
||||
L="auto",M=[],X=null,Z=null,N=0;N<c.length&&"#"==c[N].charAt(0);){a=c[N];for(N++;N<c.length&&"\\"==a.charAt(a.length-1)&&"#"==c[N].charAt(0);)a=a.substring(0,a.length-1)+mxUtils.trim(c[N].substring(1)),N++;if("#"!=a.charAt(1)){var S=a.indexOf(":");if(0<S){var O=mxUtils.trim(a.substring(1,S)),G=mxUtils.trim(a.substring(S+1));"label"==O?F=y.sanitizeHtml(G):"style"==O?f=G:"identity"==O&&0<G.length&&"-"!=G?g=G:"namespace"==O&&0<G.length&&"-"!=G?h=G:"width"==O?k=G:"height"==O?p=G:"left"==O&&0<G.length?
|
||||
m=G:"top"==O&&0<G.length?l=G:"ignore"==O?Z=G.split(","):"connect"==O?M.push(JSON.parse(G)):"link"==O?X=G:"padding"==O?J=parseFloat(G):"edgespacing"==O?B=parseFloat(G):"nodespacing"==O?w=parseFloat(G):"layout"==O&&(L=G)}}}var W=this.editor.csvToArray(c[N]),S=null;if(null!=g)for(var R=0;R<W.length;R++)if(g==W[R]){S=R;break}null==F&&(F="%"+W[0]+"%");if(null!=M)for(var T=0;T<M.length;T++)null==e[M[T].to]&&(e[M[T].to]={});y.model.beginUpdate();try{for(R=N+1;R<c.length;R++){var V=this.editor.csvToArray(c[R]);
|
||||
if(V.length==W.length){var K=null,Q=null!=S?h+V[S]:null;null!=Q&&(K=y.model.getCell(Q));null==K&&(K=new mxCell(F,new mxGeometry(z,H,0,0),f||"whiteSpace=wrap;html=1;"),K.vertex=!0,K.id=Q);for(var P=0;P<V.length;P++)y.setAttributeForCell(K,W[P],V[P]);y.setAttributeForCell(K,"placeholders","1");K.style=y.replacePlaceholders(K,K.style);for(T=0;T<M.length;T++)e[M[T].to][K.getAttribute(M[T].to)]=K;null!=X&&"link"!=X&&(y.setLinkForCell(K,K.getAttribute(X)),y.setAttributeForCell(K,X,null));y.fireEvent(new mxEventObject("cellsInserted",
|
||||
"cells",[K]));var ba=this.editor.graph.getPreferredSizeForCell(K);K.vertex&&(null!=m&&null!=K.getAttribute(m)&&(K.geometry.x=z+parseFloat(K.getAttribute(m))),null!=l&&null!=K.getAttribute(l)&&(K.geometry.y=I+parseFloat(K.getAttribute(l))),"@"==k.charAt(0)&&null!=K.getAttribute(k.substring(1))?K.geometry.width=parseFloat(K.getAttribute(k.substring(1))):K.geometry.width="auto"==k?ba.width+J:parseFloat(k),"@"==p.charAt(0)&&null!=K.getAttribute(p.substring(1))?K.geometry.height=parseFloat(K.getAttribute(p.substring(1))):
|
||||
K.geometry.height="auto"==p?ba.height+J:parseFloat(p),H+=K.geometry.height+w);d.push(y.addCell(K))}}for(var U=d.slice(),aa=d.slice(),T=0;T<M.length;T++)for(var Y=M[T],R=0;R<d.length;R++){var K=d[R],ia=K.getAttribute(Y.from);if(null!=ia){y.setAttributeForCell(K,Y.from,null);for(var ja=ia.split(","),P=0;P<ja.length;P++){var ca=e[Y.to][ja[P]];null!=ca&&(F=Y.label,null!=Y.fromlabel&&(F=(K.getAttribute(Y.fromlabel)||"")+(F||"")),null!=Y.tolabel&&(F=(F||"")+(ca.getAttribute(Y.tolabel)||"")),aa.push(y.insertEdge(null,
|
||||
null,F||"",Y.invert?ca:K,Y.invert?K:ca,Y.style||y.createCurrentEdgeStyle())),mxUtils.remove(Y.invert?K:ca,U))}}}if(null!=Z)for(R=0;R<d.length;R++)for(K=d[R],P=0;P<Z.length;P++)y.setAttributeForCell(K,mxUtils.trim(Z[P]),null);var fa=new mxParallelEdgeLayout(y);fa.spacing=B;var ka=function(){fa.execute(y.getDefaultParent());for(var a=0;a<d.length;a++){var b=y.getCellGeometry(d[a]);b.x=Math.round(y.snap(b.x));b.y=Math.round(y.snap(b.y));"auto"==k&&(b.width=Math.round(y.snap(b.width)));"auto"==p&&(b.height=
|
||||
Math.round(y.snap(b.height)))}};if("circle"==L){var da=new mxCircleLayout(y);da.resetEdges=!1;var la=da.isVertexIgnored;da.isVertexIgnored=function(a){return la.apply(this,arguments)||0>mxUtils.indexOf(d,a)};this.executeLayout(function(){da.execute(y.getDefaultParent());ka()},!0,D);D=null}else if("horizontaltree"==L||"verticaltree"==L||"auto"==L&&aa.length==2*d.length-1&&1==U.length){y.view.validate();var ga=new mxCompactTreeLayout(y,"horizontaltree"==L);ga.levelDistance=w;ga.edgeRouting=!1;ga.resetEdges=
|
||||
!1;this.executeLayout(function(){ga.execute(y.getDefaultParent(),0<U.length?U[0]:null)},!0,D);D=null}else if("horizontalflow"==L||"verticalflow"==L||"auto"==L&&1==U.length){y.view.validate();var ha=new mxHierarchicalLayout(y,"horizontalflow"==L?mxConstants.DIRECTION_WEST:mxConstants.DIRECTION_NORTH);ha.intraCellSpacing=w;ha.disableEdgeStyle=!1;this.executeLayout(function(){ha.execute(y.getDefaultParent(),aa);y.moveCells(aa,z,I)},!0,D);D=null}else if("organic"==L||"auto"==L&&aa.length>d.length){y.view.validate();
|
||||
var ea=new mxFastOrganicLayout(y);ea.forceConstant=3*w;ea.resetEdges=!1;var na=ea.isVertexIgnored;ea.isVertexIgnored=function(a){return na.apply(this,arguments)||0>mxUtils.indexOf(d,a)};fa=new mxParallelEdgeLayout(y);fa.spacing=B;this.executeLayout(function(){ea.execute(y.getDefaultParent());ka()},!0,D);D=null}this.hideDialog()}finally{y.model.endUpdate()}null!=D&&D()}}catch(ma){this.handleError(ma)}};EditorUi.prototype.getSearch=function(a){var b="";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&
|
||||
null!=a&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(a,d)&&null!=urlParams[d]&&(b+=c+d+"="+urlParams[d],c="&")}else b=window.location.search;return b};EditorUi.prototype.getUrl=function(a){a=null!=a?a:window.location.pathname;var b=0<a.indexOf("?")?1:0;if("1"==urlParams.offline)a+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&
|
||||
(a=0==b?a+"?":a+"&",null!=urlParams[d]&&(a+=d+"="+urlParams[d],b++))}return a};EditorUi.prototype.showLinkDialog=function(a,b,c){a=new LinkDialog(this,a,b,c,!0);this.showDialog(a.container,480,130,!0,!0);a.init()};var h=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(a){var b=h.apply(this,arguments),c=this.editor.graph,d=b.getSourceGraphBounds;b.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&null!=this.source.minimumGraphSize){var a=
|
||||
this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*a.x/b),Math.ceil(this.source.minimumGraphSize.height-2*a.y/b))}return d.apply(this,arguments)};var e=b.getSourceContainerSize;b.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*b-2*
|
||||
a.x),Math.ceil(this.source.minimumGraphSize.height*b-2*a.y))}return e.apply(this,arguments)};b.getOutlineOffset=function(a){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var d=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(b.outline.container.clientWidth/a-(this.source.minimumGraphSize.width-2*d.x))/2)-d.x),Math.round(Math.max(0,(b.outline.container.clientHeight/a-(this.source.minimumGraphSize.height-2*d.y))/2)-d.y-5/a))}return new mxPoint(8/a,
|
||||
8/a)};var f=b.init;b.init=function(){f.apply(this,arguments);b.outline.view.getBackgroundPageBounds=function(){var a=c.getPageLayout(),b=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*b.width),this.scale*(this.translate.y+a.y*b.height),this.scale*a.width*b.width,this.scale*a.height*b.height)};b.outline.view.validateBackgroundPage()};this.editor.addListener("pageSelected",function(a,c){var d=c.getProperty("change"),e=b.source,f=b.outline;f.pageScale=e.pageScale;f.pageFormat=
|
||||
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=this.editor.graph.zapGremlins(mxUtils.trim(a));if(this.isCompatibleString(a))return this.importXml(a,b,c,g);if(0<a.length)if('{"state":"{\\"Properties\\":'==a.substring(0,26))this.importLucidChart(a,b,c,g);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)),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.importLocalFile=function(a,b){if(a&&Graph.fileSupport&&(!mxClient.IS_IE&&!mxClient.IS_IE11||
|
||||
0>navigator.appVersion.indexOf("Windows NT 6.1"))){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.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&&/(\.vsdx?)($|\?)/i.test(b)){var c=new Blob([a],{type:"application/octet-stream"});this.importVisio(c,mxUtils.bind(this,function(a){this.importXml(a)}),null,b)}else this.editor.graph.setSelectionCells(this.importXml(a))}));this.showDialog((new OpenDialog(this)).container,360,220,!0,!0,function(){window.openFile=null});if(!b){var e=this.dialog,f=e.close;this.dialog.close=mxUtils.bind(this,function(a){Editor.useLocalStorage=d;f.apply(e,arguments);a&&null==this.getCurrentFile()&&
|
||||
"1"!=urlParams.embed&&this.showSplash()})}}};EditorUi.prototype.importFile=function(a,b,c,d,e,g,h,m,l,p,A){p=null!=p?p:!0;var f=!1,k=null,n=mxUtils.bind(this,function(a){var b=null;null!=a&&"<mxlibrary"==a.substring(0,10)?this.loadLibrary(new LocalLibrary(this,a,h)):b=this.importXml(a,c,d,p);null!=m&&m(b)});"image"==b.substring(0,5)?(l=!1,"image/png"==b.substring(0,9)&&(b=A?null:this.extractGraphModelFromPng(a),null!=b&&0<b.length&&(k=this.importXml(b,c,d,p),l=!0)),l||(k=this.editor.graph,b=a.indexOf(";"),
|
||||
0<b&&(a=a.substring(0,b)+a.substring(a.indexOf(",",b+1))),p&&k.isGridEnabled()&&(c=k.snap(c),d=k.snap(d)),k=[k.insertVertex(null,null,"",c,d,e,g,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+a+";")])):/(\.*<graphml )/.test(a)&&"undefined"!==typeof window.mxGraphMlCodec?(new mxGraphMlCodec).decode(a,mxUtils.bind(this,function(a){a=this.importXml(a,c,d,p);null!=m&&m(a)})):null!=l&&null!=h&&(/(\.vsdx?)($|\?)/i.test(h)||/(\.vssx)($|\?)/i.test(h))?
|
||||
(f=!0,this.importVisio(l,n)):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(a,h)?(f=!0,this.parseFile(null!=l?l:new Blob([a],{type:"application/octet-stream"}),mxUtils.bind(this,function(a){4==a.readyState&&(200<=a.status&&299>=a.status?n(a.responseText):null!=m&&m(null))}),h)):/(\.vsd)($|\?)/i.test(h)||(k=this.insertTextAt(this.validateFileData(a),c,d,!0,null,p));f||null==m||m(k);return k};EditorUi.prototype.base64Encode=function(a){for(var b="",c=0,d=a.length,e,f,g;c<d;){e=
|
||||
a.charCodeAt(c++)&255;if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4);b+="==";break}f=a.charCodeAt(c++);if(c==d){b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(f&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&
|
||||
15)<<2);b+="=";break}g=a.charCodeAt(c++);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(e>>2);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((e&3)<<4|(f&240)>>4);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&15)<<2|(g&192)>>6);b+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(g&63)}return b};EditorUi.prototype.importFiles=function(a,b,c,d,e,g,h,m,l,p,A,E){b=null!=b?b:0;c=null!=
|
||||
c?c:0;d=null!=d?d:this.maxImageSize;p=null!=p?p:this.maxImageBytes;var f=null!=b&&null!=c,k=!0,n=!1;if(!mxClient.IS_CHROMEAPP&&null!=a)for(var t=A||this.resampleThreshold,q=0;q<a.length;q++)if("image/"==a[q].type.substring(0,6)&&a[q].size>t){n=!0;break}var v=mxUtils.bind(this,function(){var n=this.editor.graph,l=n.gridSize;e=null!=e?e:mxUtils.bind(this,function(a,b,c,d,e,g,k,h,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,h,p,f,E)});g=null!=g?g:mxUtils.bind(this,function(a){n.setSelectionCells(a)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var t=a.length,q=t,v=[],u=mxUtils.bind(this,function(a,b){v[a]=b;if(0==--q){this.spinner.stop();if(null!=m)m(v);else{var c=[];n.getModel().beginUpdate();try{for(var d=0;d<v.length;d++){var e=v[d]();null!=e&&(c=c.concat(e))}}finally{n.getModel().endUpdate()}}g(c)}}),x=0;x<t;x++)mxUtils.bind(this,function(f){var g=a[f],m=new FileReader;
|
||||
m.onload=mxUtils.bind(this,function(a){if(null==h||h(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var m=a.target.result,t=m.indexOf(","),q=decodeURIComponent(escape(atob(m.substring(t+1)))),v=mxUtils.parseXml(q),q=v.getElementsByTagName("svg");if(0<q.length){var q=q[0],z=E?null:q.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)?u(f,mxUtils.bind(this,function(){try{if(m.substring(0,t+1),null!=v){var a=v.getElementsByTagName("svg");if(0<a.length){var h=a[0],p=parseFloat(h.getAttribute("width")),A=parseFloat(h.getAttribute("height")),q=h.getAttribute("viewBox");if(null==q||0==q.length)h.setAttribute("viewBox","0 0 "+p+" "+A);else if(isNaN(p)||isNaN(A)){var u=q.split(" ");3<u.length&&(p=parseFloat(u[2]),A=parseFloat(u[3]))}m=this.createSvgDataUri(mxUtils.getXml(h));var z=
|
||||
Math.min(1,Math.min(d/Math.max(1,p)),d/Math.max(1,A)),x=e(m,g.type,b+f*l,c+f*l,Math.max(1,Math.round(p*z)),Math.max(1,Math.round(A*z)),g.name,k);if(isNaN(p)||isNaN(A)){var E=new Image;E.onload=mxUtils.bind(this,function(){p=Math.max(1,E.width);A=Math.max(1,E.height);x[0].geometry.width=p;x[0].geometry.height=A;h.setAttribute("viewBox","0 0 "+p+" "+A);m=this.createSvgDataUri(mxUtils.getXml(h));var a=m.indexOf(";");0<a&&(m=m.substring(0,a)+m.substring(m.indexOf(",",a+1)));n.setCellStyles("image",m,
|
||||
[x[0]])});E.src=this.createSvgDataUri(mxUtils.getXml(h))}return x}}}catch(da){}return null})):u(f,mxUtils.bind(this,function(){return e(z,"text/xml",b+f*l,c+f*l,0,0,g.name)}))}}else{q=!1;if("image/png"==g.type){var x=E?null:this.extractGraphModelFromPng(a.target.result);if(null!=x&&0<x.length){var J=new Image;J.src=a.target.result;u(f,mxUtils.bind(this,function(){return e(x,"text/xml",b+f*l,c+f*l,J.width,J.height,g.name)}));q=!0}}q||(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(h){this.resizeImage(h,a.target.result,mxUtils.bind(this,function(h,m,n){u(f,mxUtils.bind(this,function(){if(null!=h&&h.length<p){var t=k&&this.isResampleImage(a.target.result,A)?Math.min(1,Math.min(d/m,d/n)):1;return e(h,g.type,b+f*l,c+f*l,Math.round(m*
|
||||
t),Math.round(n*t),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),k,d,A)}),mxUtils.bind(this,function(){this.handleError({message:mxResources.get("invalidOrMissingFile")})})))}else e(a.target.result,g.type,b+f*l,c+f*l,240,160,g.name,function(a){u(f,function(){return a})})});/(\.vsdx?)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?e(null,g.type,b+f*l,c+f*l,240,160,g.name,function(a){u(f,function(){return a})},g):"image"==g.type.substring(0,5)?m.readAsDataURL(g):
|
||||
m.readAsText(g)})(x)});n?this.confirmImageResize(function(a){k=a;v()},l):v()};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,e=function(d,e){if(d||b)mxSettings.setResizeImages(d?e:null),mxSettings.save();c();a(e)};null==d||b?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(a){e(a,!0)},
|
||||
function(a){e(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):e(!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 e=new XMLHttpRequest;e.open("POST",OPEN_URL);e.onreadystatechange=
|
||||
function(){b(e)};e.send(d)};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 h=Math.max(f/e,k/e);if(1<h){var p=Math.round(f/h),m=Math.round(k/h),n=document.createElement("canvas");n.width=p;n.height=m;n.getContext("2d").drawImage(a,0,0,p,m);var l=n.toDataURL();if(l.length<b.length){var t=
|
||||
document.createElement("canvas");t.width=p;t.height=m;var q=t.toDataURL();l!==q&&(b=l,f=p,k=m)}}}catch(y){}c(b,f,k)};EditorUi.prototype.crcTable=[];for(var c=0;256>c;c++)for(var d=c,e=0;8>e;e++)d=1==(d&1)?3988292384^d>>>1:d>>>1,EditorUi.prototype.crcTable[c]=d;EditorUi.prototype.updateCRC=function(a,b,c,d){for(var e=0;e<d;e++)a=EditorUi.prototype.crcTable[(a^b[c+e])&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=h;h+=b;return a.substring(c,h)}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 h=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,h);do{var p=g(a);if("IDAT"==f(a,4)){e=a.substring(0,h-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(h-8,a.length);break}e+=a.substring(h-8,h-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){var b=null;try{var c=a.substring(a.indexOf(",")+1),d=window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(a,c,e){a=d.substring(a+8,a+8+e);"zTXt"==c?(e=a.indexOf(String.fromCharCode(0)),"mxGraphModel"==a.substring(0,e)&&(a=this.editor.graph.bytesToString(pako.inflateRaw(a.substring(e+2))).replace(/\+/g," "),null!=a&&0<a.length&&(b=a))):"tEXt"==c&&(a=a.split(String.fromCharCode(0)),1<a.length&&"mxGraphModel"==a[0]&&(b=a[1]));if(null!=b||
|
||||
"IDAT"==c)return!0}))}catch(u){}null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));null!=b&&"%"==b.charAt(0)&&(b=decodeURIComponent(b));return b};EditorUi.prototype.loadImage=function(a,b,c){var d=new Image;d.onload=function(){b(d)};null!=c&&(d.onerror=c);d.src=a};var g=EditorUi.prototype.init;EditorUi.prototype.init=function(){"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){try{a.handleCustomLink(b)}catch(H){a.handleError(H)}};this.isOffline()||"undefined"===typeof window.EditDataDialog||(EditDataDialog.placeholderHelpLink="https://desk.draw.io/support/solutions/articles/16000051979");var c=a.editor.getEditBlankUrl;this.editor.getEditBlankUrl=function(b){b=null!=b?b:"";if(null!=a.pages&&null!=a.currentPage)for(var d=0;d<a.pages.length;d++)if(a.pages[d]==a.currentPage){0<d&&(b+=(0<b.length?"&":"?")+"page="+d);break}"1"==urlParams.dev&&
|
||||
(b+=(0<b.length?"&":"?")+"dev=1&drawdev=1");return c.apply(this,arguments)};var d=b.addClickHandler;b.addClickHandler=function(a,c,e){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)};d.call(this,a,c,e)};g.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 e=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:e.apply(this,arguments)};var h=b.createLinkForHint;b.createLinkForHint=function(a,c){null!=
|
||||
a&&b.isCustomLink(a)&&(c=b.getLinkTitle(a));var d=h.call(this,a,c);null!=a&&b.isCustomLink(a)&&mxEvent.addListener(d,"click",function(c){b.customLinkClicked(a);mxEvent.consume(c)});return d};var m=b.labelLinkClicked;b.labelLinkClicked=function(a,c,d){var e=c.getAttribute("href");if(null==e||!b.isCustomLink(e)||!mxEvent.isTouchEvent(d)&&mxEvent.isPopupTrigger(d))m.apply(this,arguments);else{if(!b.isEnabled()||null!=a&&b.isCellLocked(a.cell))b.customLinkClicked(e),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 l=this.actions.get("print");l.setEnabled(!mxClient.IS_IOS||!navigator.standalone);l.visible=l.isEnabled();if(!this.editor.chromeless||this.editor.editable){var C=function(){window.setTimeout(function(){p.innerHTML=" ";p.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_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,e=0;e<c.types.length;e++)if("text/"===
|
||||
c.types[e].substring(0,5)){d=!0;break}if(!d){var f=c.items;for(index in f){var g=f[index];if("file"===g.kind){if(b.isEditing())this.importFiles([g.getAsFile()],0,0,this.maxImageSize,function(a,c,d,e,f,g){b.insertImage(a,f,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(Z){}}),!1);var p=document.createElement("div");
|
||||
p.style.position="absolute";p.style.whiteSpace="nowrap";p.style.overflow="hidden";p.style.display="block";p.contentEditable=!0;mxUtils.setOpacity(p,0);p.style.width="1px";p.style.height="1px";p.innerHTML=" ";var A=!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)||A||(p.style.left=b.container.scrollLeft+10+"px",p.style.top=b.container.scrollTop+10+"px",b.container.appendChild(p),A=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){p.focus();document.execCommand("selectAll",!1,null)},0):(p.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(){!A||224!=c&&17!=c&&91!=c||(A=!1,b.isEditing()||null!=this.dialog||null==b.container||b.container.focus(),p.parentNode.removeChild(p),mxUtils.clearSelection())}),0)}));mxEvent.addListener(p,"copy",mxUtils.bind(this,function(a){b.isEnabled()&&(mxClipboard.copy(b),this.copyCells(p),C())}));mxEvent.addListener(p,"cut",mxUtils.bind(this,function(a){b.isEnabled()&&(this.copyCells(p,!0),C())}));mxEvent.addListener(p,"paste",mxUtils.bind(this,function(a){b.isEnabled()&&
|
||||
!b.isCellLocked(b.getDefaultParent())&&(p.innerHTML=" ",p.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(a,p);p.innerHTML=" "}),0))}),!0);var E=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==p?!0:E.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,e,f,g){b.insertImage(a,f,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 e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,d)),e/Math.max(1,a));b.insertImage(decodeURIComponent(c),d*e,a*e)})):document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,a.dataTransfer.getData("text/plain"));
|
||||
a.stopPropagation();a.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){l=document.createElement("div");l.style.position="absolute";l.style.top="95px";l.style.left="250px";l.style.width="2000px";l.style.height="30px";l.style.background="whiteSmoke";document.body.appendChild(l);var B=document.createElement("div");B.style.position="absolute";B.style.top="125px";B.style.left="220px";B.style.width="30px";B.style.height="1000px";B.style.background="whiteSmoke";document.body.appendChild(B);
|
||||
var w=document.createElement("div");w.style.position="absolute";w.style.top="95px";w.style.left="220px";w.style.width="30px";w.style.height="30px";w.style.background="whiteSmoke";document.body.appendChild(w);this.vRuler=new mxRuler(this.editor.graph,B,!0);this.hRuler=new mxRuler(this.editor.graph,l,!1)}if("1"==urlParams.test){l=document.getElementById("geFooter");null!=l&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",
|
||||
this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),l.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(a,b){if(0<this.editor.graph.getSelectionCount()){var c=
|
||||
this.editor.graph.getSelectionCell(),c=this.editor.graph.getModel().getStyle(c);this.styleInput.value=c||"";this.styleInput.style.visibility="visible"}else this.styleInput.style.visibility="hidden"})));var J=this.isSelectionAllowed;this.isSelectionAllowed=function(a){return mxEvent.getSource(a)==this.styleInput?!0:J.apply(this,arguments)}}l=document.getElementById("geInfo");null!=l&&l.parentNode.removeChild(l);if(Graph.fileSupport&&(!this.editor.chromeless||this.editor.editable)){var y=null;mxEvent.addListener(b.container,
|
||||
"dragleave",function(a){b.isEnabled()&&(null!=y&&(y.parentNode.removeChild(y),y=null),a.stopPropagation(),a.preventDefault())});mxEvent.addListener(b.container,"dragover",mxUtils.bind(this,function(a){null==y&&(!mxClient.IS_IE||10<document.documentMode)&&(y=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!=y&&(y.parentNode.removeChild(y),y=null);if(b.isEnabled()){var c=
|
||||
mxUtils.convertPoint(b.container,mxEvent.getClientX(a),mxEvent.getClientY(a)),d=b.view.translate,e=b.view.scale,f=c.x/e-d.x,g=c.y/e-d.y;mxEvent.isAltDown(a)&&(g=f=0);if(0<a.dataTransfer.files.length)this.importFiles(a.dataTransfer.files,f,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,f,g,!0));else if(0<=mxUtils.indexOf(a.dataTransfer.types,"text/html")){var h=a.dataTransfer.getData("text/html"),c=document.createElement("div");c.innerHTML=h;var p=null,d=c.getElementsByTagName("img");null!=d&&1==d.length?(h=d[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(h)||(p=!0)):(c=c.getElementsByTagName("a"),null!=c&&1==c.length&&(h=c[0].getAttribute("href")));var m=!0,n=mxUtils.bind(this,function(){b.setSelectionCells(this.insertTextAt(h,
|
||||
f,g,!0,p,null,m))});p&&h.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,"",f,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,f,g,!0))})):0<=mxUtils.indexOf(a.dataTransfer.types,"text/plain")&&b.setSelectionCells(this.insertTextAt(a.dataTransfer.getData("text/plain"),f,g,!0))}}a.stopPropagation();a.preventDefault()}),!1)}this.initPages();"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(",");(a=this.getPageById(a.substring(b+1)))&&this.selectPage(a)}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.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle();this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle();this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[]));this.addListener("styleChanged",mxUtils.bind(this,function(a,b){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);
|
||||
mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);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.importLucidChart(d,0,0),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.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?
|
||||
"https://www.draw.io/":"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){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)+".xml");var f=mxUtils.bind(this,function(a){e=0<=e.lastIndexOf(".")?e.substring(0,e.lastIndexOf("."))+".xml":e+".xml";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(A){this.handleError(A,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(a,e,b)});if(/(\.vsdx?)($|\?)/i.test(e)||/(\.vssx)($|\?)/i.test(e))this.importVisio(a,
|
||||
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('{"state":"{\\"Properties\\":'==d.substring(0,26))/(\.json)$/i.test(e)&&
|
||||
(e=e.substring(0,e.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,e,b),this.importLucidChart(d,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));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(p){this.handleError(p,mxResources.get("errorLoadingFile"))}}else"image/png"==
|
||||
a.type.substring(0,9)&&(d=this.extractGraphModelFromPng(d)),this.spinner.stop(),this.openLocalFile(d,e,b)}});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))});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(){this.confirm(mxResources.get("allChangesLost"),null,e,mxResources.get("cancel"),mxResources.get("discardChanges"))}))))};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=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,scale:b.view.scale,page:b.view.getBackgroundPageBounds(),bounds:b.getGraphBounds()}};
|
||||
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){function h(a){if(null!=a&&"function"===typeof a.charAt&&"<"!=a.charAt(0))try{"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=this.editor.graph.decompress(a)))}catch(L){}return a}if(f.source==(window.opener||window.parent)){var p=f.data;if("json"==urlParams.proto){try{p=JSON.parse(p)}catch(F){p=null}if(null==p)return;if("dialog"==p.action){this.showError(null!=p.titleKey?mxResources.get(p.titleKey):p.title,null!=p.messageKey?mxResources.get(p.messageKey):
|
||||
p.message,null!=p.buttonKey?mxResources.get(p.buttonKey):p.button);null!=p.modified&&(this.editor.modified=p.modified);return}if("prompt"==p.action){this.spinner.stop();var k=new FilenameDialog(this,p.defaultValue||"",null!=p.okKey?mxResources.get(p.okKey):null,function(a){null!=a&&g.postMessage(JSON.stringify({event:"prompt",value:a,message:p}),"*")},null!=p.titleKey?mxResources.get(p.titleKey):p.title);this.showDialog(k.container,300,80,!0,!1);k.init();return}if("draft"==p.action){k=null;k="data:image/png;base64,"==
|
||||
p.xml.substring(0,22)?this.extractGraphModelFromPng(p.xml):h(p.xml);this.spinner.stop();k=new DraftDialog(this,mxResources.get("draftFound",[p.name||this.defaultFilename]),k,mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"edit",message:p}),"*")}),mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"discard",message:p}),"*")}),p.editKey?mxResources.get(p.editKey):null,p.discardKey?mxResources.get(p.discardKey):
|
||||
null,p.ignore?mxUtils.bind(this,function(){this.hideDialog();g.postMessage(JSON.stringify({event:"draft",result:"ignore",message:p}),"*")}):null);this.showDialog(k.container,640,480,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));try{k.init()}catch(F){g.postMessage(JSON.stringify({event:"draft",error:F.toString(),message:p}),"*")}return}if("template"==p.action){this.spinner.stop();var k=1==p.enableRecent,m=1==p.enableSearch,k=new NewDialog(this,!1,null!=p.callback,mxUtils.bind(this,
|
||||
function(b,c){b=b||this.emptyDiagramXml;null!=p.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,k?mxUtils.bind(this,function(a){this.recentReadyCallback=a;g.postMessage(JSON.stringify({event:"recentDocs"}),"*")}):null,m?mxUtils.bind(this,function(a,b){this.searchReadyCallback=b;g.postMessage(JSON.stringify({event:"searchDocs",
|
||||
searchStr:a}),"*")}):null,function(a,b,c){g.postMessage(JSON.stringify({event:"template",docUrl:a,info:b,name:c}),"*")});this.showDialog(k.container,620,440,!0,!1,mxUtils.bind(this,function(a){a&&this.actions.get("exit").funct()}));k.init();return}if("searchDocsList"==p.action)this.searchReadyCallback(p.list,p.errorMsg);else if("recentDocsList"==p.action)this.recentReadyCallback(p.list,p.errorMsg);else{if("status"==p.action){null!=p.messageKey?this.editor.setStatus(mxUtils.htmlEntities(mxResources.get(p.messageKey))):
|
||||
null!=p.message&&this.editor.setStatus(mxUtils.htmlEntities(p.message));null!=p.modified&&(this.editor.modified=p.modified);return}if("spinner"==p.action){var l=null!=p.messageKey?mxResources.get(p.messageKey):p.message;null==p.show||p.show?this.spinner.spin(document.body,l):this.spinner.stop();return}if("export"==p.action){if("png"==p.format||"xmlpng"==p.format){if(null==p.spin&&null==p.spinKey||this.spinner.spin(document.body,null!=p.spinKey?mxResources.get(p.spinKey):p.spin)){var n=null!=p.xml?
|
||||
p.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var q=this.editor.graph,t=mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();var b=this.createLoadMessage("export");b.format=p.format;b.message=p;b.data=a;b.xml=encodeURIComponent(n);g.postMessage(JSON.stringify(b),"*")}),v=mxUtils.bind(this,function(a){null==a&&(a=Editor.blankImage);"xmlpng"==p.format&&(a=this.writeGraphModelToPng(a,"zTXt","mxGraphModel",atob(this.editor.graph.compress(n))));q!=this.editor.graph&&
|
||||
q.container.parentNode.removeChild(q.container);t(a)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var q=this.createTemporaryGraph(q.getStylesheet()),u=q.getGlobalVariable,z=this.pages[0];q.getGlobalVariable=function(a){return"page"==a?z.getName():"pagenumber"==a?1:u.apply(this,arguments)};document.body.appendChild(q.container);q.model.setRoot(z.root)}this.exportToCanvas(mxUtils.bind(this,function(a){v(a.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,
|
||||
function(){v(null)}),null,null,null,null,null,null,q)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==p.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(n)))).send(mxUtils.bind(this,function(a){200<=a.getStatus()&&299>=a.getStatus()?t("data:image/png;base64,"+a.getText()):v(null)}),mxUtils.bind(this,function(){v(null)}))}}else{null!=p.xml&&0<p.xml.length&&this.setFileData(p.xml);l=this.createLoadMessage("export");if("html2"==p.format||"html"==p.format&&("0"!=
|
||||
urlParams.pages||null!=this.pages&&1<this.pages.length))k=this.getXmlFileData(),l.xml=mxUtils.getXml(k),l.data=this.getFileData(null,null,!0,null,null,null,k),l.format=p.format;else if("html"==p.format)n=this.editor.getGraphXml(),l.data=this.getHtml(n,this.editor.graph),l.xml=mxUtils.getXml(n),l.format=p.format;else{mxSvgCanvas2D.prototype.foAltText=null;k=this.editor.graph.background;k==mxConstants.NONE&&(k=null);l.xml=this.getFileData(!0);l.format="svg";if(p.embedImages||null==p.embedImages){if(null==
|
||||
p.spin&&null==p.spinKey||this.spinner.spin(document.body,null!=p.spinKey?mxResources.get(p.spinKey):p.spin))this.editor.graph.setEnabled(!1),"xmlsvg"==p.format?this.getEmbeddedSvg(l.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();l.data=this.createSvgDataUri(a);g.postMessage(JSON.stringify(l),"*")})):this.convertImages(this.editor.graph.getSvg(k),mxUtils.bind(this,function(a){this.editor.graph.setEnabled(!0);this.spinner.stop();l.data=
|
||||
this.createSvgDataUri(mxUtils.getXml(a));g.postMessage(JSON.stringify(l),"*")}));return}k="xmlsvg"==p.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(k));l.data=this.createSvgDataUri(k)}g.postMessage(JSON.stringify(l),"*")}return}if("load"==p.action)d=1==p.autosave,this.hideDialog(),null!=p.modified&&null==urlParams.modified&&(urlParams.modified=p.modified),null!=p.saveAndExit&&null==urlParams.saveAndExit&&(urlParams.saveAndExit=p.saveAndExit),
|
||||
null!=p.title&&null!=this.buttonContainer&&(k=document.createElement("span"),mxUtils.write(k,p.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(k),this.embedFilenameSpan=k),p=null!=p.xmlpng?
|
||||
this.extractGraphModelFromPng(p.xmlpng):null!=p.xml&&"data:image/png;base64,"==p.xml.substring(0,22)?this.extractGraphModelFromPng(p.xml):p.xml;else{g.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(p)}),"*");return}}}p=h(p);c=!0;try{a(p,f)}catch(F){this.handleError(F)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var x=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});
|
||||
e=x();d&&null==b&&(b=mxUtils.bind(this,function(a,b){var d=x();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",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")),"*")}}));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";a.style.position="absolute";a.style.paddingTop="atlas"==uiTheme?"2px":"3px";a.style.paddingLeft="8px";a.style.paddingBottom="2px";var b=document.createElement("button");mxUtils.write(b,mxResources.get("save"));b.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)");b.className="geBigButton";b.style.fontSize="12px";b.style.padding="4px 6px 4px 6px";b.style.borderRadius="3px";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);this.toolbar.staticElements.push(a);a.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&
|
||||
(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(a){this.importCsv(a)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(a,b){try{var c=a.split("\n"),d=[];if(0<c.length){var e={},f=null,g=null,h="",k="auto",p="auto",m=null,l=null,B=40,w=40,J=0,y=this.editor.graph;y.getGraphBounds();for(var D=
|
||||
function(){null!=b?b(aa):(y.setSelectionCells(aa),y.scrollCellToVisible(y.getSelectionCell()))},H=y.getFreeInsertPoint(),z=H.x,I=H.y,H=I,F=null,L="auto",M=[],X=null,Z=null,N=0;N<c.length&&"#"==c[N].charAt(0);){a=c[N];for(N++;N<c.length&&"\\"==a.charAt(a.length-1)&&"#"==c[N].charAt(0);)a=a.substring(0,a.length-1)+mxUtils.trim(c[N].substring(1)),N++;if("#"!=a.charAt(1)){var S=a.indexOf(":");if(0<S){var O=mxUtils.trim(a.substring(1,S)),G=mxUtils.trim(a.substring(S+1));"label"==O?F=y.sanitizeHtml(G):
|
||||
"style"==O?f=G:"identity"==O&&0<G.length&&"-"!=G?g=G:"namespace"==O&&0<G.length&&"-"!=G?h=G:"width"==O?k=G:"height"==O?p=G:"left"==O&&0<G.length?m=G:"top"==O&&0<G.length?l=G:"ignore"==O?Z=G.split(","):"connect"==O?M.push(JSON.parse(G)):"link"==O?X=G:"padding"==O?J=parseFloat(G):"edgespacing"==O?B=parseFloat(G):"nodespacing"==O?w=parseFloat(G):"layout"==O&&(L=G)}}}var W=this.editor.csvToArray(c[N]),S=null;if(null!=g)for(var R=0;R<W.length;R++)if(g==W[R]){S=R;break}null==F&&(F="%"+W[0]+"%");if(null!=
|
||||
M)for(var T=0;T<M.length;T++)null==e[M[T].to]&&(e[M[T].to]={});y.model.beginUpdate();try{for(R=N+1;R<c.length;R++){var V=this.editor.csvToArray(c[R]);if(V.length==W.length){var K=null,Q=null!=S?h+V[S]:null;null!=Q&&(K=y.model.getCell(Q));null==K&&(K=new mxCell(F,new mxGeometry(z,H,0,0),f||"whiteSpace=wrap;html=1;"),K.vertex=!0,K.id=Q);for(var P=0;P<V.length;P++)y.setAttributeForCell(K,W[P],V[P]);y.setAttributeForCell(K,"placeholders","1");K.style=y.replacePlaceholders(K,K.style);for(T=0;T<M.length;T++)e[M[T].to][K.getAttribute(M[T].to)]=
|
||||
K;null!=X&&"link"!=X&&(y.setLinkForCell(K,K.getAttribute(X)),y.setAttributeForCell(K,X,null));y.fireEvent(new mxEventObject("cellsInserted","cells",[K]));var ba=this.editor.graph.getPreferredSizeForCell(K);K.vertex&&(null!=m&&null!=K.getAttribute(m)&&(K.geometry.x=z+parseFloat(K.getAttribute(m))),null!=l&&null!=K.getAttribute(l)&&(K.geometry.y=I+parseFloat(K.getAttribute(l))),"@"==k.charAt(0)&&null!=K.getAttribute(k.substring(1))?K.geometry.width=parseFloat(K.getAttribute(k.substring(1))):K.geometry.width=
|
||||
"auto"==k?ba.width+J:parseFloat(k),"@"==p.charAt(0)&&null!=K.getAttribute(p.substring(1))?K.geometry.height=parseFloat(K.getAttribute(p.substring(1))):K.geometry.height="auto"==p?ba.height+J:parseFloat(p),H+=K.geometry.height+w);d.push(y.addCell(K))}}for(var U=d.slice(),aa=d.slice(),T=0;T<M.length;T++)for(var Y=M[T],R=0;R<d.length;R++){var K=d[R],ia=K.getAttribute(Y.from);if(null!=ia){y.setAttributeForCell(K,Y.from,null);for(var ja=ia.split(","),P=0;P<ja.length;P++){var ca=e[Y.to][ja[P]];null!=ca&&
|
||||
(F=Y.label,null!=Y.fromlabel&&(F=(K.getAttribute(Y.fromlabel)||"")+(F||"")),null!=Y.tolabel&&(F=(F||"")+(ca.getAttribute(Y.tolabel)||"")),aa.push(y.insertEdge(null,null,F||"",Y.invert?ca:K,Y.invert?K:ca,Y.style||y.createCurrentEdgeStyle())),mxUtils.remove(Y.invert?K:ca,U))}}}if(null!=Z)for(R=0;R<d.length;R++)for(K=d[R],P=0;P<Z.length;P++)y.setAttributeForCell(K,mxUtils.trim(Z[P]),null);var fa=new mxParallelEdgeLayout(y);fa.spacing=B;var ka=function(){fa.execute(y.getDefaultParent());for(var a=0;a<
|
||||
d.length;a++){var b=y.getCellGeometry(d[a]);b.x=Math.round(y.snap(b.x));b.y=Math.round(y.snap(b.y));"auto"==k&&(b.width=Math.round(y.snap(b.width)));"auto"==p&&(b.height=Math.round(y.snap(b.height)))}};if("circle"==L){var da=new mxCircleLayout(y);da.resetEdges=!1;var la=da.isVertexIgnored;da.isVertexIgnored=function(a){return la.apply(this,arguments)||0>mxUtils.indexOf(d,a)};this.executeLayout(function(){da.execute(y.getDefaultParent());ka()},!0,D);D=null}else if("horizontaltree"==L||"verticaltree"==
|
||||
L||"auto"==L&&aa.length==2*d.length-1&&1==U.length){y.view.validate();var ga=new mxCompactTreeLayout(y,"horizontaltree"==L);ga.levelDistance=w;ga.edgeRouting=!1;ga.resetEdges=!1;this.executeLayout(function(){ga.execute(y.getDefaultParent(),0<U.length?U[0]:null)},!0,D);D=null}else if("horizontalflow"==L||"verticalflow"==L||"auto"==L&&1==U.length){y.view.validate();var ha=new mxHierarchicalLayout(y,"horizontalflow"==L?mxConstants.DIRECTION_WEST:mxConstants.DIRECTION_NORTH);ha.intraCellSpacing=w;ha.disableEdgeStyle=
|
||||
!1;this.executeLayout(function(){ha.execute(y.getDefaultParent(),aa);y.moveCells(aa,z,I)},!0,D);D=null}else if("organic"==L||"auto"==L&&aa.length>d.length){y.view.validate();var ea=new mxFastOrganicLayout(y);ea.forceConstant=3*w;ea.resetEdges=!1;var na=ea.isVertexIgnored;ea.isVertexIgnored=function(a){return na.apply(this,arguments)||0>mxUtils.indexOf(d,a)};fa=new mxParallelEdgeLayout(y);fa.spacing=B;this.executeLayout(function(){ea.execute(y.getDefaultParent());ka()},!0,D);D=null}this.hideDialog()}finally{y.model.endUpdate()}null!=
|
||||
D&&D()}}catch(ma){this.handleError(ma)}};EditorUi.prototype.getSearch=function(a){var b="";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=a&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(a,d)&&null!=urlParams[d]&&(b+=c+d+"="+urlParams[d],c="&")}else b=window.location.search;return b};EditorUi.prototype.getUrl=function(a){a=null!=a?a:window.location.pathname;var b=0<a.indexOf("?")?1:0;if("1"==urlParams.offline)a+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),
|
||||
d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(a=0==b?a+"?":a+"&",null!=urlParams[d]&&(a+=d+"="+urlParams[d],b++))}return a};EditorUi.prototype.showLinkDialog=function(a,b,c){a=new LinkDialog(this,a,b,c,!0);this.showDialog(a.container,480,130,!0,!0);a.init()};var h=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(a){var b=h.apply(this,arguments),c=this.editor.graph,d=b.getSourceGraphBounds;b.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&
|
||||
null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*a.x/b),Math.ceil(this.source.minimumGraphSize.height-2*a.y/b))}return d.apply(this,arguments)};var e=b.getSourceContainerSize;b.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var a=this.source.getPagePadding(),b=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*
|
||||
b-2*a.x),Math.ceil(this.source.minimumGraphSize.height*b-2*a.y))}return e.apply(this,arguments)};b.getOutlineOffset=function(a){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var d=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(b.outline.container.clientWidth/a-(this.source.minimumGraphSize.width-2*d.x))/2)-d.x),Math.round(Math.max(0,(b.outline.container.clientHeight/a-(this.source.minimumGraphSize.height-2*d.y))/2)-d.y-5/a))}return new mxPoint(8/
|
||||
a,8/a)};var f=b.init;b.init=function(){f.apply(this,arguments);b.outline.view.getBackgroundPageBounds=function(){var a=c.getPageLayout(),b=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+a.x*b.width),this.scale*(this.translate.y+a.y*b.height),this.scale*a.width*b.width,this.scale*a.height*b.height)};b.outline.view.validateBackgroundPage()};this.editor.addListener("pageSelected",function(a,c){var d=c.getProperty("change"),e=b.source,f=b.outline;f.pageScale=e.pageScale;f.pageFormat=
|
||||
e.pageFormat;f.background=e.background;f.pageVisible=e.pageVisible;f.background=e.background;var g=mxUtils.getCurrentStyle(e.container);f.container.style.backgroundColor=g.backgroundColor;null!=e.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=e.view.backgroundPageShape.fill);b.outline.view.clear(d.previousPage.root,!0);b.outline.view.validate()});return b};EditorUi.prototype.getServiceCount=function(a,b){var c=0;null==this.drive&&"function"!==typeof window.DriveClient||
|
||||
c++;b||null==this.dropbox&&"function"!==typeof window.DropboxClient||c++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||c++;b||null==this.gitHub||c++;b||null==this.trello&&"function"!==typeof window.TrelloClient||c++;a&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&c++;mxClient.IS_IOS||c++;return c};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();var a=this.getCurrentFile(),b=null!=a||"1"==urlParams.embed&&this.editor.graph.isEnabled();
|
||||
this.menus.get("viewPanels").setEnabled(b);this.menus.get("viewZoom").setEnabled(b);var c=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==a||a.isRestricted());this.actions.get("makeCopy").setEnabled(!c);this.actions.get("print").setEnabled(!c);this.menus.get("exportAs").setEnabled(!c);this.menus.get("embed").setEnabled(!c);c="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("extras").setEnabled(c);Editor.enableCustomLibraries&&(this.menus.get("openLibraryFrom").setEnabled(c),
|
||||
|
@ -7512,7 +7513,7 @@ this.actions.get("editData").setEnabled(b);this.actions.get("shadowVisible").set
|
|||
this.actions.get("moveToFolder").setEnabled(null!=c);this.actions.get("makeCopy").setEnabled(null!=c&&!c.isRestricted());this.actions.get("editDiagram").setEnabled(b&&(null==c||!c.isRestricted()));this.actions.get("publishLink").setEnabled(null!=c&&!c.isRestricted());this.actions.get("tags").setEnabled(b&&(null==c||!c.isRestricted()));this.actions.get("find").setEnabled("hidden"!=this.diagramContainer.style.visibility);this.actions.get("layers").setEnabled("hidden"!=this.diagramContainer.style.visibility);
|
||||
this.actions.get("outline").setEnabled("hidden"!=this.diagramContainer.style.visibility);this.actions.get("rename").setEnabled(null!=c&&c.isRenamable()||"1"==urlParams.embed);this.actions.get("close").setEnabled(null!=c);this.menus.get("publish").setEnabled(null!=c&&!c.isRestricted());a=a.view.getState(a.getSelectionCell());this.actions.get("editShape").setEnabled(b&&null!=a&&null!=a.shape&&null!=a.shape.stencil)};var l=EditorUi.prototype.destroy;EditorUi.prototype.destroy=function(){null!=this.exportDialog&&
|
||||
(this.exportDialog.parentNode.removeChild(this.exportDialog),this.exportDialog=null);l.apply(this,arguments)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=function(a,b,c,d,e,g){var f=a.editor.graph;if("xml"==c)a.hideDialog(),a.saveData(b,"xml",mxUtils.getXml(a.editor.getGraphXml()),"text/xml");else if("svg"==c)a.hideDialog(),a.saveData(b,"svg",mxUtils.getXml(f.getSvg(d,e,g)),"image/svg+xml");else{var h=a.getFileData(!0,null,null,null,
|
||||
null,!0),k=f.getGraphBounds(),p=Math.floor(k.width*e/f.view.scale),m=Math.floor(k.height*e/f.view.scale);h.length<=MAX_REQUEST_SIZE&&p*m<MAX_AREA?(a.hideDialog(),a.saveRequest(b,c,function(a,b){return new mxXmlRequest(EXPORT_URL,"format="+c+"&base64="+(b||"0")+(null!=a?"&filename="+encodeURIComponent(a):"")+"&bg="+(null!=d?d:"none")+"&w="+p+"&h="+m+"&border="+g+"&xml="+encodeURIComponent(h))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();var mxSettings={currentVersion:16,defaultFormatWidth:600>screen.width?"0":"240",key:".drawio-config",getLanguage:function(){return mxSettings.settings.language},setLanguage:function(a){mxSettings.settings.language=a},getUi:function(){return mxSettings.settings.ui},setUi:function(a){mxSettings.settings.ui=a},getShowStartScreen:function(){return mxSettings.settings.showStartScreen},setShowStartScreen:function(a){mxSettings.settings.showStartScreen=a},getGridColor:function(){return mxSettings.settings.gridColor},
|
||||
null,!0),m=f.getGraphBounds(),p=Math.floor(m.width*e/f.view.scale),k=Math.floor(m.height*e/f.view.scale);h.length<=MAX_REQUEST_SIZE&&p*k<MAX_AREA?(a.hideDialog(),a.saveRequest(b,c,function(a,b){return new mxXmlRequest(EXPORT_URL,"format="+c+"&base64="+(b||"0")+(null!=a?"&filename="+encodeURIComponent(a):"")+"&bg="+(null!=d?d:"none")+"&w="+p+"&h="+k+"&border="+g+"&xml="+encodeURIComponent(h))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();var mxSettings={currentVersion:16,defaultFormatWidth:600>screen.width?"0":"240",key:".drawio-config",getLanguage:function(){return mxSettings.settings.language},setLanguage:function(a){mxSettings.settings.language=a},getUi:function(){return mxSettings.settings.ui},setUi:function(a){mxSettings.settings.ui=a},getShowStartScreen:function(){return mxSettings.settings.showStartScreen},setShowStartScreen:function(a){mxSettings.settings.showStartScreen=a},getGridColor:function(){return mxSettings.settings.gridColor},
|
||||
setGridColor:function(a){mxSettings.settings.gridColor=a},getAutosave:function(){return mxSettings.settings.autosave},setAutosave:function(a){mxSettings.settings.autosave=a},getResizeImages:function(){return mxSettings.settings.resizeImages},setResizeImages:function(a){mxSettings.settings.resizeImages=a},getOpenCounter:function(){return mxSettings.settings.openCounter},setOpenCounter:function(a){mxSettings.settings.openCounter=a},getLibraries:function(){return mxSettings.settings.libraries},setLibraries:function(a){mxSettings.settings.libraries=
|
||||
a},addCustomLibrary:function(a){mxSettings.load();0>mxUtils.indexOf(mxSettings.settings.customLibraries,a)&&("L.scratchpad"===a?mxSettings.settings.customLibraries.splice(0,0,a):mxSettings.settings.customLibraries.push(a));mxSettings.save()},removeCustomLibrary:function(a){mxSettings.load();mxUtils.remove(a,mxSettings.settings.customLibraries);mxSettings.save()},getCustomLibraries:function(){return mxSettings.settings.customLibraries},getPlugins:function(){return mxSettings.settings.plugins},setPlugins:function(a){mxSettings.settings.plugins=
|
||||
a},getRecentColors:function(){return mxSettings.settings.recentColors},setRecentColors:function(a){mxSettings.settings.recentColors=a},getFormatWidth:function(){return parseInt(mxSettings.settings.formatWidth)},setFormatWidth:function(a){mxSettings.settings.formatWidth=a},getCurrentEdgeStyle:function(){return mxSettings.settings.currentEdgeStyle},setCurrentEdgeStyle:function(a){mxSettings.settings.currentEdgeStyle=a},getCurrentVertexStyle:function(){return mxSettings.settings.currentVertexStyle},
|
||||
|
@ -7907,14 +7908,14 @@ mxResources.get("close"));a.innerHTML=mxResources.get("close");b.appendChild(a);
|
|||
App.prototype.start=function(){this.bg.parentNode.removeChild(this.bg);this.restoreLibraries();this.spinner.stop();try{if("1"!=urlParams.client&&"1"!=urlParams.embed&&mxEvent.addListener(window,"hashchange",mxUtils.bind(this,function(a){try{var b=this.getDiagramId(),c=this.getCurrentFile();null!=c&&c.getHash()==b||this.loadFile(b,!0)}catch(m){null!=document.body&&this.handleError(m,mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){var a=this.getCurrentFile();window.location.hash=null!=
|
||||
a?a.getHash():""}))}})),(null==window.location.hash||1>=window.location.hash.length)&&null!=urlParams.url)this.loadFile("U"+urlParams.url,!0);else if(null==this.getCurrentFile()){var a=mxUtils.bind(this,function(){if("1"==urlParams.client&&(null==window.location.hash||0==window.location.hash.length||"#P"==window.location.hash.substring(0,2))){var a=mxUtils.bind(this,function(a){"data:image/png;base64,"==a.substring(0,22)&&(a=this.extractGraphModelFromPng(a));var b=urlParams.title,b=null!=b?decodeURIComponent(b):
|
||||
this.defaultFilename;a=new LocalFile(this,a,b,!0);null!=window.location.hash&&"#P"==window.location.hash.substring(0,2)&&(a.getHash=function(){return window.location.hash.substring(1)});this.fileLoaded(a);this.getCurrentFile().setModified(!this.editor.chromeless)}),b=window.opener||window.parent;if(b!=window){var c=urlParams.create;null!=c?a(b[decodeURIComponent(c)]):(c=urlParams.data,null!=c?a(decodeURIComponent(c)):this.installMessageHandler(mxUtils.bind(this,function(c,d){d.source==b&&a(c)})))}}else if(null==
|
||||
this.dialog)if("1"==urlParams.demo)c=Editor.useLocalStorage,this.createFile(this.defaultFilename,null,null,null,null,null,null,!0),Editor.useLocalStorage=c;else{c=!1;try{c=null!=window.opener&&null!=window.opener.openFile}catch(f){}if(c)this.spinner.spin(document.body,mxResources.get("loading"));else if(c=this.getDiagramId(),"0"!=urlParams.splash||null!=c&&0!=c.length)this.loadFile(this.getDiagramId());else{var d=this.getDraft(),l=null!=d?d.data:this.getFileData(),c=Editor.useLocalStorage;this.createFile(this.defaultFilename,
|
||||
l,null,null,null,null,null,!0);Editor.useLocalStorage=c;null!=d&&(c=this.getCurrentFile(),null!=c&&c.addUnsavedStatus())}}});null!=this.drive&&this.defineCustomObjects();var b=decodeURIComponent(urlParams.create||"");if((null==window.location.hash||1>=window.location.hash.length)&&null!=b&&0<b.length&&this.spinner.spin(document.body,mxResources.get("loading"))){var c=mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("reconnecting"))&&(window.location.search=this.getSearch(["create",
|
||||
"title"]))}),d=mxUtils.bind(this,function(a){this.spinner.stop();if("0"!=urlParams.splash){this.fileLoaded(new LocalFile(this,a,null));this.editor.graph.setEnabled(!1);this.mode=urlParams.mode;var b=urlParams.title,b=null!=b?decodeURIComponent(b):this.defaultFilename;a=this.getServiceCount(!0);var c=4>=a?4:3,b=new CreateDialog(this,b,mxUtils.bind(this,function(a,b){if(null==b){this.hideDialog();var c=Editor.useLocalStorage;this.createFile(0<a.length?a:this.defaultFilename,this.getFileData(),null,
|
||||
null,null,null,null,!0);Editor.useLocalStorage=c}else this.createFile(a,this.getFileData(!0),null,b)}),null,null,null,null,"1"==urlParams.browser,null,null,!0,c);this.showDialog(b.container,380,a>c?390:270,!0,!1,mxUtils.bind(this,function(a){a&&null==this.getCurrentFile()&&this.showSplash()}));b.init()}}),b=decodeURIComponent(b);if("http://"!=b.substring(0,7)&&"https://"!=b.substring(0,8))try{null!=window.opener&&null!=window.opener[b]?d(window.opener[b]):this.handleError(null,mxResources.get("errorLoadingFile"))}catch(e){this.handleError(e,
|
||||
mxResources.get("errorLoadingFile"))}else this.loadTemplate(b,function(a){d(a)},mxUtils.bind(this,function(){this.handleError(null,mxResources.get("errorLoadingFile"),c)}))}else(null==window.location.hash||1>=window.location.hash.length)&&null!=urlParams.state&&null!=this.stateArg&&"open"==this.stateArg.action&&null!=this.stateArg.ids&&(window.location.hash="G"+this.stateArg.ids[0]),(null==window.location.hash||1>=window.location.hash.length)&&null!=this.drive&&null!=this.stateArg&&"create"==this.stateArg.action?
|
||||
(this.setMode(App.MODE_GOOGLE),this.actions.get("new").funct()):a()}}catch(e){this.handleError(e)}};
|
||||
this.dialog)if("1"==urlParams.demo)c=Editor.useLocalStorage,this.createFile(this.defaultFilename,null,null,null,null,null,null,!0),Editor.useLocalStorage=c;else{c=!1;try{c=null!=window.opener&&null!=window.opener.openFile}catch(f){}if(c)this.spinner.spin(document.body,mxResources.get("loading"));else if(c=this.getDiagramId(),"0"!=urlParams.splash||null!=c&&0!=c.length)this.loadFile(c);else if(!mxClient.IS_CHROMEAPP){var d=this.getDraft(),l=null!=d?d.data:this.getFileData(),c=Editor.useLocalStorage;
|
||||
this.createFile(this.defaultFilename,l,null,null,null,null,null,!0);Editor.useLocalStorage=c;null!=d&&(c=this.getCurrentFile(),null!=c&&c.addUnsavedStatus())}}});null!=this.drive&&this.defineCustomObjects();var b=decodeURIComponent(urlParams.create||"");if((null==window.location.hash||1>=window.location.hash.length)&&null!=b&&0<b.length&&this.spinner.spin(document.body,mxResources.get("loading"))){var c=mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("reconnecting"))&&
|
||||
(window.location.search=this.getSearch(["create","title"]))}),d=mxUtils.bind(this,function(a){this.spinner.stop();if("0"!=urlParams.splash){this.fileLoaded(new LocalFile(this,a,null));this.editor.graph.setEnabled(!1);this.mode=urlParams.mode;var b=urlParams.title,b=null!=b?decodeURIComponent(b):this.defaultFilename;a=this.getServiceCount(!0);var c=4>=a?4:3,b=new CreateDialog(this,b,mxUtils.bind(this,function(a,b){if(null==b){this.hideDialog();var c=Editor.useLocalStorage;this.createFile(0<a.length?
|
||||
a:this.defaultFilename,this.getFileData(),null,null,null,null,null,!0);Editor.useLocalStorage=c}else this.createFile(a,this.getFileData(!0),null,b)}),null,null,null,null,"1"==urlParams.browser,null,null,!0,c);this.showDialog(b.container,380,a>c?390:270,!0,!1,mxUtils.bind(this,function(a){a&&null==this.getCurrentFile()&&this.showSplash()}));b.init()}}),b=decodeURIComponent(b);if("http://"!=b.substring(0,7)&&"https://"!=b.substring(0,8))try{null!=window.opener&&null!=window.opener[b]?d(window.opener[b]):
|
||||
this.handleError(null,mxResources.get("errorLoadingFile"))}catch(e){this.handleError(e,mxResources.get("errorLoadingFile"))}else this.loadTemplate(b,function(a){d(a)},mxUtils.bind(this,function(){this.handleError(null,mxResources.get("errorLoadingFile"),c)}))}else(null==window.location.hash||1>=window.location.hash.length)&&null!=urlParams.state&&null!=this.stateArg&&"open"==this.stateArg.action&&null!=this.stateArg.ids&&(window.location.hash="G"+this.stateArg.ids[0]),(null==window.location.hash||
|
||||
1>=window.location.hash.length)&&null!=this.drive&&null!=this.stateArg&&"create"==this.stateArg.action?(this.setMode(App.MODE_GOOGLE),this.actions.get("new").funct()):a()}}catch(e){this.handleError(e)}};
|
||||
App.prototype.showSplash=function(a){var b=this.getServiceCount(!0,!0),c=mxUtils.bind(this,function(){var a=new SplashDialog(this);this.showDialog(a.container,340,2>b||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?200:260,!0,!0,mxUtils.bind(this,function(a){a&&!mxClient.IS_CHROMEAPP&&(a=Editor.useLocalStorage,this.createFile(this.defaultFilename,null,null,null,null,null,null,"1"!=urlParams.local),Editor.useLocalStorage=a)}),!0)});if(this.editor.isChromelessView())this.handleError({message:mxResources.get("noFileSelected")},
|
||||
mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){this.showSplash()}));else if(null==this.mode||a){a=4==b?2:3;var d=new StorageDialog(this,mxUtils.bind(this,function(){this.hideDialog();c()}),a);this.showDialog(d.container,3>a?260:300,4<=b?420:300,!0,!1);d.init()}else null==urlParams.create&&c()};
|
||||
mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){this.showSplash()}));else if(mxClient.IS_CHROMEAPP||null!=this.mode&&!a)null==urlParams.create&&c();else{a=4==b?2:3;var d=new StorageDialog(this,mxUtils.bind(this,function(){this.hideDialog();c()}),a);this.showDialog(d.container,3>a?260:300,4<=b?420:300,!0,!1);d.init()}};
|
||||
App.prototype.addLanguageMenu=function(a,b){var c=null;if((!this.isOfflineApp()||mxClient.IS_CHROMEAPP)&&null!=this.menus.get("language")){c=document.createElement("div");c.setAttribute("title",mxResources.get("language"));c.className="geIcon geSprite geSprite-globe";c.style.position="absolute";c.style.cursor="pointer";c.style.bottom="20px";c.style.right="20px";if(b){c.style.direction="rtl";c.style.textAlign="right";c.style.right="24px";var d=document.createElement("span");d.style.display="inline-block";
|
||||
d.style.fontSize="12px";d.style.margin="5px 24px 0 0";d.style.color="gray";mxUtils.write(d,mxResources.get("language"));c.appendChild(d)}mxEvent.addListener(c,"click",mxUtils.bind(this,function(a){this.editor.graph.popupMenuHandler.hideMenu();var b=new mxPopupMenu(this.menus.get("language").funct);b.div.className+=" geMenubarMenu";b.smartSeparators=!0;b.showDisabled=!0;b.autoExpand=!0;b.hideMenu=mxUtils.bind(this,function(){mxPopupMenu.prototype.hideMenu.apply(b,arguments);b.destroy()});var d=mxUtils.getOffset(c);
|
||||
b.popup(d.x,d.y+c.offsetHeight,null,a);this.setCurrentMenu(b)}));a.appendChild(c)}return c};
|
||||
|
@ -8027,84 +8028,84 @@ DriveFile&&b.constructor!=DropboxFile||null==a.drive&&b.constructor==DriveFile||
|
|||
fileSize:c.size,getXml:function(d,e){a.dropbox.readFile({path:b.stat.path_lower,rev:c.rev},d,e)},getUrl:function(){return a.getUrl(window.location.pathname+"?rev="+c.rev+"&chrome=0&edit=_blank")+window.location.hash}})})(c.entries[e]);var f=new RevisionDialog(a,d);a.showDialog(f.container,640,480,!0,!0);f.init()}catch(y){a.handleError(y)}}));c["catch"](function(b){a.spinner.stop();a.handleError(b)})}else a.drive.executeRequest(gapi.client.drive.revisions.list({fileId:b.getId()}),function(c){a.spinner.stop();
|
||||
for(var d=0;d<c.items.length;d++)(function(d){d.getXml=function(e,f){a.drive.executeRequest(gapi.client.drive.revisions.get({fileId:b.getId(),revisionId:c.items[c.items.length-1]===d?b.desc.headRevisionId:d.id}),function(b){a.drive.getXmlFile(b,null,function(a){e(a.getData())},function(a){f(a)})},function(a){f(a)})};d.getUrl=function(){return a.getUrl(window.location.pathname+"?rev="+d.id+"&chrome=0&edit=_blank")+window.location.hash}})(c.items[d]);d=new RevisionDialog(a,c.items);a.showDialog(d.container,
|
||||
640,480,!0,!0);d.init()},function(b){a.spinner.stop();a.handleError(b)})});a.actions.addAction("createRevision",function(){a.actions.get("save").funct()},null,null,Editor.ctrlKey+"+S");a.actions.addAction("upload...",function(){var b=a.getCurrentFile();null!=b&&(window.drawdata=a.getFileData(),b=null!=b.getTitle()?b.getTitle():a.defaultFilename,a.openLink(window.location.protocol+"//"+window.location.host+"/?create=drawdata&"+(a.mode==App.MODE_DROPBOX?"mode=dropbox&":"")+"title="+encodeURIComponent(b)))});
|
||||
if("undefined"!==typeof MathJax){var k=a.actions.addAction("mathematicalTypesetting",function(){var b=new ChangePageSetup(a);b.ignoreColor=!0;b.ignoreImage=!0;b.mathEnabled=!a.isMathEnabled();c.model.execute(b)});k.setToggleAction(!0);k.setSelectedCallback(function(){return a.isMathEnabled()});k.isEnabled=g}isLocalStorage&&(k=a.actions.addAction("showStartScreen",function(){mxSettings.setShowStartScreen(!mxSettings.getShowStartScreen());mxSettings.save()}),k.setToggleAction(!0),k.setSelectedCallback(function(){return mxSettings.getShowStartScreen()}));
|
||||
var n=a.actions.addAction("autosave",function(){a.editor.setAutosave(!a.editor.autosave)});n.setToggleAction(!0);n.setSelectedCallback(function(){return n.isEnabled()&&a.editor.autosave});a.actions.addAction("editGeometry...",function(){for(var b=c.getSelectionCells(),d=[],e=0;e<b.length;e++)c.getModel().isVertex(b[e])&&d.push(b[e]);0<d.length&&(b=new EditGeometryDialog(a,d),a.showDialog(b.container,180,180,!0,!0),b.init())},null,null,Editor.ctrlKey+"+Shift+M");var t="rounded shadow dashed dashPattern fontFamily fontSize fontColor fontStyle align verticalAlign strokeColor strokeWidth fillColor gradientColor swimlaneFillColor textOpacity gradientDirection glass labelBackgroundColor labelBorderColor opacity spacing spacingTop spacingLeft spacingBottom spacingRight endFill endArrow endSize startStill startArrow startSize arcSize".split(" ");
|
||||
a.actions.addAction("copyStyle",function(){var b=c.view.getState(c.getSelectionCell());if(c.isEnabled()&&null!=b){a.copiedStyle=mxUtils.clone(b.style);for(var b=c.getModel().getStyle(b.cell),b=null!=b?b.split(";"):[],d=0;d<b.length;d++){var e=b[d],f=e.indexOf("=");if(0<=f){var g=e.substring(0,f),e=e.substring(f+1);null==a.copiedStyle[g]&&"none"==e&&(a.copiedStyle[g]="none")}}}},null,null,Editor.ctrlKey+"+Shift+C");a.actions.addAction("pasteStyle",function(){if(c.isEnabled()&&!c.isSelectionEmpty()&&
|
||||
null!=a.copiedStyle){c.getModel().beginUpdate();try{for(var b=c.getSelectionCells(),d=0;d<b.length;d++)for(var e=c.view.getState(b[d]),f=0;f<t.length;f++){var g=t[f],h=a.copiedStyle[g];e.style[g]!=h&&c.setCellStyles(g,h,[b[d]])}}finally{c.getModel().endUpdate()}}},null,null,Editor.ctrlKey+"+Shift+V");a.actions.put("pageBackgroundImage",new Action(mxResources.get("backgroundImage")+"...",function(){if(!a.isOffline()){var b=new BackgroundImageDialog(a,function(b){a.setBackgroundImage(b)});a.showDialog(b.container,
|
||||
320,170,!0,!0);b.init()}}));a.actions.put("exportPng",new Action(mxResources.get("formatPng")+"...",function(){a.isExportToCanvas()?a.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://support.draw.io/display/DO/Exporting+Files",mxUtils.bind(this,function(b,c,d,e,f,g,h,k,m){b=parseInt(b);!isNaN(b)&&0<b&&a.exportImage(b/100,c,d,e,f,h,!k,m)}),!0,!1,"png"):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||a.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,
|
||||
function(b,c,d){a.downloadFile(c?"xmlpng":"png",null,null,b,null,null,d)}))}));a.actions.put("exportJpg",new Action(mxResources.get("formatJpg")+"...",function(){a.isExportToCanvas()?a.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://support.draw.io/display/DO/Exporting+Files",mxUtils.bind(this,function(b,c,d,e,f,g,h,k,m){b=parseInt(b);!isNaN(b)&&0<b&&a.exportImage(b/100,!1,d,e,!1,h,!k,!1,"jpeg")}),!0,!1,"jpeg"):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||
|
||||
a.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,function(b,c){a.downloadFile("jpeg",null,null,b)}),!0)}));k=a.actions.put("shadowVisible",new Action(mxResources.get("shadow"),function(){c.setShadowVisible(!c.shadowVisible)}));k.setToggleAction(!0);k.setSelectedCallback(function(){return c.shadowVisible});var u=!1;a.actions.put("about",new Action(mxResources.get("aboutDrawio")+"...",function(){u||(a.showDialog((new AboutDialog(a)).container,220,300,!0,!0,function(){u=!1}),
|
||||
u=!0)},null,null,"F1"));a.actions.addAction("userManual...",function(){a.openLink("https://support.draw.io/display/DO/Draw.io+Online+User+Manual")});a.actions.addAction("support...",function(){a.openLink("https://about.draw.io/support/")});a.actions.addAction("exportOptionsDisabled...",function(){a.handleError({message:mxResources.get("exportOptionsDisabledDetails")},mxResources.get("exportOptionsDisabled"))});a.actions.addAction("keyboardShortcuts...",function(){mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?
|
||||
a.openLink("https://www.draw.io/shortcuts.svg"):mxClient.IS_SVG?a.openLink("shortcuts.svg"):a.openLink("https://www.draw.io/?lightbox=1#Uhttps%3A%2F%2Fwww.draw.io%2Fshortcuts.svg")});a.actions.addAction("feedback...",function(){var b=new FeedbackDialog(a);a.showDialog(b.container,610,360,!0,!0);b.init()});a.actions.addAction("quickStart...",function(){a.openLink("https://www.youtube.com/watch?v=Z0D96ZikMkc")});k=a.actions.addAction("tags...",mxUtils.bind(this,function(){null==this.tagsWindow?(this.tagsWindow=
|
||||
new TagsWindow(a,document.body.offsetWidth-380,230,300,120),this.tagsWindow.window.addListener("show",function(){a.fireEvent(new mxEventObject("tags"))}),this.tagsWindow.window.addListener("hide",function(){a.fireEvent(new mxEventObject("tags"))}),this.tagsWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("tags"))):this.tagsWindow.window.setVisible(!this.tagsWindow.window.isVisible())}));k.setToggleAction(!0);k.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.tagsWindow&&
|
||||
this.tagsWindow.window.isVisible()}));k=a.actions.addAction("find...",mxUtils.bind(this,function(){null==this.findWindow?(this.findWindow=new FindWindow(a,document.body.offsetWidth-300,110,240,140),this.findWindow.window.addListener("show",function(){a.fireEvent(new mxEventObject("find"))}),this.findWindow.window.addListener("hide",function(){a.fireEvent(new mxEventObject("find"))}),this.findWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("find"))):this.findWindow.window.setVisible(!this.findWindow.window.isVisible())}));
|
||||
k.setToggleAction(!0);k.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.findWindow&&this.findWindow.window.isVisible()}));a.actions.put("exportVsdx",new Action(mxResources.get("formatVsdx")+" (beta)...",function(){a.exportVisio()}));if(mxClient.IS_CHROMEAPP||isLocalStorage&&"1"!=urlParams.offline)if(this.put("language",new Menu(mxUtils.bind(this,function(b,c){var d=mxUtils.bind(this,function(d){var e=""==d?mxResources.get("automatic"):mxLanguageMap[d],f=null;""!=e&&(f=b.addItem(e,
|
||||
null,mxUtils.bind(this,function(){mxSettings.setLanguage(d);mxSettings.save();mxClient.language=d;mxResources.loadDefaultBundle=!1;mxResources.add(RESOURCE_BASE);a.alert(mxResources.get("restartForChangeRequired"))}),c),(d==mxLanguage||""==d&&null==mxLanguage)&&b.addCheckmark(f,Editor.checkmarkImage));return f});d("");b.addSeparator(c);for(var e in mxLanguageMap)d(e)}))),"atlas"!=uiTheme){var q=Menus.prototype.createMenubar;Menus.prototype.createMenubar=function(a){var b=q.apply(this,arguments);if(null!=
|
||||
b){var c=this.get("language");null!=c&&(c=b.addMenu("",c.funct),c.setAttribute("title",mxResources.get("language")),c.style.width="16px",c.style.paddingTop="2px",c.style.paddingLeft="4px",c.innerHTML='<div class="geIcon geSprite geSprite-globe"/>',c.style.zIndex="1",c.style.position="absolute",c.style.top="2px",c.style.right="17px",c.style.display="block",mxClient.IS_VML||mxUtils.setOpacity(c,60),document.body.appendChild(c))}return b}}this.put("help",new Menu(mxUtils.bind(this,function(b,d){if(!mxClient.IS_CHROMEAPP&&
|
||||
a.isOffline())this.addMenuItems(b,["about"],d);else{var e=b.addItem("Search:",null,null,d,null,null,!1);e.style.backgroundColor="dark"==uiTheme?"#505759":"whiteSmoke";e.style.cursor="default";var f=document.createElement("input");f.setAttribute("type","text");f.setAttribute("size","25");f.style.marginLeft="8px";mxEvent.addListener(f,"keydown",mxUtils.bind(this,function(a){var b=mxUtils.trim(f.value);13==a.keyCode&&0<b.length?(this.editorUi.openLink("https://desk.draw.io/support/search/solutions?term="+
|
||||
encodeURIComponent(b)),f.value="",this.editorUi.logEvent({category:"Help",action:"search",label:b}),null!=this.editorUi.menubar&&window.setTimeout(mxUtils.bind(this,function(){this.editorUi.menubar.hideMenu()}),0)):27==a.keyCode&&(f.value="")}));e.firstChild.nextSibling.appendChild(f);mxEvent.addGestureListeners(f,function(a){document.activeElement!=f&&f.focus();mxEvent.consume(a)},function(a){mxEvent.consume(a)},function(a){mxEvent.consume(a)});window.setTimeout(function(){f.focus()},0);this.addMenuItems(b,
|
||||
["-","quickStart","userManual","keyboardShortcuts","-"],d);mxClient.IS_CHROMEAPP||this.addMenuItems(b,["feedback"],d);this.addMenuItems(b,["support","-"],d);a.isOffline()||EditorUi.isElectronApp||navigator.standalone||"1"==urlParams.embed||this.addMenuItems(b,["download"],d);navigator.standalone||"1"==urlParams.embed||this.addMenuItems(b,["offline"],d);this.addMenuItems(b,["-","about"],d)}"1"==urlParams.ruler&&(mxResources.parse("rulerInch=Ruler unit: Inches"),this.editorUi.actions.addAction("rulerInch",
|
||||
mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.INCHES);this.editorUi.hRuler.setUnit(mxRuler.prototype.INCHES);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),mxResources.parse("rulerCM=Ruler unit: CMs"),this.editorUi.actions.addAction("rulerCM",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.CENTIMETER);this.editorUi.hRuler.setUnit(mxRuler.prototype.CENTIMETER);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),
|
||||
mxResources.parse("rulerPixel=Ruler unit: Pixels"),this.editorUi.actions.addAction("rulerPixel",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.PIXELS);this.editorUi.hRuler.setUnit(mxRuler.prototype.PIXELS);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),this.addMenuItems(b,["-","rulerInch","rulerCM","rulerPixel"],d));"1"==urlParams.test&&(mxResources.parse("showBoundingBox=Show bounding box"),this.editorUi.actions.addAction("showBoundingBox",mxUtils.bind(this,
|
||||
function(){var a=c.getGraphBounds(),b=c.view.translate,e=c.view.scale;c.insertVertex(d,null,"",a.x/e-b.x,a.y/e-b.y,a.width/e,a.height/e,"fillColor=none;strokeColor=red;")})),mxResources.parse("createSidebarEntry=Create sidebar entry"),this.editorUi.actions.addAction("createSidebarEntry",mxUtils.bind(this,function(){c.isSelectionEmpty()||(mxLog.show(),mxLog.debug("sb.createVertexTemplateFromData('"+c.compress(mxUtils.getXml(c.encodeCells(c.getSelectionCells())))+"', width, height, 'Title');"))})),
|
||||
this.addMenuItems(b,["-","createSidebarEntry","showBoundingBox"],d),mxResources.parse("testXmlImageExport=XML Image Export"),this.editorUi.actions.addAction("testXmlImageExport",mxUtils.bind(this,function(){var a=new mxImageExport,b=c.getGraphBounds(),d=c.view.scale,e=mxUtils.createXmlDocument(),f=e.createElement("output");e.appendChild(f);e=new mxXmlCanvas2D(f);e.translate(Math.floor((1-b.x)/d),Math.floor((1-b.y)/d));e.scale(1/d);var g=0,h=e.save;e.save=function(){g++;h.apply(this,arguments)};var k=
|
||||
e.restore;e.restore=function(){g--;k.apply(this,arguments)};var p=a.drawShape;a.drawShape=function(a){mxLog.debug("entering shape",a,g);p.apply(this,arguments);mxLog.debug("leaving shape",a,g)};a.drawState(c.getView().getState(c.model.root),e);mxLog.show();mxLog.debug(mxUtils.getXml(f));mxLog.debug("stateCounter",g)})),this.addMenuItems(b,["testXmlImageExport"],d),mxResources.parse("testShowRtModel=Show RT model"),mxResources.parse("testDebugRtModel=Debug RT model"),mxResources.parse("testDownloadRtModel=Download RT model"),
|
||||
this.editorUi.actions.addAction("testShowRtModel",mxUtils.bind(this,function(){null!=this.editorUi.getCurrentFile()&&null!=this.editorUi.getCurrentFile().realtime&&(console.log("bytesUsed",this.editorUi.getCurrentFile().realtime.rtModel.bytesUsed),console.log("root",this.editorUi.getCurrentFile().realtime.dumpRoot()),this.editorUi.getCurrentFile().realtime.check())})),this.editorUi.actions.addAction("testDebugRtModel",mxUtils.bind(this,function(){gapi.drive.realtime.debug()})),this.editorUi.actions.addAction("testDownloadRtModel",
|
||||
mxUtils.bind(this,function(){var b=this.editorUi.getCurrentFile();null!=b&&null!=b.realtime&&a.spinner.spin(document.body,mxResources.get("export"))&&(b=new mxXmlRequest("https://www.googleapis.com/drive/v2/files/"+b.getHash().substring(1)+"/realtime",null,"GET"),b.setRequestHeaders=function(a){mxXmlRequest.prototype.setRequestHeaders.apply(this,arguments);var b=gapi.auth.getToken().access_token;a.setRequestHeader("authorization","Bearer "+b)},b.send(function(b){a.spinner.stop();200<=b.getStatus()&&
|
||||
299>=b.getStatus()&&a.saveLocalFile(b.getText(),"realtime.txt","text/plain")}))})),null!=this.editorUi.getCurrentFile()&&null!=this.editorUi.getCurrentFile().realtime&&this.addMenuItems(b,["-","testShowRtModel","testDebugRtModel","testDownloadRtModel"],d),mxResources.parse("testShowConsole=Show Console"),this.editorUi.actions.addAction("testShowConsole",function(){mxLog.isVisible()?mxLog.window.fit():mxLog.show();mxLog.window.div.style.zIndex=mxPopupMenu.prototype.zIndex-1}),this.addMenuItems(b,["-",
|
||||
"testShowConsole"]))})));a.actions.addAction("shapes...",function(){mxClient.IS_CHROMEAPP||!a.isOffline()?a.showDialog((new MoreShapesDialog(a,!0)).container,640,isLocalStorage?mxClient.IS_IOS?480:460:440,!0,!0):a.showDialog((new MoreShapesDialog(a,!1)).container,360,isLocalStorage?mxClient.IS_IOS?300:280:260,!0,!0)});a.actions.addAction("createShape...",function(){a.getCurrentFile();if(c.isEnabled()){var b=new mxCell("",new mxGeometry(0,0,120,120),a.defaultCustomShapeStyle);b.vertex=!0;b=new EditShapeDialog(a,
|
||||
b,mxResources.get("editShape")+":",630,400);a.showDialog(b.container,640,480,!0,!1);b.init()}});a.actions.put("embedHtml",new Action(mxResources.get("html")+"...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();a.showHtmlDialog(mxResources.get("create"),"https://desk.draw.io/support/solutions/articles/16000042542",b,function(b,c,d,e,f,g,h,k,p,m){a.createHtml(b,c,d,e,f,g,h,k,p,m,mxUtils.bind(this,function(b,c){var d=
|
||||
new EmbedDialog(a,b+"\n"+c,null,null,function(){var a=window.open(),d=a.document;"CSS1Compat"===document.compatMode&&d.writeln("<!DOCTYPE html>");d.writeln("<html>");d.writeln("<head><title>"+encodeURIComponent(mxResources.get("preview"))+'</title><meta charset="utf-8"></head>');d.writeln("<body>");d.writeln(b);var e=mxClient.IS_IE||mxClient.IS_EDGE||null!=document.documentMode;e&&d.writeln(c);d.writeln("</body>");d.writeln("</html>");d.close();if(!e){var f=a.document.createElement("div");f.marginLeft=
|
||||
"26px";f.marginTop="26px";mxUtils.write(f,mxResources.get("updatingDocument"));e=a.document.createElement("img");e.setAttribute("src",window.location.protocol+"//"+window.location.hostname+"/"+IMAGE_PATH+"/spin.gif");e.style.marginLeft="6px";f.appendChild(e);a.document.body.insertBefore(f,a.document.body.firstChild);window.setTimeout(function(){var a=document.createElement("script");a.type="text/javascript";a.src=/<script.*?src="(.*?)"/.exec(c)[1];d.body.appendChild(a);f.parentNode.removeChild(f)},
|
||||
20)}});a.showDialog(d.container,440,240,!0,!0);d.init()}))})})}));a.actions.put("liveImage",new Action("Live image...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();null!=b?(b=encodeURIComponent(b),b=new EmbedDialog(a,EXPORT_URL+"?format=png&url="+b,0),a.showDialog(b.container,440,240,!0,!0),b.init()):a.handleError({message:mxResources.get("invalidPublicUrl")})})}));a.actions.put("embedImage",new Action(mxResources.get("image")+
|
||||
"...",function(){a.showEmbedImageDialog(function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.createEmbedImage(b,c,d,e,f,g,function(b){a.spinner.stop();b=new EmbedDialog(a,b);a.showDialog(b.container,440,240,!0,!0);b.init()},function(b){a.spinner.stop();a.handleError(b)})},mxResources.get("image"),mxResources.get("retina"),a.isExportToCanvas())}));a.actions.put("embedSvg",new Action(mxResources.get("formatSvg")+"...",function(){a.showEmbedImageDialog(function(b,c,d,e,f,
|
||||
g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.createEmbedSvg(b,c,d,e,f,g,function(b){a.spinner.stop();b=new EmbedDialog(a,b);a.showDialog(b.container,440,240,!0,!0);b.init()},function(b){a.spinner.stop();a.handleError(b)})},mxResources.get("formatSvg"),mxResources.get("image"),!0,"https://desk.draw.io/support/solutions/articles/16000042548")}));a.actions.put("embedIframe",new Action(mxResources.get("iframe")+"...",function(){var b=c.getGraphBounds();a.showPublishLinkDialog(mxResources.get("iframe"),
|
||||
null,"100%",Math.ceil((b.y+b.height-c.view.translate.y)/c.view.scale)+2,function(b,c,d,e,f,g,h,k){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(p){a.spinner.stop();p=new EmbedDialog(a,'<iframe frameborder="0" style="width:'+h+";height:"+k+';" src="'+a.createLink(b,c,d,e,f,g,p)+'"></iframe>');a.showDialog(p.container,440,240,!0,!0);p.init()})},!0)}));a.actions.put("publishLink",new Action(mxResources.get("link")+"...",function(){a.showPublishLinkDialog(null,
|
||||
null,null,null,function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(h){a.spinner.stop();h=new EmbedDialog(a,a.createLink(b,c,d,e,f,g,h));a.showDialog(h.container,440,240,!0,!0);h.init()})})}));a.actions.addAction("googleDocs...",function(){a.openLink("http://docsaddon.draw.io")});a.actions.addAction("googleSites...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();
|
||||
b=new GoogleSitesDialog(a,b);a.showDialog(b.container,420,256,!0,!0);b.init()})});if(isLocalStorage||mxClient.IS_CHROMEAPP)k=a.actions.addAction("scratchpad",function(){a.toggleScratchpad()}),k.setToggleAction(!0),k.setSelectedCallback(function(){return null!=a.scratchpad}),a.actions.addAction("plugins...",function(){a.showDialog((new PluginsDialog(a)).container,360,170,!0,!1)});k=a.actions.addAction("search",function(){var b=a.sidebar.isEntryVisible("search");a.sidebar.showPalette("search",!b);isLocalStorage&&
|
||||
(mxSettings.settings.search=!b,mxSettings.save())});k.setToggleAction(!0);k.setSelectedCallback(function(){return a.sidebar.isEntryVisible("search")});"1"==urlParams.embed&&(a.actions.get("save").funct=function(b){c.isEditing()&&c.stopEditing();var d="0"!=urlParams.pages||null!=a.pages&&1<a.pages.length?a.getFileData(!0):mxUtils.getXml(a.editor.getGraphXml());if("json"==urlParams.proto){var e=a.createLoadMessage("save");e.xml=d;b&&(e.exit=!0);d=JSON.stringify(e)}(window.opener||window.parent).postMessage(d,
|
||||
"*");"0"!=urlParams.modified&&"1"!=urlParams.keepmodified&&(a.editor.modified=!1,a.editor.setStatus(""));null!=a.getCurrentFile()&&a.saveFile()},a.actions.addAction("saveAndExit",function(){a.actions.get("save").funct(!0)}),a.actions.addAction("exit",function(){var b=function(){a.editor.modified=!1;var b="json"==urlParams.proto?JSON.stringify({event:"exit",modified:a.editor.modified}):"";(window.opener||window.parent).postMessage(b,"*")};a.editor.modified?a.confirm(mxResources.get("allChangesLost"),
|
||||
null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b()}));this.put("exportAs",new Menu(mxUtils.bind(this,function(b,c){a.isExportToCanvas()?(this.addMenuItems(b,["exportPng"],c),a.jpgSupported&&this.addMenuItems(b,["exportJpg"],c)):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["exportPng","exportJpg"],c);this.addMenuItems(b,["exportSvg","-"],c);a.isOffline()||a.printPdfExport?this.addMenuItems(b,["exportPdf"],c):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||
|
||||
this.addMenuItems(b,["exportPdf"],c);mxClient.IS_IE11||mxClient.IS_IE||"undefined"===typeof VsdxExport&&a.isOffline()||this.addMenuItems(b,["exportVsdx"],c);this.addMenuItems(b,["-","exportHtml","exportXml","exportUrl"],c);a.isOffline()||(b.addSeparator(c),this.addMenuItem(b,"export",c).firstChild.nextSibling.innerHTML=mxResources.get("advanced")+"...")})));this.editorUi.actions.addAction("chatWindowTitle...",mxUtils.bind(this.editorUi,this.editorUi.toggleChat));this.put("importFrom",new Menu(function(b,
|
||||
d){function e(b){b.pickFile(function(c){a.spinner.spin(document.body,mxResources.get("loading"))&&b.getFile(c,function(b){var c=k(b.getTitle());/\.svg$/i.test(b.getTitle())&&!a.editor.isDataSvg(b.getData())&&(b.setData(a.createSvgDataUri(b.getData())),c="image/svg+xml");g(b.getData(),c,b.getTitle())},function(b){a.handleError(b,null!=b?mxResources.get("errorLoadingFile"):null)},b==a.drive)},!0)}var g=mxUtils.bind(this,function(b,d,e){var f=c.view,g=c.getGraphBounds(),h=c.snap(Math.ceil(Math.max(0,
|
||||
g.x/f.scale-f.translate.x)+4*c.gridSize)),k=c.snap(Math.ceil(Math.max(0,(g.y+g.height)/f.scale-f.translate.y)+4*c.gridSize));"data:image/"==b.substring(0,11)?a.loadImage(b,mxUtils.bind(this,function(f){var g=!0,m=mxUtils.bind(this,function(){a.resizeImage(f,b,mxUtils.bind(this,function(f,m,l){f=g?Math.min(1,Math.min(a.maxImageSize/m,a.maxImageSize/l)):1;a.importFile(b,d,h,k,Math.round(m*f),Math.round(l*f),e,function(b){a.spinner.stop();c.setSelectionCells(b);c.scrollCellToVisible(c.getSelectionCell())})}),
|
||||
g)});b.length>a.resampleThreshold?a.confirmImageResize(function(a){g=a;m()}):m()}),mxUtils.bind(this,function(){a.handleError({message:mxResources.get("cannotOpenFile")})})):a.importFile(b,d,h,k,0,0,e,function(b){a.spinner.stop();c.setSelectionCells(b);c.scrollCellToVisible(c.getSelectionCell())})}),k=mxUtils.bind(this,function(a){var b="text/xml";/\.png$/i.test(a)?b="image/png":/\.jpe?g$/i.test(a)?b="image/jpg":/\.gif$/i.test(a)&&(b="image/gif");return b});"undefined"!=typeof google&&"undefined"!=
|
||||
typeof google.picker&&(null!=a.drive?b.addItem(mxResources.get("googleDrive")+"...",null,function(){e(a.drive)},d):h&&b.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1));null!=a.gitHub&&b.addItem(mxResources.get("github")+"...",null,function(){e(a.gitHub)},d);null!=a.dropbox?b.addItem(mxResources.get("dropbox")+"...",null,function(){e(a.dropbox)},d):m&&b.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},
|
||||
d,null,!1);null!=a.oneDrive?b.addItem(mxResources.get("oneDrive")+"...",null,function(){e(a.oneDrive)},d):l&&b.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){e(a.trello)},d):f&&b.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);b.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&b.addItem(mxResources.get("browser")+
|
||||
"...",null,function(){a.importLocalFile(!1)},d);mxClient.IS_IOS||b.addItem(mxResources.get("device")+"...",null,function(){a.importLocalFile(!0)},d);a.isOffline()||(b.addSeparator(d),b.addItem(mxResources.get("url")+"...",null,function(){var b=new FilenameDialog(a,"",mxResources.get("import"),function(b){if(null!=b&&0<b.length&&a.spinner.spin(document.body,mxResources.get("loading"))){var c=/(\.png)($|\?)/i.test(b)?"image/png":"text/xml";a.loadUrl(PROXY_URL+"?url="+encodeURIComponent(b),function(a){g(a,
|
||||
c,b)},function(){a.spinner.stop();a.handleError(null,mxResources.get("errorLoadingFile"))},"image/png"==c)}},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},d))})).isEnabled=g;this.put("theme",new Menu(mxUtils.bind(this,function(b,c){var d=b.addItem(mxResources.get("kennedy"),null,function(){mxSettings.setUi("");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"atlas"!=uiTheme&&"dark"!=uiTheme&&"min"!=uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);
|
||||
d=b.addItem(mxResources.get("minimal"),null,function(){mxSettings.setUi("min");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"min"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);d=b.addItem(mxResources.get("atlas"),null,function(){mxSettings.setUi("atlas");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"atlas"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);d=b.addItem(mxResources.get("dark"),null,function(){mxSettings.setUi("dark");mxSettings.save();
|
||||
a.alert(mxResources.get("restartForChangeRequired"))},c);"dark"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage)})));k=this.editorUi.actions.addAction("rename...",mxUtils.bind(this,function(){var b=this.editorUi.getCurrentFile();if(null!=b){var c=null!=b.getTitle()?b.getTitle():this.editorUi.defaultFilename,c=new FilenameDialog(this.editorUi,c,mxResources.get("rename"),mxUtils.bind(this,function(a){null!=a&&0<a.length&&null!=b&&this.editorUi.spinner.spin(document.body,mxResources.get("renaming"))&&
|
||||
b.rename(a,mxUtils.bind(this,function(a){this.editorUi.spinner.stop()}),mxUtils.bind(this,function(a){this.editorUi.handleError(a,null!=a?mxResources.get("errorRenamingFile"):null)}))}),b.constructor==DriveFile||b.constructor==StorageFile?mxResources.get("diagramName"):null,function(b){if(null!=b&&0<b.length)return!0;a.showError(mxResources.get("error"),mxResources.get("invalidName"),mxResources.get("ok"));return!1});this.editorUi.showDialog(c.container,300,80,!0,!0);c.init()}}));k.isEnabled=function(){return this.enabled&&
|
||||
g.apply(this,arguments)};k.visible="1"!=urlParams.embed;a.actions.addAction("makeCopy...",mxUtils.bind(this,function(){var b=a.getCurrentFile();if(null!=b){var c=null!=b.getTitle()?b.getTitle():a.defaultFilename,d="",e=c.lastIndexOf(".");0<=e&&(d=c.substring(e),c=c.substring(0,e));c=mxResources.get("copyOf",[c])+d;b.constructor==DriveFile?(c=new CreateDialog(a,c,mxUtils.bind(this,function(c,d){"download"==d&&(d=App.MODE_GOOGLE);null!=c&&0<c.length&&(d==App.MODE_GOOGLE?a.spinner.spin(document.body,
|
||||
mxResources.get("saving"))&&b.save(!1,mxUtils.bind(this,function(){b.saveAs(c,mxUtils.bind(this,function(b){a.spinner.stop();var c=a.getUrl();window.openWindow(c+"#G"+b.id,null,mxUtils.bind(this,function(){window.location.hash="G"+b.id}))}),mxUtils.bind(this,function(b){a.handleError(b)}))}),mxUtils.bind(this,function(b){a.handleError(b)})):this.editorUi.createFile(c,this.editorUi.getFileData(!0),null,d))}),mxUtils.bind(this,function(){a.hideDialog()}),mxResources.get("makeCopy"),mxResources.get("create"),
|
||||
null,null,null,null,!0),a.showDialog(c.container,420,380,!0,!0),c.init()):a.editor.editAsNew(this.editorUi.getFileData(!0),c)}}));a.actions.addAction("moveToFolder...",mxUtils.bind(this,function(){var b=a.getCurrentFile();b.getMode()!=App.MODE_GOOGLE&&b.getMode()!=App.MODE_ONEDRIVE||a.pickFolder(b.getMode(),mxUtils.bind(this,function(c){a.spinner.spin(document.body,mxResources.get("moving"))&&b.move(c,mxUtils.bind(this,function(b){a.spinner.stop()}),mxUtils.bind(this,function(b){a.handleError(b)}))}))}));
|
||||
this.put("publish",new Menu(mxUtils.bind(this,function(a,b){this.addMenuItems(a,["publishLink"],b)})));a.actions.put("offline",new Action(mxResources.get("offline")+"...",function(){a.openLink("https://app.draw.io/")}));a.actions.put("download",new Action(mxResources.get("download")+"...",function(){a.openLink("https://get.draw.io/")}));this.editorUi.actions.addAction("share...",mxUtils.bind(this,function(){var a=this.editorUi.getCurrentFile();null!=a&&this.editorUi.drive.showPermissions(a.getId())}));
|
||||
this.put("embed",new Menu(mxUtils.bind(this,function(b,c){"1"==urlParams.test&&this.addMenuItems(b,["liveImage","-"],c);this.addMenuItems(b,["embedImage","embedSvg","-","embedHtml"],c);navigator.standalone||a.isOffline()||this.addMenuItems(b,["embedIframe"],c);a.isOffline()||this.addMenuItems(b,["-","googleSites","googleDocs"],c)})));var v=function(b,c,d,e){("plantUml"!=e||EditorUi.enablePlantUml)&&b.addItem(d,null,mxUtils.bind(this,function(){if("fromText"==e||"formatSql"==e||"plantUml"==e){var b=
|
||||
new ParseDialog(a,d,e);a.showDialog(b.container,620,420,!0,!1);a.dialog.container.style.overflow="auto"}else b=new CreateGraphDialog(a,d,e),a.showDialog(b.container,620,420,!0,!1);b.init()}),c)},x=function(a,b,d,e){var f=c.isMouseInsertPoint()?c.getInsertPoint():c.getFreeInsertPoint();a=new mxCell(a,new mxGeometry(f.x,f.y,b,d),e);a.vertex=!0;c.getModel().beginUpdate();try{a=c.addCell(a),c.fireEvent(new mxEventObject("cellsInserted","cells",[a]))}finally{c.getModel().endUpdate()}c.scrollCellToVisible(a);
|
||||
c.setSelectionCell(a);c.container.focus();c.editAfterInsert&&c.startEditing(a);return a};a.actions.addAction("insertText",function(){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&c.startEditingAtCell(x("Text",40,20,"text;html=1;resizable=0;autosize=1;align=center;verticalAlign=middle;points=[];fillColor=none;strokeColor=none;rounded=0;"))},null,null,Editor.ctrlKey+"+Shift+X").isEnabled=g;a.actions.addAction("insertRectangle",function(){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&
|
||||
x("",120,60,"whiteSpace=wrap;html=1;")},null,null,Editor.ctrlKey+"+K").isEnabled=g;a.actions.addAction("insertEllipse",function(){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&x("",80,80,"ellipse;whiteSpace=wrap;html=1;")},null,null,Editor.ctrlKey+"+Shift+K").isEnabled=g;a.actions.addAction("insertRhombus",function(){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&x("",80,80,"rhombus;whiteSpace=wrap;html=1;")}).isEnabled=g;var C=mxUtils.bind(this,function(a,b,c){for(var d=0;d<c.length;d++)"-"==
|
||||
c[d]?a.addSeparator(b):v(a,b,mxResources.get(c[d])+"...",c[d])});this.put("insert",new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,"insertText insertRectangle - insertEllipse insertRhombus - insertLink insertImage".split(" "),c);b.addSeparator(c);this.addSubmenu("insertLayout",b,c,mxResources.get("layout"));b.addSeparator(c);C(b,c,["fromText","plantUml","-","formatSql"]);b.addItem(mxResources.get("csv")+"...",null,function(){a.showImportCsvDialog()},c)})));this.put("insertLayout",new Menu(mxUtils.bind(this,
|
||||
function(a,b){C(a,b,"horizontalFlow verticalFlow - horizontalTree verticalTree radialTree - organic circle".split(" "))})));this.put("openRecent",new Menu(function(b,c){var d=a.getRecent();if(null!=d){for(var e=0;e<d.length;e++)(function(d){var e=d.mode;e==App.MODE_GOOGLE?e="googleDrive":e==App.MODE_ONEDRIVE&&(e="oneDrive");b.addItem(d.title+" ("+mxResources.get(e)+")",null,function(){a.loadFile(d.id)},c)})(d[e]);b.addSeparator(c)}b.addItem(mxResources.get("reset"),null,function(){a.resetRecent()},
|
||||
c)}));this.put("openFrom",new Menu(function(b,c){null!=a.drive?b.addItem(mxResources.get("googleDrive")+"...",null,function(){a.pickFile(App.MODE_GOOGLE)},c):h&&b.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.gitHub&&b.addItem(mxResources.get("github")+"...",null,function(){a.pickFile(App.MODE_GITHUB)},c);null!=a.dropbox?b.addItem(mxResources.get("dropbox")+"...",null,function(){a.pickFile(App.MODE_DROPBOX)},c):m&&b.addItem(mxResources.get("dropbox")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.oneDrive?b.addItem(mxResources.get("oneDrive")+"...",null,function(){a.pickFile(App.MODE_ONEDRIVE)},c):l&&b.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){a.pickFile(App.MODE_TRELLO)},c):f&&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.pickFile(App.MODE_BROWSER)},c);mxClient.IS_IOS||b.addItem(mxResources.get("device")+"...",null,function(){a.pickFile(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){null!=b&&0<b.length&&(null==a.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(b):window.openWindow((mxClient.IS_CHROMEAPP?
|
||||
"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(b)))},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},c))}));Editor.enableCustomLibraries&&(this.put("newLibrary",new Menu(function(b,c){"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?b.addItem(mxResources.get("googleDrive")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_GOOGLE)},c):h&&b.addItem(mxResources.get("googleDrive")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1));null!=a.gitHub&&b.addItem(mxResources.get("github")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_GITHUB)},c);null!=a.dropbox?b.addItem(mxResources.get("dropbox")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_DROPBOX)},c):m&&b.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.oneDrive?b.addItem(mxResources.get("oneDrive")+
|
||||
"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_ONEDRIVE)},c):l&&b.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_TRELLO)},c):f&&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.showLibraryDialog(null,null,null,null,App.MODE_BROWSER)},c);mxClient.IS_IOS||b.addItem(mxResources.get("device")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_DEVICE)},c)})),this.put("openLibraryFrom",new Menu(function(b,c){"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?b.addItem(mxResources.get("googleDrive")+"...",null,function(){a.pickLibrary(App.MODE_GOOGLE)},c):h&&b.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+
|
||||
"...)",null,function(){},c,null,!1));null!=a.gitHub&&b.addItem(mxResources.get("github")+"...",null,function(){a.pickLibrary(App.MODE_GITHUB)},c);null!=a.dropbox?b.addItem(mxResources.get("dropbox")+"...",null,function(){a.pickLibrary(App.MODE_DROPBOX)},c):m&&b.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.oneDrive?b.addItem(mxResources.get("oneDrive")+"...",null,function(){a.pickLibrary(App.MODE_ONEDRIVE)},c):l&&b.addItem(mxResources.get("oneDrive")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){a.pickLibrary(App.MODE_TRELLO)},c):f&&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);mxClient.IS_IOS||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.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(y){a.handleError(y,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))})));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 - edit - editLink openLink - selectVertices selectEdges selectAll selectNone - lockUnlock".split(" "))})));this.put("view",
|
||||
new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,(null!=this.editorUi.format?["formatPanel"]:[]).concat(["outline","layers","-"]));this.addMenuItems(b,["-","search"],c);if(isLocalStorage||mxClient.IS_CHROMEAPP){var d=this.addMenuItem(b,"scratchpad",c);a.isOffline()&&!mxClient.IS_CHROMEAPP||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);this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000032875")}"1"!=
|
||||
urlParams.embed&&this.addMenuItems(b,["autosave"],c);this.addMenuItems(b,["-","createShape","editDiagram"],c);b.addSeparator(c);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&this.addMenuItems(b,["showStartScreen"],c);!a.isOfflineApp()&&"1"!=urlParams.embed&&isLocalStorage&&(d=this.addMenuItem(b,"plugins",c),a.isOffline()||this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000056430"));b.addSeparator(c);d=this.addMenuItem(b,"tags",c);a.isOffline()&&!mxClient.IS_CHROMEAPP||
|
||||
this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000046966")})));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)),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();null!=d&&d.constructor==DriveFile?(d.isRestricted()&&this.addMenuItems(b,["exportOptionsDisabled"],c),null==d.realtime?this.addMenuItems(b,["save","share","-"],c):(d.isAutosave()||this.addMenuItems(b,["save"],c),this.addMenuItems(b,["share","chatWindowTitle","-"],c))):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):(this.addMenuItems(b,["-","save","saveAs","-","rename"],c),a.isOfflineApp()?a.isOffline()||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);null==d||d.constructor!=DriveFile&&d.constructor!=DropboxFile||this.addMenuItems(b,["-","revisionHistory"],c);null!=d&&d.constructor==DriveFile&&this.addMenuItems(b,["createRevision"],c);this.addMenuItems(b,["-","pageSetup"],c);mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["print"],c);this.addMenuItems(b,["-","close"])}})))};var c=Menus.prototype.menuCreated;Menus.prototype.menuCreated=function(a,b){if(480>=screen.width&&a==this.get("help")){b.style.paddingRight=
|
||||
"0px";b.style.paddingLeft="0px";b.innerHTML="";var d=document.createElement("img");d.setAttribute("border","0");d.setAttribute("valign","bottom");d.setAttribute("src",Editor.helpImage);b.appendChild(d)}c.apply(this,arguments)}})();function DiagramPage(a){this.node=a;(null==this.node.hasAttribute&&null==this.node.getAttribute("id")||null!=this.node.hasAttribute&&!this.node.hasAttribute("id"))&&this.node.setAttribute("id",function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute("id")};
|
||||
if("undefined"!==typeof MathJax){var k=a.actions.addAction("mathematicalTypesetting",function(){var b=new ChangePageSetup(a);b.ignoreColor=!0;b.ignoreImage=!0;b.mathEnabled=!a.isMathEnabled();c.model.execute(b)});k.setToggleAction(!0);k.setSelectedCallback(function(){return a.isMathEnabled()});k.isEnabled=g}if(isLocalStorage||mxClient.IS_CHROMEAPP)k=a.actions.addAction("showStartScreen",function(){mxSettings.setShowStartScreen(!mxSettings.getShowStartScreen());mxSettings.save()}),k.setToggleAction(!0),
|
||||
k.setSelectedCallback(function(){return mxSettings.getShowStartScreen()});var n=a.actions.addAction("autosave",function(){a.editor.setAutosave(!a.editor.autosave)});n.setToggleAction(!0);n.setSelectedCallback(function(){return n.isEnabled()&&a.editor.autosave});a.actions.addAction("editGeometry...",function(){for(var b=c.getSelectionCells(),d=[],e=0;e<b.length;e++)c.getModel().isVertex(b[e])&&d.push(b[e]);0<d.length&&(b=new EditGeometryDialog(a,d),a.showDialog(b.container,180,180,!0,!0),b.init())},
|
||||
null,null,Editor.ctrlKey+"+Shift+M");var t="rounded shadow dashed dashPattern fontFamily fontSize fontColor fontStyle align verticalAlign strokeColor strokeWidth fillColor gradientColor swimlaneFillColor textOpacity gradientDirection glass labelBackgroundColor labelBorderColor opacity spacing spacingTop spacingLeft spacingBottom spacingRight endFill endArrow endSize startStill startArrow startSize arcSize".split(" ");a.actions.addAction("copyStyle",function(){var b=c.view.getState(c.getSelectionCell());
|
||||
if(c.isEnabled()&&null!=b){a.copiedStyle=mxUtils.clone(b.style);for(var b=c.getModel().getStyle(b.cell),b=null!=b?b.split(";"):[],d=0;d<b.length;d++){var e=b[d],f=e.indexOf("=");if(0<=f){var g=e.substring(0,f),e=e.substring(f+1);null==a.copiedStyle[g]&&"none"==e&&(a.copiedStyle[g]="none")}}}},null,null,Editor.ctrlKey+"+Shift+C");a.actions.addAction("pasteStyle",function(){if(c.isEnabled()&&!c.isSelectionEmpty()&&null!=a.copiedStyle){c.getModel().beginUpdate();try{for(var b=c.getSelectionCells(),d=
|
||||
0;d<b.length;d++)for(var e=c.view.getState(b[d]),f=0;f<t.length;f++){var g=t[f],h=a.copiedStyle[g];e.style[g]!=h&&c.setCellStyles(g,h,[b[d]])}}finally{c.getModel().endUpdate()}}},null,null,Editor.ctrlKey+"+Shift+V");a.actions.put("pageBackgroundImage",new Action(mxResources.get("backgroundImage")+"...",function(){if(!a.isOffline()){var b=new BackgroundImageDialog(a,function(b){a.setBackgroundImage(b)});a.showDialog(b.container,320,170,!0,!0);b.init()}}));a.actions.put("exportPng",new Action(mxResources.get("formatPng")+
|
||||
"...",function(){a.isExportToCanvas()?a.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://support.draw.io/display/DO/Exporting+Files",mxUtils.bind(this,function(b,c,d,e,f,g,h,k,m){b=parseInt(b);!isNaN(b)&&0<b&&a.exportImage(b/100,c,d,e,f,h,!k,m)}),!0,!1,"png"):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||a.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,function(b,c,d){a.downloadFile(c?"xmlpng":"png",null,null,b,null,null,d)}))}));a.actions.put("exportJpg",
|
||||
new Action(mxResources.get("formatJpg")+"...",function(){a.isExportToCanvas()?a.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://support.draw.io/display/DO/Exporting+Files",mxUtils.bind(this,function(b,c,d,e,f,g,h,k,m){b=parseInt(b);!isNaN(b)&&0<b&&a.exportImage(b/100,!1,d,e,!1,h,!k,!1,"jpeg")}),!0,!1,"jpeg"):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||a.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,function(b,c){a.downloadFile("jpeg",
|
||||
null,null,b)}),!0)}));k=a.actions.put("shadowVisible",new Action(mxResources.get("shadow"),function(){c.setShadowVisible(!c.shadowVisible)}));k.setToggleAction(!0);k.setSelectedCallback(function(){return c.shadowVisible});var u=!1;a.actions.put("about",new Action(mxResources.get("aboutDrawio")+"...",function(){u||(a.showDialog((new AboutDialog(a)).container,220,300,!0,!0,function(){u=!1}),u=!0)},null,null,"F1"));a.actions.addAction("userManual...",function(){a.openLink("https://support.draw.io/display/DO/Draw.io+Online+User+Manual")});
|
||||
a.actions.addAction("support...",function(){a.openLink("https://about.draw.io/support/")});a.actions.addAction("exportOptionsDisabled...",function(){a.handleError({message:mxResources.get("exportOptionsDisabledDetails")},mxResources.get("exportOptionsDisabled"))});a.actions.addAction("keyboardShortcuts...",function(){mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?a.openLink("https://www.draw.io/shortcuts.svg"):mxClient.IS_SVG?a.openLink("shortcuts.svg"):a.openLink("https://www.draw.io/?lightbox=1#Uhttps%3A%2F%2Fwww.draw.io%2Fshortcuts.svg")});
|
||||
a.actions.addAction("feedback...",function(){var b=new FeedbackDialog(a);a.showDialog(b.container,610,360,!0,!0);b.init()});a.actions.addAction("quickStart...",function(){a.openLink("https://www.youtube.com/watch?v=Z0D96ZikMkc")});k=a.actions.addAction("tags...",mxUtils.bind(this,function(){null==this.tagsWindow?(this.tagsWindow=new TagsWindow(a,document.body.offsetWidth-380,230,300,120),this.tagsWindow.window.addListener("show",function(){a.fireEvent(new mxEventObject("tags"))}),this.tagsWindow.window.addListener("hide",
|
||||
function(){a.fireEvent(new mxEventObject("tags"))}),this.tagsWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("tags"))):this.tagsWindow.window.setVisible(!this.tagsWindow.window.isVisible())}));k.setToggleAction(!0);k.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.tagsWindow&&this.tagsWindow.window.isVisible()}));k=a.actions.addAction("find...",mxUtils.bind(this,function(){null==this.findWindow?(this.findWindow=new FindWindow(a,document.body.offsetWidth-300,110,240,140),
|
||||
this.findWindow.window.addListener("show",function(){a.fireEvent(new mxEventObject("find"))}),this.findWindow.window.addListener("hide",function(){a.fireEvent(new mxEventObject("find"))}),this.findWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("find"))):this.findWindow.window.setVisible(!this.findWindow.window.isVisible())}));k.setToggleAction(!0);k.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.findWindow&&this.findWindow.window.isVisible()}));a.actions.put("exportVsdx",
|
||||
new Action(mxResources.get("formatVsdx")+" (beta)...",function(){a.exportVisio()}));if(mxClient.IS_CHROMEAPP||isLocalStorage&&"1"!=urlParams.offline)if(this.put("language",new Menu(mxUtils.bind(this,function(b,c){var d=mxUtils.bind(this,function(d){var e=""==d?mxResources.get("automatic"):mxLanguageMap[d],f=null;""!=e&&(f=b.addItem(e,null,mxUtils.bind(this,function(){mxSettings.setLanguage(d);mxSettings.save();mxClient.language=d;mxResources.loadDefaultBundle=!1;mxResources.add(RESOURCE_BASE);a.alert(mxResources.get("restartForChangeRequired"))}),
|
||||
c),(d==mxLanguage||""==d&&null==mxLanguage)&&b.addCheckmark(f,Editor.checkmarkImage));return f});d("");b.addSeparator(c);for(var e in mxLanguageMap)d(e)}))),"atlas"!=uiTheme){var q=Menus.prototype.createMenubar;Menus.prototype.createMenubar=function(a){var b=q.apply(this,arguments);if(null!=b){var c=this.get("language");null!=c&&(c=b.addMenu("",c.funct),c.setAttribute("title",mxResources.get("language")),c.style.width="16px",c.style.paddingTop="2px",c.style.paddingLeft="4px",c.innerHTML='<div class="geIcon geSprite geSprite-globe"/>',
|
||||
c.style.zIndex="1",c.style.position="absolute",c.style.top="2px",c.style.right="17px",c.style.display="block",mxClient.IS_VML||mxUtils.setOpacity(c,60),document.body.appendChild(c))}return b}}this.put("help",new Menu(mxUtils.bind(this,function(b,d){if(!mxClient.IS_CHROMEAPP&&a.isOffline())this.addMenuItems(b,["about"],d);else{var e=b.addItem("Search:",null,null,d,null,null,!1);e.style.backgroundColor="dark"==uiTheme?"#505759":"whiteSmoke";e.style.cursor="default";var f=document.createElement("input");
|
||||
f.setAttribute("type","text");f.setAttribute("size","25");f.style.marginLeft="8px";mxEvent.addListener(f,"keydown",mxUtils.bind(this,function(a){var b=mxUtils.trim(f.value);13==a.keyCode&&0<b.length?(this.editorUi.openLink("https://desk.draw.io/support/search/solutions?term="+encodeURIComponent(b)),f.value="",this.editorUi.logEvent({category:"Help",action:"search",label:b}),null!=this.editorUi.menubar&&window.setTimeout(mxUtils.bind(this,function(){this.editorUi.menubar.hideMenu()}),0)):27==a.keyCode&&
|
||||
(f.value="")}));e.firstChild.nextSibling.appendChild(f);mxEvent.addGestureListeners(f,function(a){document.activeElement!=f&&f.focus();mxEvent.consume(a)},function(a){mxEvent.consume(a)},function(a){mxEvent.consume(a)});window.setTimeout(function(){f.focus()},0);this.addMenuItems(b,["-","quickStart","userManual","keyboardShortcuts","-"],d);mxClient.IS_CHROMEAPP||this.addMenuItems(b,["feedback"],d);this.addMenuItems(b,["support","-"],d);a.isOffline()||EditorUi.isElectronApp||navigator.standalone||
|
||||
"1"==urlParams.embed||this.addMenuItems(b,["download"],d);navigator.standalone||"1"==urlParams.embed||this.addMenuItems(b,["offline"],d);this.addMenuItems(b,["-","about"],d)}"1"==urlParams.ruler&&(mxResources.parse("rulerInch=Ruler unit: Inches"),this.editorUi.actions.addAction("rulerInch",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.INCHES);this.editorUi.hRuler.setUnit(mxRuler.prototype.INCHES);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),
|
||||
mxResources.parse("rulerCM=Ruler unit: CMs"),this.editorUi.actions.addAction("rulerCM",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.CENTIMETER);this.editorUi.hRuler.setUnit(mxRuler.prototype.CENTIMETER);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),mxResources.parse("rulerPixel=Ruler unit: Pixels"),this.editorUi.actions.addAction("rulerPixel",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.PIXELS);this.editorUi.hRuler.setUnit(mxRuler.prototype.PIXELS);
|
||||
this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),this.addMenuItems(b,["-","rulerInch","rulerCM","rulerPixel"],d));"1"==urlParams.test&&(mxResources.parse("showBoundingBox=Show bounding box"),this.editorUi.actions.addAction("showBoundingBox",mxUtils.bind(this,function(){var a=c.getGraphBounds(),b=c.view.translate,e=c.view.scale;c.insertVertex(d,null,"",a.x/e-b.x,a.y/e-b.y,a.width/e,a.height/e,"fillColor=none;strokeColor=red;")})),mxResources.parse("createSidebarEntry=Create sidebar entry"),
|
||||
this.editorUi.actions.addAction("createSidebarEntry",mxUtils.bind(this,function(){c.isSelectionEmpty()||(mxLog.show(),mxLog.debug("sb.createVertexTemplateFromData('"+c.compress(mxUtils.getXml(c.encodeCells(c.getSelectionCells())))+"', width, height, 'Title');"))})),this.addMenuItems(b,["-","createSidebarEntry","showBoundingBox"],d),mxResources.parse("testXmlImageExport=XML Image Export"),this.editorUi.actions.addAction("testXmlImageExport",mxUtils.bind(this,function(){var a=new mxImageExport,b=c.getGraphBounds(),
|
||||
d=c.view.scale,e=mxUtils.createXmlDocument(),f=e.createElement("output");e.appendChild(f);e=new mxXmlCanvas2D(f);e.translate(Math.floor((1-b.x)/d),Math.floor((1-b.y)/d));e.scale(1/d);var g=0,h=e.save;e.save=function(){g++;h.apply(this,arguments)};var p=e.restore;e.restore=function(){g--;p.apply(this,arguments)};var k=a.drawShape;a.drawShape=function(a){mxLog.debug("entering shape",a,g);k.apply(this,arguments);mxLog.debug("leaving shape",a,g)};a.drawState(c.getView().getState(c.model.root),e);mxLog.show();
|
||||
mxLog.debug(mxUtils.getXml(f));mxLog.debug("stateCounter",g)})),this.addMenuItems(b,["testXmlImageExport"],d),mxResources.parse("testShowRtModel=Show RT model"),mxResources.parse("testDebugRtModel=Debug RT model"),mxResources.parse("testDownloadRtModel=Download RT model"),this.editorUi.actions.addAction("testShowRtModel",mxUtils.bind(this,function(){null!=this.editorUi.getCurrentFile()&&null!=this.editorUi.getCurrentFile().realtime&&(console.log("bytesUsed",this.editorUi.getCurrentFile().realtime.rtModel.bytesUsed),
|
||||
console.log("root",this.editorUi.getCurrentFile().realtime.dumpRoot()),this.editorUi.getCurrentFile().realtime.check())})),this.editorUi.actions.addAction("testDebugRtModel",mxUtils.bind(this,function(){gapi.drive.realtime.debug()})),this.editorUi.actions.addAction("testDownloadRtModel",mxUtils.bind(this,function(){var b=this.editorUi.getCurrentFile();null!=b&&null!=b.realtime&&a.spinner.spin(document.body,mxResources.get("export"))&&(b=new mxXmlRequest("https://www.googleapis.com/drive/v2/files/"+
|
||||
b.getHash().substring(1)+"/realtime",null,"GET"),b.setRequestHeaders=function(a){mxXmlRequest.prototype.setRequestHeaders.apply(this,arguments);var b=gapi.auth.getToken().access_token;a.setRequestHeader("authorization","Bearer "+b)},b.send(function(b){a.spinner.stop();200<=b.getStatus()&&299>=b.getStatus()&&a.saveLocalFile(b.getText(),"realtime.txt","text/plain")}))})),null!=this.editorUi.getCurrentFile()&&null!=this.editorUi.getCurrentFile().realtime&&this.addMenuItems(b,["-","testShowRtModel","testDebugRtModel",
|
||||
"testDownloadRtModel"],d),mxResources.parse("testShowConsole=Show Console"),this.editorUi.actions.addAction("testShowConsole",function(){mxLog.isVisible()?mxLog.window.fit():mxLog.show();mxLog.window.div.style.zIndex=mxPopupMenu.prototype.zIndex-1}),this.addMenuItems(b,["-","testShowConsole"]))})));a.actions.addAction("shapes...",function(){mxClient.IS_CHROMEAPP||!a.isOffline()?a.showDialog((new MoreShapesDialog(a,!0)).container,640,isLocalStorage?mxClient.IS_IOS?480:460:440,!0,!0):a.showDialog((new MoreShapesDialog(a,
|
||||
!1)).container,360,isLocalStorage?mxClient.IS_IOS?300:280:260,!0,!0)});a.actions.addAction("createShape...",function(){a.getCurrentFile();if(c.isEnabled()){var b=new mxCell("",new mxGeometry(0,0,120,120),a.defaultCustomShapeStyle);b.vertex=!0;b=new EditShapeDialog(a,b,mxResources.get("editShape")+":",630,400);a.showDialog(b.container,640,480,!0,!1);b.init()}});a.actions.put("embedHtml",new Action(mxResources.get("html")+"...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),
|
||||
function(b){a.spinner.stop();a.showHtmlDialog(mxResources.get("create"),"https://desk.draw.io/support/solutions/articles/16000042542",b,function(b,c,d,e,f,g,h,k,p,m){a.createHtml(b,c,d,e,f,g,h,k,p,m,mxUtils.bind(this,function(b,c){var d=new EmbedDialog(a,b+"\n"+c,null,null,function(){var a=window.open(),d=a.document;"CSS1Compat"===document.compatMode&&d.writeln("<!DOCTYPE html>");d.writeln("<html>");d.writeln("<head><title>"+encodeURIComponent(mxResources.get("preview"))+'</title><meta charset="utf-8"></head>');
|
||||
d.writeln("<body>");d.writeln(b);var e=mxClient.IS_IE||mxClient.IS_EDGE||null!=document.documentMode;e&&d.writeln(c);d.writeln("</body>");d.writeln("</html>");d.close();if(!e){var f=a.document.createElement("div");f.marginLeft="26px";f.marginTop="26px";mxUtils.write(f,mxResources.get("updatingDocument"));e=a.document.createElement("img");e.setAttribute("src",window.location.protocol+"//"+window.location.hostname+"/"+IMAGE_PATH+"/spin.gif");e.style.marginLeft="6px";f.appendChild(e);a.document.body.insertBefore(f,
|
||||
a.document.body.firstChild);window.setTimeout(function(){var a=document.createElement("script");a.type="text/javascript";a.src=/<script.*?src="(.*?)"/.exec(c)[1];d.body.appendChild(a);f.parentNode.removeChild(f)},20)}});a.showDialog(d.container,440,240,!0,!0);d.init()}))})})}));a.actions.put("liveImage",new Action("Live image...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();null!=b?(b=encodeURIComponent(b),b=new EmbedDialog(a,
|
||||
EXPORT_URL+"?format=png&url="+b,0),a.showDialog(b.container,440,240,!0,!0),b.init()):a.handleError({message:mxResources.get("invalidPublicUrl")})})}));a.actions.put("embedImage",new Action(mxResources.get("image")+"...",function(){a.showEmbedImageDialog(function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.createEmbedImage(b,c,d,e,f,g,function(b){a.spinner.stop();b=new EmbedDialog(a,b);a.showDialog(b.container,440,240,!0,!0);b.init()},function(b){a.spinner.stop();a.handleError(b)})},
|
||||
mxResources.get("image"),mxResources.get("retina"),a.isExportToCanvas())}));a.actions.put("embedSvg",new Action(mxResources.get("formatSvg")+"...",function(){a.showEmbedImageDialog(function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.createEmbedSvg(b,c,d,e,f,g,function(b){a.spinner.stop();b=new EmbedDialog(a,b);a.showDialog(b.container,440,240,!0,!0);b.init()},function(b){a.spinner.stop();a.handleError(b)})},mxResources.get("formatSvg"),mxResources.get("image"),!0,"https://desk.draw.io/support/solutions/articles/16000042548")}));
|
||||
a.actions.put("embedIframe",new Action(mxResources.get("iframe")+"...",function(){var b=c.getGraphBounds();a.showPublishLinkDialog(mxResources.get("iframe"),null,"100%",Math.ceil((b.y+b.height-c.view.translate.y)/c.view.scale)+2,function(b,c,d,e,f,g,h,k){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(p){a.spinner.stop();p=new EmbedDialog(a,'<iframe frameborder="0" style="width:'+h+";height:"+k+';" src="'+a.createLink(b,c,d,e,f,g,p)+'"></iframe>');
|
||||
a.showDialog(p.container,440,240,!0,!0);p.init()})},!0)}));a.actions.put("publishLink",new Action(mxResources.get("link")+"...",function(){a.showPublishLinkDialog(null,null,null,null,function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(h){a.spinner.stop();h=new EmbedDialog(a,a.createLink(b,c,d,e,f,g,h));a.showDialog(h.container,440,240,!0,!0);h.init()})})}));a.actions.addAction("googleDocs...",function(){a.openLink("http://docsaddon.draw.io")});
|
||||
a.actions.addAction("googleSites...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();b=new GoogleSitesDialog(a,b);a.showDialog(b.container,420,256,!0,!0);b.init()})});if(isLocalStorage||mxClient.IS_CHROMEAPP)k=a.actions.addAction("scratchpad",function(){a.toggleScratchpad()}),k.setToggleAction(!0),k.setSelectedCallback(function(){return null!=a.scratchpad}),a.actions.addAction("plugins...",function(){a.showDialog((new PluginsDialog(a)).container,
|
||||
360,170,!0,!1)});k=a.actions.addAction("search",function(){var b=a.sidebar.isEntryVisible("search");a.sidebar.showPalette("search",!b);isLocalStorage&&(mxSettings.settings.search=!b,mxSettings.save())});k.setToggleAction(!0);k.setSelectedCallback(function(){return a.sidebar.isEntryVisible("search")});"1"==urlParams.embed&&(a.actions.get("save").funct=function(b){c.isEditing()&&c.stopEditing();var d="0"!=urlParams.pages||null!=a.pages&&1<a.pages.length?a.getFileData(!0):mxUtils.getXml(a.editor.getGraphXml());
|
||||
if("json"==urlParams.proto){var e=a.createLoadMessage("save");e.xml=d;b&&(e.exit=!0);d=JSON.stringify(e)}(window.opener||window.parent).postMessage(d,"*");"0"!=urlParams.modified&&"1"!=urlParams.keepmodified&&(a.editor.modified=!1,a.editor.setStatus(""));null!=a.getCurrentFile()&&a.saveFile()},a.actions.addAction("saveAndExit",function(){a.actions.get("save").funct(!0)}),a.actions.addAction("exit",function(){var b=function(){a.editor.modified=!1;var b="json"==urlParams.proto?JSON.stringify({event:"exit",
|
||||
modified:a.editor.modified}):"";(window.opener||window.parent).postMessage(b,"*")};a.editor.modified?a.confirm(mxResources.get("allChangesLost"),null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b()}));this.put("exportAs",new Menu(mxUtils.bind(this,function(b,c){a.isExportToCanvas()?(this.addMenuItems(b,["exportPng"],c),a.jpgSupported&&this.addMenuItems(b,["exportJpg"],c)):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["exportPng","exportJpg"],c);this.addMenuItems(b,
|
||||
["exportSvg","-"],c);a.isOffline()||a.printPdfExport?this.addMenuItems(b,["exportPdf"],c):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["exportPdf"],c);mxClient.IS_IE11||mxClient.IS_IE||"undefined"===typeof VsdxExport&&a.isOffline()||this.addMenuItems(b,["exportVsdx"],c);this.addMenuItems(b,["-","exportHtml","exportXml","exportUrl"],c);a.isOffline()||(b.addSeparator(c),this.addMenuItem(b,"export",c).firstChild.nextSibling.innerHTML=mxResources.get("advanced")+"...")})));
|
||||
this.editorUi.actions.addAction("chatWindowTitle...",mxUtils.bind(this.editorUi,this.editorUi.toggleChat));this.put("importFrom",new Menu(function(b,d){function e(b){b.pickFile(function(c){a.spinner.spin(document.body,mxResources.get("loading"))&&b.getFile(c,function(b){var c=k(b.getTitle());/\.svg$/i.test(b.getTitle())&&!a.editor.isDataSvg(b.getData())&&(b.setData(a.createSvgDataUri(b.getData())),c="image/svg+xml");g(b.getData(),c,b.getTitle())},function(b){a.handleError(b,null!=b?mxResources.get("errorLoadingFile"):
|
||||
null)},b==a.drive)},!0)}var g=mxUtils.bind(this,function(b,d,e){var f=c.view,g=c.getGraphBounds(),h=c.snap(Math.ceil(Math.max(0,g.x/f.scale-f.translate.x)+4*c.gridSize)),k=c.snap(Math.ceil(Math.max(0,(g.y+g.height)/f.scale-f.translate.y)+4*c.gridSize));"data:image/"==b.substring(0,11)?a.loadImage(b,mxUtils.bind(this,function(f){var g=!0,m=mxUtils.bind(this,function(){a.resizeImage(f,b,mxUtils.bind(this,function(f,m,l){f=g?Math.min(1,Math.min(a.maxImageSize/m,a.maxImageSize/l)):1;a.importFile(b,d,
|
||||
h,k,Math.round(m*f),Math.round(l*f),e,function(b){a.spinner.stop();c.setSelectionCells(b);c.scrollCellToVisible(c.getSelectionCell())})}),g)});b.length>a.resampleThreshold?a.confirmImageResize(function(a){g=a;m()}):m()}),mxUtils.bind(this,function(){a.handleError({message:mxResources.get("cannotOpenFile")})})):a.importFile(b,d,h,k,0,0,e,function(b){a.spinner.stop();c.setSelectionCells(b);c.scrollCellToVisible(c.getSelectionCell())})}),k=mxUtils.bind(this,function(a){var b="text/xml";/\.png$/i.test(a)?
|
||||
b="image/png":/\.jpe?g$/i.test(a)?b="image/jpg":/\.gif$/i.test(a)&&(b="image/gif");return b});"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?b.addItem(mxResources.get("googleDrive")+"...",null,function(){e(a.drive)},d):h&&b.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1));null!=a.gitHub&&b.addItem(mxResources.get("github")+"...",null,function(){e(a.gitHub)},d);null!=a.dropbox?b.addItem(mxResources.get("dropbox")+
|
||||
"...",null,function(){e(a.dropbox)},d):m&&b.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.oneDrive?b.addItem(mxResources.get("oneDrive")+"...",null,function(){e(a.oneDrive)},d):l&&b.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){e(a.trello)},d):f&&b.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+
|
||||
"...)",null,function(){},d,null,!1);b.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&b.addItem(mxResources.get("browser")+"...",null,function(){a.importLocalFile(!1)},d);mxClient.IS_IOS||b.addItem(mxResources.get("device")+"...",null,function(){a.importLocalFile(!0)},d);a.isOffline()||(b.addSeparator(d),b.addItem(mxResources.get("url")+"...",null,function(){var b=new FilenameDialog(a,"",mxResources.get("import"),function(b){if(null!=b&&0<b.length&&a.spinner.spin(document.body,mxResources.get("loading"))){var c=
|
||||
/(\.png)($|\?)/i.test(b)?"image/png":"text/xml";a.loadUrl(PROXY_URL+"?url="+encodeURIComponent(b),function(a){g(a,c,b)},function(){a.spinner.stop();a.handleError(null,mxResources.get("errorLoadingFile"))},"image/png"==c)}},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},d))})).isEnabled=g;this.put("theme",new Menu(mxUtils.bind(this,function(b,c){var d=b.addItem(mxResources.get("kennedy"),null,function(){mxSettings.setUi("");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},
|
||||
c);"atlas"!=uiTheme&&"dark"!=uiTheme&&"min"!=uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);d=b.addItem(mxResources.get("minimal"),null,function(){mxSettings.setUi("min");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"min"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);d=b.addItem(mxResources.get("atlas"),null,function(){mxSettings.setUi("atlas");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"atlas"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);
|
||||
d=b.addItem(mxResources.get("dark"),null,function(){mxSettings.setUi("dark");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"dark"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage)})));k=this.editorUi.actions.addAction("rename...",mxUtils.bind(this,function(){var b=this.editorUi.getCurrentFile();if(null!=b){var c=null!=b.getTitle()?b.getTitle():this.editorUi.defaultFilename,c=new FilenameDialog(this.editorUi,c,mxResources.get("rename"),mxUtils.bind(this,function(a){null!=
|
||||
a&&0<a.length&&null!=b&&this.editorUi.spinner.spin(document.body,mxResources.get("renaming"))&&b.rename(a,mxUtils.bind(this,function(a){this.editorUi.spinner.stop()}),mxUtils.bind(this,function(a){this.editorUi.handleError(a,null!=a?mxResources.get("errorRenamingFile"):null)}))}),b.constructor==DriveFile||b.constructor==StorageFile?mxResources.get("diagramName"):null,function(b){if(null!=b&&0<b.length)return!0;a.showError(mxResources.get("error"),mxResources.get("invalidName"),mxResources.get("ok"));
|
||||
return!1});this.editorUi.showDialog(c.container,300,80,!0,!0);c.init()}}));k.isEnabled=function(){return this.enabled&&g.apply(this,arguments)};k.visible="1"!=urlParams.embed;a.actions.addAction("makeCopy...",mxUtils.bind(this,function(){var b=a.getCurrentFile();if(null!=b){var c=null!=b.getTitle()?b.getTitle():a.defaultFilename,d="",e=c.lastIndexOf(".");0<=e&&(d=c.substring(e),c=c.substring(0,e));c=mxResources.get("copyOf",[c])+d;b.constructor==DriveFile?(c=new CreateDialog(a,c,mxUtils.bind(this,
|
||||
function(c,d){"download"==d&&(d=App.MODE_GOOGLE);null!=c&&0<c.length&&(d==App.MODE_GOOGLE?a.spinner.spin(document.body,mxResources.get("saving"))&&b.save(!1,mxUtils.bind(this,function(){b.saveAs(c,mxUtils.bind(this,function(b){a.spinner.stop();var c=a.getUrl();window.openWindow(c+"#G"+b.id,null,mxUtils.bind(this,function(){window.location.hash="G"+b.id}))}),mxUtils.bind(this,function(b){a.handleError(b)}))}),mxUtils.bind(this,function(b){a.handleError(b)})):this.editorUi.createFile(c,this.editorUi.getFileData(!0),
|
||||
null,d))}),mxUtils.bind(this,function(){a.hideDialog()}),mxResources.get("makeCopy"),mxResources.get("create"),null,null,null,null,!0),a.showDialog(c.container,420,380,!0,!0),c.init()):a.editor.editAsNew(this.editorUi.getFileData(!0),c)}}));a.actions.addAction("moveToFolder...",mxUtils.bind(this,function(){var b=a.getCurrentFile();b.getMode()!=App.MODE_GOOGLE&&b.getMode()!=App.MODE_ONEDRIVE||a.pickFolder(b.getMode(),mxUtils.bind(this,function(c){a.spinner.spin(document.body,mxResources.get("moving"))&&
|
||||
b.move(c,mxUtils.bind(this,function(b){a.spinner.stop()}),mxUtils.bind(this,function(b){a.handleError(b)}))}))}));this.put("publish",new Menu(mxUtils.bind(this,function(a,b){this.addMenuItems(a,["publishLink"],b)})));a.actions.put("offline",new Action(mxResources.get("offline")+"...",function(){a.openLink("https://app.draw.io/")}));a.actions.put("download",new Action(mxResources.get("download")+"...",function(){a.openLink("https://get.draw.io/")}));this.editorUi.actions.addAction("share...",mxUtils.bind(this,
|
||||
function(){var a=this.editorUi.getCurrentFile();null!=a&&this.editorUi.drive.showPermissions(a.getId())}));this.put("embed",new Menu(mxUtils.bind(this,function(b,c){"1"==urlParams.test&&this.addMenuItems(b,["liveImage","-"],c);this.addMenuItems(b,["embedImage","embedSvg","-","embedHtml"],c);navigator.standalone||a.isOffline()||this.addMenuItems(b,["embedIframe"],c);a.isOffline()||this.addMenuItems(b,["-","googleSites","googleDocs"],c)})));var v=function(b,c,d,e){("plantUml"!=e||EditorUi.enablePlantUml&&
|
||||
!a.isOffline())&&b.addItem(d,null,mxUtils.bind(this,function(){if("fromText"==e||"formatSql"==e||"plantUml"==e){var b=new ParseDialog(a,d,e);a.showDialog(b.container,620,420,!0,!1);a.dialog.container.style.overflow="auto"}else b=new CreateGraphDialog(a,d,e),a.showDialog(b.container,620,420,!0,!1);b.init()}),c)},x=function(a,b,d,e){var f=c.isMouseInsertPoint()?c.getInsertPoint():c.getFreeInsertPoint();a=new mxCell(a,new mxGeometry(f.x,f.y,b,d),e);a.vertex=!0;c.getModel().beginUpdate();try{a=c.addCell(a),
|
||||
c.fireEvent(new mxEventObject("cellsInserted","cells",[a]))}finally{c.getModel().endUpdate()}c.scrollCellToVisible(a);c.setSelectionCell(a);c.container.focus();c.editAfterInsert&&c.startEditing(a);return a};a.actions.addAction("insertText",function(){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&c.startEditingAtCell(x("Text",40,20,"text;html=1;resizable=0;autosize=1;align=center;verticalAlign=middle;points=[];fillColor=none;strokeColor=none;rounded=0;"))},null,null,Editor.ctrlKey+"+Shift+X").isEnabled=
|
||||
g;a.actions.addAction("insertRectangle",function(){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&x("",120,60,"whiteSpace=wrap;html=1;")},null,null,Editor.ctrlKey+"+K").isEnabled=g;a.actions.addAction("insertEllipse",function(){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&x("",80,80,"ellipse;whiteSpace=wrap;html=1;")},null,null,Editor.ctrlKey+"+Shift+K").isEnabled=g;a.actions.addAction("insertRhombus",function(){c.isEnabled()&&!c.isCellLocked(c.getDefaultParent())&&x("",80,80,"rhombus;whiteSpace=wrap;html=1;")}).isEnabled=
|
||||
g;var C=mxUtils.bind(this,function(a,b,c){for(var d=0;d<c.length;d++)"-"==c[d]?a.addSeparator(b):v(a,b,mxResources.get(c[d])+"...",c[d])});this.put("insert",new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,"insertText insertRectangle - insertEllipse insertRhombus - insertLink insertImage".split(" "),c);b.addSeparator(c);this.addSubmenu("insertLayout",b,c,mxResources.get("layout"));b.addSeparator(c);C(b,c,["fromText","plantUml","-","formatSql"]);b.addItem(mxResources.get("csv")+"...",null,
|
||||
function(){a.showImportCsvDialog()},c)})));this.put("insertLayout",new Menu(mxUtils.bind(this,function(a,b){C(a,b,"horizontalFlow verticalFlow - horizontalTree verticalTree radialTree - organic circle".split(" "))})));this.put("openRecent",new Menu(function(b,c){var d=a.getRecent();if(null!=d){for(var e=0;e<d.length;e++)(function(d){var e=d.mode;e==App.MODE_GOOGLE?e="googleDrive":e==App.MODE_ONEDRIVE&&(e="oneDrive");b.addItem(d.title+" ("+mxResources.get(e)+")",null,function(){a.loadFile(d.id)},c)})(d[e]);
|
||||
b.addSeparator(c)}b.addItem(mxResources.get("reset"),null,function(){a.resetRecent()},c)}));this.put("openFrom",new Menu(function(b,c){null!=a.drive?b.addItem(mxResources.get("googleDrive")+"...",null,function(){a.pickFile(App.MODE_GOOGLE)},c):h&&b.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.gitHub&&b.addItem(mxResources.get("github")+"...",null,function(){a.pickFile(App.MODE_GITHUB)},c);null!=a.dropbox?b.addItem(mxResources.get("dropbox")+
|
||||
"...",null,function(){a.pickFile(App.MODE_DROPBOX)},c):m&&b.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.oneDrive?b.addItem(mxResources.get("oneDrive")+"...",null,function(){a.pickFile(App.MODE_ONEDRIVE)},c):l&&b.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){a.pickFile(App.MODE_TRELLO)},c):f&&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.pickFile(App.MODE_BROWSER)},c);mxClient.IS_IOS||b.addItem(mxResources.get("device")+"...",null,function(){a.pickFile(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){null!=b&&0<b.length&&
|
||||
(null==a.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(b):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(b)))},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},c))}));Editor.enableCustomLibraries&&(this.put("newLibrary",new Menu(function(b,c){"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?b.addItem(mxResources.get("googleDrive")+"...",
|
||||
null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_GOOGLE)},c):h&&b.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1));null!=a.gitHub&&b.addItem(mxResources.get("github")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_GITHUB)},c);null!=a.dropbox?b.addItem(mxResources.get("dropbox")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_DROPBOX)},c):m&&b.addItem(mxResources.get("dropbox")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.oneDrive?b.addItem(mxResources.get("oneDrive")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_ONEDRIVE)},c):l&&b.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_TRELLO)},c):f&&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.showLibraryDialog(null,null,null,null,App.MODE_BROWSER)},c);mxClient.IS_IOS||b.addItem(mxResources.get("device")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_DEVICE)},c)})),this.put("openLibraryFrom",new Menu(function(b,c){"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?b.addItem(mxResources.get("googleDrive")+
|
||||
"...",null,function(){a.pickLibrary(App.MODE_GOOGLE)},c):h&&b.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1));null!=a.gitHub&&b.addItem(mxResources.get("github")+"...",null,function(){a.pickLibrary(App.MODE_GITHUB)},c);null!=a.dropbox?b.addItem(mxResources.get("dropbox")+"...",null,function(){a.pickLibrary(App.MODE_DROPBOX)},c):m&&b.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=
|
||||
a.oneDrive?b.addItem(mxResources.get("oneDrive")+"...",null,function(){a.pickLibrary(App.MODE_ONEDRIVE)},c):l&&b.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},c,null,!1);null!=a.trello?b.addItem(mxResources.get("trello")+"...",null,function(){a.pickLibrary(App.MODE_TRELLO)},c):f&&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);mxClient.IS_IOS||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.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(y){a.handleError(y,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))})));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 - edit - editLink openLink - selectVertices selectEdges selectAll selectNone - lockUnlock".split(" "))})));
|
||||
this.put("view",new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,(null!=this.editorUi.format?["formatPanel"]:[]).concat(["outline","layers","-"]));this.addMenuItems(b,["-","search"],c);if(isLocalStorage||mxClient.IS_CHROMEAPP){var d=this.addMenuItem(b,"scratchpad",c);a.isOffline()&&!mxClient.IS_CHROMEAPP||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);this.addLinkToItem(d,
|
||||
"https://desk.draw.io/support/solutions/articles/16000032875")}"1"!=urlParams.embed&&this.addMenuItems(b,["autosave"],c);this.addMenuItems(b,["-","createShape","editDiagram"],c);b.addSeparator(c);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&this.addMenuItems(b,["showStartScreen"],c);!a.isOfflineApp()&&"1"!=urlParams.embed&&isLocalStorage&&(d=this.addMenuItem(b,"plugins",c),a.isOffline()||this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000056430"));b.addSeparator(c);
|
||||
d=this.addMenuItem(b,"tags",c);a.isOffline()&&!mxClient.IS_CHROMEAPP||this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000046966")})));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)),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();null!=d&&d.constructor==DriveFile?(d.isRestricted()&&this.addMenuItems(b,["exportOptionsDisabled"],c),null==d.realtime?this.addMenuItems(b,["save","share","-"],c):(d.isAutosave()||this.addMenuItems(b,["save"],c),this.addMenuItems(b,["share","chatWindowTitle","-"],c))):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):(this.addMenuItems(b,["-","save","saveAs","-","rename"],c),a.isOfflineApp()?a.isOffline()||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);null==d||d.constructor!=DriveFile&&d.constructor!=DropboxFile||this.addMenuItems(b,["-","revisionHistory"],c);null!=d&&d.constructor==DriveFile&&this.addMenuItems(b,["createRevision"],c);this.addMenuItems(b,["-","pageSetup"],c);mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["print"],c);this.addMenuItems(b,["-","close"])}})))};var c=Menus.prototype.menuCreated;Menus.prototype.menuCreated=function(a,
|
||||
b){if(480>=screen.width&&a==this.get("help")){b.style.paddingRight="0px";b.style.paddingLeft="0px";b.innerHTML="";var d=document.createElement("img");d.setAttribute("border","0");d.setAttribute("valign","bottom");d.setAttribute("src",Editor.helpImage);b.appendChild(d)}c.apply(this,arguments)}})();function DiagramPage(a){this.node=a;(null==this.node.hasAttribute&&null==this.node.getAttribute("id")||null!=this.node.hasAttribute&&!this.node.hasAttribute("id"))&&this.node.setAttribute("id",function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}())}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,b,c){this.ui=a;this.page=b;this.previous=this.name=c}RenamePage.prototype.execute=function(){var a=this.page.getName();this.page.setName(this.previous);this.previous=a;this.ui.editor.graph.updatePlaceholders();this.ui.editor.fireEvent(new mxEventObject("pageRenamed"))};
|
||||
function MovePage(a,b,c){this.ui=a;this.oldIndex=b;this.newIndex=c}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,b){this.ui=a;this.previousPage=this.page=b;this.neverShown=!0;null!=b&&(this.neverShown=null==b.viewState,this.ui.updatePageRoot(b))}
|
||||
|
@ -8225,12 +8226,12 @@ EditorUi.prototype.setGraphEnabled;EditorUi.prototype.setGraphEnabled=function(a
|
|||
mxResources.get("text");c.actions.get("editDiagram").label=mxResources.get("formatXml")+"...";c.actions.get("insertRectangle").label=mxResources.get("rectangle");c.actions.get("insertEllipse").label=mxResources.get("ellipse");c.actions.get("insertRhombus").label=mxResources.get("rhombus");c.actions.get("insertImage").label=mxResources.get("image")+"...";c.actions.get("insertLink").label=mxResources.get("link")+"...";c.actions.get("createShape").label=mxResources.get("shape")+"...";c.actions.get("outline").label=
|
||||
mxResources.get("outline")+"...";c.actions.get("layers").label=mxResources.get("layers")+"...";c.actions.put("importFile",new Action("File...",function(){d.popupMenuHandler.hideMenu();var a=document.createElement("input");a.setAttribute("type","file");mxEvent.addListener(a,"change",function(){null!=a.files&&c.importFiles(a.files,null,null,c.maxImageSize)});a.click()}));c.actions.put("importCsv",new Action(mxResources.get("csv")+"...",function(){d.popupMenuHandler.hideMenu();c.showImportCsvDialog()}));
|
||||
c.actions.put("importText",new Action(mxResources.get("text")+"...",function(){var a=new ParseDialog(c,"Insert from Text");c.showDialog(a.container,620,420,!0,!1);a.init()}));c.actions.put("formatSql",new Action(mxResources.get("formatSql")+"...",function(){var a=new ParseDialog(c,"Insert from Text","formatSql");c.showDialog(a.container,620,420,!0,!1);a.init()}));c.actions.put("toggleShapes",new Action(mxResources.get("shapes")+"...",function(){b(c)}));c.actions.put("toggleFormat",new Action(mxResources.get("format")+
|
||||
"...",function(){a(c)}));EditorUi.enablePlantUml&&c.actions.put("plantUml",new Action(mxResources.get("plantUml")+"...",function(){var a=new ParseDialog(c,"Insert from Text","plantUml");c.showDialog(a.container,620,420,!0,!1);a.init()}));this.put("diagram",new Menu(mxUtils.bind(this,function(a,b){c.menus.addSubmenu("extras",a,b,mxResources.get("preferences"));a.addSeparator(b);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?c.menus.addMenuItems(a,"new open - save saveAs -".split(" "),b):"1"==urlParams.embed?
|
||||
(c.menus.addMenuItems(a,["-","save"],b),"1"==urlParams.saveAndExit&&c.menus.addMenuItems(a,["saveAndExit"],b),a.addSeparator(b)):(c.menus.addMenuItems(a,["new"],b),c.menus.addSubmenu("openFrom",a,b),a.addSeparator(b),c.menus.addSubmenu("save",a,b));c.menus.addSubmenu("exportAs",a,b);var d=c.getCurrentFile();null!=d&&d.constructor==DriveFile&&(c.menus.addMenuItems(a,["-","share"],b),null!=d.realtime&&c.menus.addMenuItems(a,["chatWindowTitle"],b),a.addSeparator(b));c.menus.addMenuItems(a,["-","outline",
|
||||
"layers","-","find"],b);d=this.addMenuItem(a,"tags",b);c.isOffline()&&!mxClient.IS_CHROMEAPP||c.menus.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000046966");a.addSeparator(b);mxClient.IS_IOS&&navigator.standalone||c.menus.addMenuItems(a,["-","print","-"],b);c.menus.addSubmenu("help",a,b);"1"==urlParams.embed?c.menus.addMenuItems(a,["-","exit"],b):c.menus.addMenuItems(a,["-","close"])})));if(isLocalStorage){var e=this.get("openFrom"),f=e.funct;e.funct=function(a,b){f.apply(this,
|
||||
arguments);a.addSeparator(b);c.menus.addSubmenu("openRecent",a,b)}}this.put("save",new Menu(mxUtils.bind(this,function(a,b){var d=c.getCurrentFile();null!=d&&d.constructor==DriveFile?c.menus.addMenuItems(a,["createRevision","makeCopy","-","rename","moveToFolder"],b):c.menus.addMenuItems(a,["save","saveAs","-","rename","makeCopy"],b);null==d||d.constructor!=DriveFile&&d.constructor!=DropboxFile||c.menus.addMenuItems(a,["-","revisionHistory"],b);c.menus.addMenuItems(a,["-","autosave"],b)})));var g=
|
||||
this.get("exportAs");this.put("exportAs",new Menu(mxUtils.bind(this,function(a,b){g.funct(a,b);a.addSeparator(b);c.menus.addSubmenu("embed",a,b);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||c.menus.addMenuItems(a,["publishLink"],b)})));var h=this.get("language");this.put("extras",new Menu(mxUtils.bind(this,function(a,b){"1"!=urlParams.embed&&c.menus.addSubmenu("theme",a,b);null!=h&&c.menus.addSubmenu("language",a,b);a.addSeparator(b);c.menus.addMenuItems(a,["scrollbars","tooltips","pageScale"],
|
||||
b);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&c.menus.addMenuItems(a,["-","search","scratchpad","-","showStartScreen"],b);if(!c.isOfflineApp()&&"1"!=urlParams.embed&&isLocalStorage){a.addSeparator(b);var d=c.menus.addMenuItem(a,"plugins",b);c.isOffline()||c.menus.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000056430")}})));this.put("insertAdvanced",new Menu(mxUtils.bind(this,function(a,b){c.menus.addMenuItems(a,"importText createShape plantUml - importCsv formatSql editDiagram".split(" "),
|
||||
"...",function(){a(c)}));EditorUi.enablePlantUml&&!c.isOffline()&&c.actions.put("plantUml",new Action(mxResources.get("plantUml")+"...",function(){var a=new ParseDialog(c,"Insert from Text","plantUml");c.showDialog(a.container,620,420,!0,!1);a.init()}));this.put("diagram",new Menu(mxUtils.bind(this,function(a,b){c.menus.addSubmenu("extras",a,b,mxResources.get("preferences"));a.addSeparator(b);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?c.menus.addMenuItems(a,"new open - save saveAs -".split(" "),
|
||||
b):"1"==urlParams.embed?(c.menus.addMenuItems(a,["-","save"],b),"1"==urlParams.saveAndExit&&c.menus.addMenuItems(a,["saveAndExit"],b),a.addSeparator(b)):(c.menus.addMenuItems(a,["new"],b),c.menus.addSubmenu("openFrom",a,b),a.addSeparator(b),c.menus.addSubmenu("save",a,b));c.menus.addSubmenu("exportAs",a,b);var d=c.getCurrentFile();null!=d&&d.constructor==DriveFile&&(c.menus.addMenuItems(a,["-","share"],b),null!=d.realtime&&c.menus.addMenuItems(a,["chatWindowTitle"],b),a.addSeparator(b));c.menus.addMenuItems(a,
|
||||
["-","outline","layers","-","find"],b);d=this.addMenuItem(a,"tags",b);c.isOffline()&&!mxClient.IS_CHROMEAPP||c.menus.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000046966");a.addSeparator(b);mxClient.IS_IOS&&navigator.standalone||c.menus.addMenuItems(a,["-","print","-"],b);c.menus.addSubmenu("help",a,b);"1"==urlParams.embed?c.menus.addMenuItems(a,["-","exit"],b):c.menus.addMenuItems(a,["-","close"])})));if(isLocalStorage){var e=this.get("openFrom"),f=e.funct;e.funct=function(a,
|
||||
b){f.apply(this,arguments);a.addSeparator(b);c.menus.addSubmenu("openRecent",a,b)}}this.put("save",new Menu(mxUtils.bind(this,function(a,b){var d=c.getCurrentFile();null!=d&&d.constructor==DriveFile?c.menus.addMenuItems(a,["createRevision","makeCopy","-","rename","moveToFolder"],b):c.menus.addMenuItems(a,["save","saveAs","-","rename","makeCopy"],b);null==d||d.constructor!=DriveFile&&d.constructor!=DropboxFile||c.menus.addMenuItems(a,["-","revisionHistory"],b);c.menus.addMenuItems(a,["-","autosave"],
|
||||
b)})));var g=this.get("exportAs");this.put("exportAs",new Menu(mxUtils.bind(this,function(a,b){g.funct(a,b);a.addSeparator(b);c.menus.addSubmenu("embed",a,b);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||c.menus.addMenuItems(a,["publishLink"],b)})));var h=this.get("language");this.put("extras",new Menu(mxUtils.bind(this,function(a,b){"1"!=urlParams.embed&&c.menus.addSubmenu("theme",a,b);null!=h&&c.menus.addSubmenu("language",a,b);a.addSeparator(b);c.menus.addMenuItems(a,["scrollbars","tooltips",
|
||||
"pageScale"],b);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&c.menus.addMenuItems(a,["-","search","scratchpad","-","showStartScreen"],b);if(!c.isOfflineApp()&&"1"!=urlParams.embed&&isLocalStorage){a.addSeparator(b);var d=c.menus.addMenuItem(a,"plugins",b);c.isOffline()||c.menus.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000056430")}})));this.put("insertAdvanced",new Menu(mxUtils.bind(this,function(a,b){c.menus.addMenuItems(a,"importText plantUml - formatSql importCsv - createShape editDiagram".split(" "),
|
||||
b)})));mxResources.parse("insertLayout="+mxResources.get("layout"));mxResources.parse("insertAdvanced="+mxResources.get("advanced"));this.put("insert",new Menu(mxUtils.bind(this,function(a,b){c.menus.addMenuItems(a,"insertRectangle insertEllipse insertRhombus - insertText insertLink - insertImage".split(" "),b);c.menus.addSubmenu("importFrom",a,b);a.addSeparator(b);c.menus.addSubmenu("insertLayout",a,b);c.menus.addSubmenu("insertAdvanced",a,b)})));var k="horizontalFlow verticalFlow - horizontalTree verticalTree radialTree - organic circle".split(" "),
|
||||
l=function(a,b,d,e){a.addItem(d,null,mxUtils.bind(this,function(){var a=new CreateGraphDialog(c,d,e);c.showDialog(a.container,620,420,!0,!1);a.init()}),b)};this.put("insertLayout",new Menu(mxUtils.bind(this,function(a,b){for(var c=0;c<k.length;c++)"-"==k[c]?a.addSeparator(b):l(a,b,mxResources.get(k[c])+"...",k[c])})));this.put("view",new Menu(mxUtils.bind(this,function(a,b){c.menus.addMenuItems(a,"grid guides - connectionArrows connectionPoints - copyConnect collapseExpand - mathematicalTypesetting".split(" "),
|
||||
b)})))};var q=EditorUi.prototype.init;EditorUi.prototype.init=function(){function a(a,b,c,d){var e=f.menus.get(a),g=k.addMenu(mxResources.get(a),mxUtils.bind(this,function(){e.funct.apply(this,arguments)}));g.className="geMenuItem";g.style.display="inline-block";g.style.boxSizing="border-box";g.style.top="6px";g.style.marginRight="6px";g.style.height="30px";g.style.paddingTop="6px";g.style.paddingBottom="6px";g.setAttribute("title",mxResources.get(a));f.menus.menuCreated(e,g,"geMenuItem");null!=c?
|
||||
|
|
1041
src/main/webapp/js/atlas-viewer.min.js
vendored
1041
src/main/webapp/js/atlas-viewer.min.js
vendored
File diff suppressed because one or more lines are too long
497
src/main/webapp/js/atlas.min.js
vendored
497
src/main/webapp/js/atlas.min.js
vendored
|
@ -103,7 +103,7 @@ window.mxLanguageMap=window.mxLanguageMap||{i18n:"",id:"Bahasa Indonesia",ms:"Ba
|
|||
ko:"한국어",ja:"日本語",zh:"中文(中国)","zh-tw":"中文(台灣)"};"undefined"===typeof window.mxBasePath&&(window.mxBasePath="mxgraph");if(null==window.mxLanguages){window.mxLanguages=[];for(var lang in mxLanguageMap)"en"!=lang&&window.mxLanguages.push(lang)}window.uiTheme=window.uiTheme||function(){var a=urlParams.ui;if(null==a&&"undefined"!==typeof JSON&&isLocalStorage)try{var b=localStorage.getItem(".drawio-config");null!=b&&(a=JSON.parse(b).ui||null)}catch(c){isLocalStorage=!1}return a}();
|
||||
function setCurrentXml(a,b){null!=window.parent&&null!=window.parent.openFile&&window.parent.openFile.setData(a,b)}
|
||||
(function(){if("undefined"!==typeof JSON&&isLocalStorage)try{var a=localStorage.getItem(".drawio-config"),b=!0;null!=a&&(b=JSON.parse(a).showStartScreen);0==b&&(urlParams.splash="0")}catch(c){}a=urlParams["export"];null!=a&&("http://"!=a.substring(0,7)&&"https://"!=a.substring(0,8)&&(a="http://"+a),EXPORT_URL=a);window.DRAWIO_LOG_URL=window.DRAWIO_LOG_URL||"";b=window.location.host;"test.draw.io"!=b&&(a=b.length-7,b=b.lastIndexOf("draw.io",a),-1!==b&&b===a&&(window.DRAWIO_LOG_URL="https://log.draw.io"))})();
|
||||
if("1"==urlParams.offline||"1"==urlParams.demo||"1"==urlParams.stealth||"1"==urlParams.local)urlParams.analytics="0",urlParams.picker="0",urlParams.gapi="0",urlParams.db="0",urlParams.od="0",urlParams.gh="0",urlParams.tr="0";if("1"==urlParams.offline||"1"==urlParams.local)urlParams.math="0";"1"==urlParams.lightbox&&(urlParams.chrome="0");window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
|
||||
if("1"==urlParams.offline||"1"==urlParams.demo||"1"==urlParams.stealth||"1"==urlParams.local)urlParams.picker="0",urlParams.gapi="0",urlParams.db="0",urlParams.od="0",urlParams.gh="0",urlParams.tr="0";if("1"==urlParams.offline||"1"==urlParams.local)urlParams.math="0";"1"==urlParams.lightbox&&(urlParams.chrome="0");window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"3.9.7",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&
|
||||
0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&&
|
||||
|
@ -2067,8 +2067,8 @@ this.getCssClassForMarker("end",b.currentEdgeStyle.shape,b.currentEdgeStyle[mxCo
|
|||
this.toolbar.setFontSize(c)}),b.getSelectionModel().addListener(mxEvent.CHANGE,a),b.getModel().addListener(mxEvent.CHANGE,a));b.addListener(mxEvent.CELLS_ADDED,function(a,c){var d=c.getProperty("cells"),e=c.getProperty("parent");b.getModel().isLayer(e)&&!b.isCellVisible(e)&&null!=d&&0<d.length&&b.getModel().setVisible(e,!0)});this.gestureHandler=mxUtils.bind(this,function(a){null!=this.currentMenu&&mxEvent.getSource(a)!=this.currentMenu.div&&this.hideCurrentMenu()});mxEvent.addGestureListeners(document,
|
||||
this.gestureHandler);this.resizeHandler=mxUtils.bind(this,function(){window.setTimeout(mxUtils.bind(this,function(){null!=this.editor.graph&&this.refresh()}),0)});mxEvent.addListener(window,"resize",this.resizeHandler);this.orientationChangeHandler=mxUtils.bind(this,function(){this.refresh()});mxEvent.addListener(window,"orientationchange",this.orientationChangeHandler);mxClient.IS_IOS&&!window.navigator.standalone&&(this.scrollHandler=mxUtils.bind(this,function(){window.scrollTo(0,0)}),mxEvent.addListener(window,
|
||||
"scroll",this.scrollHandler));this.editor.addListener("resetGraphView",mxUtils.bind(this,function(){this.resetScrollbars()}));this.addListener("gridEnabledChanged",mxUtils.bind(this,function(){b.view.validateBackground()}));this.addListener("backgroundColorChanged",mxUtils.bind(this,function(){b.view.validateBackground()}));b.addListener("gridSizeChanged",mxUtils.bind(this,function(){b.isGridEnabled()&&b.view.validateBackground()}));this.editor.resetGraph();this.init();this.open()};
|
||||
mxUtils.extend(EditorUi,mxEventSource);EditorUi.compactUi=!0;EditorUi.prototype.splitSize=mxClient.IS_TOUCH||mxClient.IS_POINTER?12:8;EditorUi.prototype.menubarHeight=30;EditorUi.prototype.formatEnabled=!0;EditorUi.prototype.formatWidth=240;EditorUi.prototype.toolbarHeight=34;EditorUi.prototype.footerHeight=28;EditorUi.prototype.sidebarFooterHeight=34;EditorUi.prototype.editButtonLink=null;EditorUi.prototype.hsplitPosition=640>=screen.width?118:208;EditorUi.prototype.allowAnimation=!0;
|
||||
EditorUi.prototype.lightboxMaxFitScale=2;EditorUi.prototype.lightboxVerticalDivider=4;
|
||||
mxUtils.extend(EditorUi,mxEventSource);EditorUi.compactUi=!0;EditorUi.prototype.splitSize=mxClient.IS_TOUCH||mxClient.IS_POINTER?12:8;EditorUi.prototype.menubarHeight=30;EditorUi.prototype.formatEnabled=!0;EditorUi.prototype.formatWidth=240;EditorUi.prototype.toolbarHeight=34;EditorUi.prototype.footerHeight=28;EditorUi.prototype.sidebarFooterHeight=34;EditorUi.prototype.hsplitPosition=640>=screen.width?118:208;EditorUi.prototype.allowAnimation=!0;EditorUi.prototype.lightboxMaxFitScale=2;
|
||||
EditorUi.prototype.lightboxVerticalDivider=4;EditorUi.prototype.hsplitClickEnabled=!1;
|
||||
EditorUi.prototype.init=function(){var a=this.editor.graph;mxEvent.addListener(a.container,"keydown",mxUtils.bind(this,function(a){this.onKeyDown(a)}));mxEvent.addListener(a.container,"keypress",mxUtils.bind(this,function(a){this.onKeyPress(a)}));this.addUndoListener();this.addBeforeUnloadListener();a.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(){this.updateActionStates()}));a.getModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(){this.updateActionStates()}));
|
||||
var c=a.setDefaultParent,d=this;this.editor.graph.setDefaultParent=function(){c.apply(this,arguments);d.updateActionStates()};a.editLink=d.actions.get("editLink").funct;this.updateActionStates();this.initClipboard();this.initCanvas();null!=this.format&&this.format.init()};EditorUi.prototype.onKeyDown=function(a){var c=this.editor.graph;9==a.which&&c.isEnabled()&&!mxEvent.isAltDown(a)&&(c.isEditing()?c.stopEditing(!1):c.selectCell(!mxEvent.isShiftDown(a)),mxEvent.consume(a))};
|
||||
EditorUi.prototype.onKeyPress=function(a){var c=this.editor.graph;!this.isImmediateEditingEvent(a)||c.isEditing()||c.isSelectionEmpty()||0===a.which||mxEvent.isAltDown(a)||mxEvent.isControlDown(a)||mxEvent.isMetaDown(a)||(c.escape(),c.startEditing(),mxClient.IS_FF&&(c=c.cellEditor,c.textarea.innerHTML=String.fromCharCode(a.which),a=document.createRange(),a.selectNodeContents(c.textarea),a.collapse(!1),c=window.getSelection(),c.removeAllRanges(),c.addRange(a)))};
|
||||
|
@ -2150,7 +2150,8 @@ this.container.appendChild(this.sidebarFooterContainer);this.container.appendChi
|
|||
!0,0,mxUtils.bind(this,function(a){this.hsplitPosition=a;this.refresh()})))};EditorUi.prototype.createStatusContainer=function(){var a=document.createElement("a");a.className="geItem geStatus";420>screen.width&&(a.style.maxWidth=Math.max(20,screen.width-320)+"px",a.style.overflow="hidden");return a};EditorUi.prototype.setStatusText=function(a){this.statusContainer.innerHTML=a};EditorUi.prototype.createToolbar=function(a){return new Toolbar(this,a)};
|
||||
EditorUi.prototype.createSidebar=function(a){return new Sidebar(this,a)};EditorUi.prototype.createFormat=function(a){return new Format(this,a)};EditorUi.prototype.createFooter=function(){return this.createDiv("geFooter")};EditorUi.prototype.createDiv=function(a){var c=document.createElement("div");c.className=a;return c};
|
||||
EditorUi.prototype.addSplitHandler=function(a,c,d,b){function f(a){if(null!=h){var e=new mxPoint(mxEvent.getClientX(a),mxEvent.getClientY(a));b(Math.max(0,g+(c?e.x-h.x:h.y-e.y)-d));mxEvent.consume(a);g!=m()&&(k=!0,l=null)}}function e(a){f(a);h=g=null}var h=null,g=null,k=!0,l=null;mxClient.IS_POINTER&&(a.style.touchAction="none");var m=mxUtils.bind(this,function(){var b=parseInt(c?a.style.left:a.style.bottom);c||(b=b+d-this.footerHeight);return b});mxEvent.addGestureListeners(a,function(a){h=new mxPoint(mxEvent.getClientX(a),
|
||||
mxEvent.getClientY(a));g=m();k=!1;mxEvent.consume(a)});mxEvent.addListener(a,"click",function(a){if(!k){var c=null!=l?l-d:0;l=m();b(c);mxEvent.consume(a)}});mxEvent.addGestureListeners(document,null,f,e);this.destroyFunctions.push(function(){mxEvent.removeGestureListeners(document,null,f,e)})};EditorUi.prototype.showDialog=function(a,c,d,b,f,e,h){this.editor.graph.tooltipHandler.hideTooltip();null==this.dialogs&&(this.dialogs=[]);this.dialog=new Dialog(this,a,c,d,b,f,e,h);this.dialogs.push(this.dialog)};
|
||||
mxEvent.getClientY(a));g=m();k=!1;mxEvent.consume(a)});mxEvent.addListener(a,"click",mxUtils.bind(this,function(a){if(!k&&this.hsplitClickEnabled){var c=null!=l?l-d:0;l=m();b(c);mxEvent.consume(a)}}));mxEvent.addGestureListeners(document,null,f,e);this.destroyFunctions.push(function(){mxEvent.removeGestureListeners(document,null,f,e)})};
|
||||
EditorUi.prototype.showDialog=function(a,c,d,b,f,e,h){this.editor.graph.tooltipHandler.hideTooltip();null==this.dialogs&&(this.dialogs=[]);this.dialog=new Dialog(this,a,c,d,b,f,e,h);this.dialogs.push(this.dialog)};
|
||||
EditorUi.prototype.hideDialog=function(a){null!=this.dialogs&&0<this.dialogs.length&&(this.dialogs.pop().close(a),this.dialog=0<this.dialogs.length?this.dialogs[this.dialogs.length-1]:null,null==this.dialog&&"hidden"!=this.editor.graph.container.style.visibility&&this.editor.graph.container.focus(),mxUtils.clearSelection(),this.editor.fireEvent(new mxEventObject("hideDialog")))};
|
||||
EditorUi.prototype.pickColor=function(a,c){var d=this.editor.graph,b=d.cellEditor.saveSelection(),f=new ColorDialog(this,a||"none",function(a){d.cellEditor.restoreSelection(b);c(a)},function(){d.cellEditor.restoreSelection(b)});this.showDialog(f.container,230,430,!0,!1);f.init()};
|
||||
EditorUi.prototype.openFile=function(){window.openFile=new OpenFile(mxUtils.bind(this,function(a){this.hideDialog(a)}));this.showDialog((new OpenDialog(this)).container,Editor.useLocalStorage?640:320,Editor.useLocalStorage?480:220,!0,!0,function(){window.openFile=null})};
|
||||
|
@ -6822,7 +6823,7 @@ null,null,this.getTagsForStencil("mxgraph.weblogos","blogger","web logos logo").
|
|||
66,65,"","Crowd",null,null,this.getTagsForStencil("mxgraph.weblogos","crowd logo","web logos logo").join(" ")),this.createVertexTemplateEntry("image;image=img/lib/atlassian/Crucible_Logo.svg;",61,61,"","Crucible",null,null,this.getTagsForStencil("mxgraph.weblogos","crucible logo","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dealsplus;fillColor=#935492",76,.2*333,"","Dealsplus",null,null,this.getTagsForStencil("mxgraph.weblogos","dealsplus","web logos logo").join(" ")),this.createVertexTemplateEntry(a+
|
||||
"designfloat;strokeColor=none",72,72,"","Designfloat",null,null,this.getTagsForStencil("mxgraph.weblogos","designfloat","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"deviantart;fillColor=#009544;strokeColor=none;",62,86.4,"","Deviantart",null,null,this.getTagsForStencil("mxgraph.weblogos","deviantart","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"digg;fillColor=#ffffff",58,56,"","Digg",null,null,this.getTagsForStencil("mxgraph.weblogos","digg","web logos logo").join(" ")),
|
||||
this.createVertexTemplateEntry(a+"diigo;fillColor=#2973D2;strokeColor=none",61.2,68.8,"","Diigo",null,null,this.getTagsForStencil("mxgraph.weblogos","diiigo","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dopplr;fillColor=#F9634D;strokeColor=none",102.4,102.4,"","Dopplr",null,null,this.getTagsForStencil("mxgraph.weblogos","dopplr","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"drawio2;fillColor=#1A5BA3",52.2,70.8,"","Draw.io",null,null,this.getTagsForStencil("mxgraph.weblogos",
|
||||
"drawio draw io draw.io","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"drawio3;fillColor=#1A5BA3;fontSize=15;fontColor=#1A5BA3;fontStyle=1",52.2,52.2,'draw<font color="#f08707">.io</font>',"Draw.io",null,null,this.getTagsForStencil("mxgraph.weblogos","drawio draw io draw.io","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dribbble;fillColor=#EB548D",67.4,67.2,"","Dribbble",null,null,this.getTagsForStencil("mxgraph.weblogos","dribbble","web logos logo").join(" ")),this.createVertexTemplateEntry(a+
|
||||
"drawio draw io draw.io","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"drawio3;fillColor=#1A5BA3;fontSize=15;fontColor=#1A5BA3;fontStyle=1",52.2,52.2,'draw.<font color="#f08707">io</font>',"Draw.io",null,null,this.getTagsForStencil("mxgraph.weblogos","drawio draw io draw.io","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dribbble;fillColor=#EB548D",67.4,67.2,"","Dribbble",null,null,this.getTagsForStencil("mxgraph.weblogos","dribbble","web logos logo").join(" ")),this.createVertexTemplateEntry(a+
|
||||
"dropbox;fillColor=#0287EA",73.4,62,"","Dropbox2",null,null,this.getTagsForStencil("mxgraph.weblogos","dropbox","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"drupal",60.6,69,"","Drupal",null,null,this.getTagsForStencil("mxgraph.weblogos","drupal","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"dzone",.2*438,61.2,"","Dzone",null,null,this.getTagsForStencil("mxgraph.weblogos","dzone","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"ebay",81.2,34.4,"","Ebay",
|
||||
null,null,this.getTagsForStencil("mxgraph.weblogos","ebay","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"edmodo;fillColor=#276CB0;strokeColor=none",69.2,73.8,"","Edmodo",null,null,this.getTagsForStencil("mxgraph.weblogos","edmodo","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"evernote;fillColor=#3F3F3F",.2*317,75.2,"","Evernote",null,null,this.getTagsForStencil("mxgraph.weblogos","evernote","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"fancy;fillColor=#6DB3E3",
|
||||
39.2,79,"","Fancy",null,null,this.getTagsForStencil("mxgraph.weblogos","fancy","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"fark;fillColor=#B1B0C7;gradientColor=#ffffff;strokeColor=#B1B0C7",44.2,70.2,"","Fark",null,null,this.getTagsForStencil("mxgraph.weblogos","fark","web logos logo").join(" ")),this.createVertexTemplateEntry(a+"fashiolista",.2*388,73.2,"","Fashiolista",null,null,this.getTagsForStencil("mxgraph.weblogos","fashiolista","web logos logo").join(" ")),this.createVertexTemplateEntry(a+
|
||||
|
@ -6897,7 +6898,7 @@ StorageFile.prototype.open=function(){DrawioFile.prototype.open.apply(this,argum
|
|||
StorageLibrary.prototype.isRenamable=function(a,d,f){return".scratchpad"!=this.title};StorageLibrary.prototype.open=function(){};UrlLibrary=function(a,d,f){StorageFile.call(this,a,d,f);a=f;d=a.lastIndexOf("/");0<=d&&(a=a.substring(d+1));this.fname=a};mxUtils.extend(UrlLibrary,StorageFile);UrlLibrary.prototype.getHash=function(){return"U"+encodeURIComponent(this.title)};UrlLibrary.prototype.getTitle=function(){return this.fname};UrlLibrary.prototype.isAutosave=function(){return!1};UrlLibrary.prototype.isEditable=function(a,d,f){return!1};UrlLibrary.prototype.saveAs=function(a,d,f){};UrlLibrary.prototype.open=function(){};var StorageDialog=function(a,d,f){function c(c,x,u,k,v,q){function w(){mxEvent.addListener(t,"click",null!=q?q:function(){u!=App.MODE_GOOGLE||a.isDriveDomain()?u==App.MODE_GOOGLE&&a.spinner.spin(document.body,mxResources.get("authorizing"))?a.drive.checkToken(mxUtils.bind(this,function(){a.spinner.stop();a.setMode(u,b.checked);d()})):(a.setMode(u,b.checked),d()):window.location.hostname=DriveClient.prototype.newAppHostname})}var t=document.createElement("a");t.style.overflow="hidden";t.style.display=
|
||||
mxClient.IS_QUIRKS?"inline":"inline-block";t.className="geBaseButton";t.style.boxSizing="border-box";t.style.fontSize="11px";t.style.position="relative";t.style.margin="4px";t.style.padding="8px 10px 12px 10px";t.style.width="88px";t.style.height="100px";t.style.whiteSpace="nowrap";t.setAttribute("title",x);mxClient.IS_QUIRKS&&(t.style.cssFloat="left",t.style.zoom="1");var A=document.createElement("div");A.style.textOverflow="ellipsis";A.style.overflow="hidden";if(null!=c){var g=document.createElement("img");
|
||||
g.setAttribute("src",c);g.setAttribute("border","0");g.setAttribute("align","absmiddle");g.style.width="60px";g.style.height="60px";g.style.paddingBottom="6px";t.appendChild(g)}else A.style.paddingTop="5px",A.style.whiteSpace="normal",mxClient.IS_IOS?(t.style.padding="0px 10px 20px 10px",t.style.top="6px"):mxClient.IS_FF&&(A.style.paddingTop="0px",A.style.marginTop="-2px");t.appendChild(A);mxUtils.write(A,x);if(null!=v)for(c=0;c<v.length;c++)mxUtils.br(A),mxUtils.write(A,v[c]);if(null!=k&&null==a[k]){g.style.visibility=
|
||||
"hidden";mxUtils.setOpacity(A,10);var F=new Spinner({lines:12,length:12,width:5,radius:10,rotate:0,color:"dark"==uiTheme?"#c0c0c0":"#000",speed:1.5,trail:60,shadow:!1,hwaccel:!1,top:"40%",zIndex:2E9});F.spin(t);var h=window.setTimeout(function(){null==a[k]&&(F.stop(),t.style.display="none")},3E4);a.addListener("clientLoaded",mxUtils.bind(this,function(){null!=a[k]&&(window.clearTimeout(h),mxUtils.setOpacity(A,100),g.style.visibility="",F.stop(),w(),"drive"==k&&null!=l.parentNode&&l.parentNode.removeChild(l))}))}else w();
|
||||
"hidden";mxUtils.setOpacity(A,10);var h=new Spinner({lines:12,length:12,width:5,radius:10,rotate:0,color:"dark"==uiTheme?"#c0c0c0":"#000",speed:1.5,trail:60,shadow:!1,hwaccel:!1,top:"40%",zIndex:2E9});h.spin(t);var F=window.setTimeout(function(){null==a[k]&&(h.stop(),t.style.display="none")},3E4);a.addListener("clientLoaded",mxUtils.bind(this,function(){null!=a[k]&&(window.clearTimeout(F),mxUtils.setOpacity(A,100),g.style.visibility="",h.stop(),w(),"drive"==k&&null!=l.parentNode&&l.parentNode.removeChild(l))}))}else w();
|
||||
p.appendChild(t);++e>=f&&(mxUtils.br(p),e=0)}f=null!=f?f:2;var g=document.createElement("div");g.style.textAlign="center";g.style.whiteSpace="nowrap";g.style.paddingTop="0px";g.style.paddingBottom="20px";var h=a.addLanguageMenu(g,!0);null!=h&&(h.style.bottom=parseInt("28px")-2+"px");if(!a.isOffline()&&1<a.getServiceCount()){h=document.createElement("a");h.setAttribute("href","https://about.draw.io/support/");h.setAttribute("title",mxResources.get("help"));h.setAttribute("target","_blank");h.style.position=
|
||||
"absolute";h.style.textDecoration="none";h.style.cursor="pointer";h.style.fontSize="12px";h.style.bottom="28px";h.style.left="26px";h.style.color="gray";var m=document.createElement("img");m.setAttribute("border","0");m.setAttribute("valign","bottom");m.setAttribute("src",Editor.helpImage);m.style.marginRight="2px";h.appendChild(m);mxUtils.write(h,mxResources.get("help"));g.appendChild(h)}var n=document.createElement("div");n.style.position="absolute";n.style.cursor="pointer";n.style.fontSize="12px";
|
||||
n.style.bottom="28px";n.style.color="gray";mxUtils.write(n,mxResources.get("decideLater"));a.isOfflineApp()?n.style.right="20px":(mxUtils.setPrefixedStyle(n.style,"transform","translate(-50%,0)"),n.style.left="50%");this.init=function(){if(mxClient.IS_QUIRKS||8==document.documentMode)n.style.marginLeft=-Math.round(n.clientWidth/2)+"px"};g.appendChild(n);mxEvent.addListener(n,"click",function(){a.hideDialog();var b=Editor.useLocalStorage;a.createFile(a.defaultFilename,null,null,null,null,null,null,
|
||||
|
@ -6923,15 +6924,15 @@ h=mxUtils.button(h||mxResources.get("cancel"),function(){a.hideDialog();null!=c&
|
|||
g.style.height="auto",g.className="geBtn",g.style.width="40%"):g.className="geBtn gePrimaryBtn";a.editor.cancelFirst||e.appendChild(h);b.appendChild(e);p?(e.style.marginTop="10px",e=document.createElement("p"),e.style.marginTop="20px",e.appendChild(l),m=document.createElement("span"),mxUtils.write(m," "+mxResources.get("rememberThisSetting")),e.appendChild(m),b.appendChild(e),mxEvent.addListener(m,"click",function(b){l.checked=!l.checked;mxEvent.consume(b)})):e.style.marginTop="16px";this.container=
|
||||
b},ErrorDialog=function(a,d,f,c,g,h,m,n,p,b,e){p=null!=p?p:!0;var l=document.createElement("div");l.style.textAlign="center";if(null!=d){var q=document.createElement("div");q.style.padding="0px";q.style.margin="0px";q.style.fontSize="18px";q.style.paddingBottom="16px";q.style.marginBottom="16px";q.style.borderBottom="1px solid #c0c0c0";q.style.color="gray";mxUtils.write(q,d);l.appendChild(q)}d=document.createElement("div");d.style.padding="6px";d.innerHTML=f;l.appendChild(d);f=document.createElement("div");
|
||||
f.style.marginTop="16px";f.style.textAlign="center";null!=h&&(d=mxUtils.button(mxResources.get("tryAgain"),function(){a.hideDialog();h()}),d.className="geBtn",f.appendChild(d),f.style.textAlign="center");null!=b&&(b=mxUtils.button(b,function(){null!=e&&e()}),b.className="geBtn",f.appendChild(b));var u=mxUtils.button(c,function(){p&&a.hideDialog();null!=g&&g()});u.className="geBtn";f.appendChild(u);null!=m&&(c=mxUtils.button(m,function(){p&&a.hideDialog();null!=n&&n()}),c.className="geBtn gePrimaryBtn",
|
||||
f.appendChild(c));this.init=function(){u.focus()};l.appendChild(f);this.container=l},EmbedDialog=function(a,d,f,c,g){c=document.createElement("div");var h=/^https?:\/\//.test(d)||/^mailto:\/\//.test(d);mxUtils.write(c,mxResources.get(5E5>d.length?h?"link":"mainEmbedNotice":"preview")+":");mxUtils.br(c);var m=document.createElement("div");m.style.position="absolute";m.style.top="30px";m.style.right="30px";m.style.color="gray";mxUtils.write(m,a.formatFileSize(d.length));c.appendChild(m);var n=document.createElement("textarea");
|
||||
n.setAttribute("autocomplete","off");n.setAttribute("autocorrect","off");n.setAttribute("autocapitalize","off");n.setAttribute("spellcheck","false");n.style.marginTop="10px";n.style.resize="none";n.style.height="150px";n.style.width="440px";n.style.border="1px solid gray";n.value=mxResources.get("updatingDocument");c.appendChild(n);mxUtils.br(c);this.init=function(){window.setTimeout(function(){5E5>d.length?(n.value=d,n.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?
|
||||
n.select():document.execCommand("selectAll",!1,null)):(n.setAttribute("readonly","true"),n.value=d.substring(0,340)+"... ("+mxResources.get("drawingTooLarge")+")")},0)};m=document.createElement("div");m.style.position="absolute";m.style.bottom="36px";m.style.right="32px";var p=null;!EmbedDialog.showPreviewOption||mxClient.IS_CHROMEAPP&&!h||navigator.standalone||!(h||mxClient.IS_SVG&&(null==document.documentMode||9<document.documentMode))||(p=mxUtils.button(mxResources.get(5E5>d.length?"preview":"openInNewWindow"),
|
||||
function(){var b=5E5>d.length?n.value:d;if(null!=g)g(b);else if(h)try{var e=a.openLink(b);null!=e&&(null==f||0<f)&&window.setTimeout(mxUtils.bind(this,function(){null!=e&&null!=e.location.href&&e.location.href.substring(0,8)!=b.substring(0,8)&&(e.close(),a.handleError({message:mxResources.get("drawingTooLarge")}))}),f||500)}catch(t){a.handleError({message:t.message||mxResources.get("drawingTooLarge")})}else{var c=window.open().document;c.writeln("<html><head><title>"+encodeURIComponent(mxResources.get("preview"))+
|
||||
'</title><meta charset="utf-8"></head><body>'+d+"</body></html>");c.close()}}),p.className="geBtn",m.appendChild(p));if(!h||7500<d.length){var b=mxUtils.button(mxResources.get("download"),function(){a.hideDialog();a.saveData("embed.txt","txt",d,"text/plain")});b.className="geBtn";m.appendChild(b)}if(h&&(!a.isOffline()||mxClient.IS_CHROMEAPP)){if(51200>d.length){var e=mxUtils.button("",function(){try{var b="https://www.facebook.com/sharer.php?p[url]="+encodeURIComponent(n.value);a.openLink(b)}catch(q){a.handleError({message:q.message||
|
||||
mxResources.get("drawingTooLarge")})}}),b=document.createElement("img");b.setAttribute("src",Editor.facebookImage);b.setAttribute("width","18");b.setAttribute("height","18");b.setAttribute("border","0");e.appendChild(b);e.setAttribute("title",mxResources.get("facebook")+" ("+a.formatFileSize(51200)+" max)");e.style.verticalAlign="bottom";e.style.paddingTop="4px";e.style.minWidth="46px";e.className="geBtn";m.appendChild(e)}7168>d.length&&(e=mxUtils.button("",function(){try{var b="https://twitter.com/intent/tweet?text="+
|
||||
encodeURIComponent("Check out the diagram I made using @drawio")+"&url="+encodeURIComponent(n.value);a.openLink(b)}catch(q){a.handleError({message:q.message||mxResources.get("drawingTooLarge")})}}),b=document.createElement("img"),b.setAttribute("src",Editor.tweetImage),b.setAttribute("width","18"),b.setAttribute("height","18"),b.setAttribute("border","0"),b.style.marginBottom="5px",e.appendChild(b),e.setAttribute("title",mxResources.get("twitter")+" ("+a.formatFileSize(7168)+" max)"),e.style.verticalAlign=
|
||||
"bottom",e.style.paddingTop="4px",e.style.minWidth="46px",e.className="geBtn",m.appendChild(e))}b=mxUtils.button(mxResources.get("close"),function(){a.hideDialog()});m.appendChild(b);e=mxUtils.button(mxResources.get("copy"),function(){n.focus();mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",!1,null);document.execCommand("copy");a.alert(mxResources.get("copiedToClipboard"))});5E5>d.length?mxClient.IS_SF||null!=document.documentMode?
|
||||
b.className="geBtn gePrimaryBtn":(m.appendChild(e),e.className="geBtn gePrimaryBtn",b.className="geBtn"):(m.appendChild(p),b.className="geBtn",p.className="geBtn gePrimaryBtn");c.appendChild(m);this.container=c};EmbedDialog.showPreviewOption=!0;
|
||||
f.appendChild(c));this.init=function(){u.focus()};l.appendChild(f);this.container=l},EmbedDialog=function(a,d,f,c,g,h){c=document.createElement("div");var m=/^https?:\/\//.test(d)||/^mailto:\/\//.test(d);null!=h?mxUtils.write(c,h):mxUtils.write(c,mxResources.get(5E5>d.length?m?"link":"mainEmbedNotice":"preview")+":");mxUtils.br(c);h=document.createElement("div");h.style.position="absolute";h.style.top="30px";h.style.right="30px";h.style.color="gray";mxUtils.write(h,a.formatFileSize(d.length));c.appendChild(h);
|
||||
var n=document.createElement("textarea");n.setAttribute("autocomplete","off");n.setAttribute("autocorrect","off");n.setAttribute("autocapitalize","off");n.setAttribute("spellcheck","false");n.style.marginTop="10px";n.style.resize="none";n.style.height="150px";n.style.width="440px";n.style.border="1px solid gray";n.value=mxResources.get("updatingDocument");c.appendChild(n);mxUtils.br(c);this.init=function(){window.setTimeout(function(){5E5>d.length?(n.value=d,n.focus(),mxClient.IS_GC||mxClient.IS_FF||
|
||||
5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",!1,null)):(n.setAttribute("readonly","true"),n.value=d.substring(0,340)+"... ("+mxResources.get("drawingTooLarge")+")")},0)};h=document.createElement("div");h.style.position="absolute";h.style.bottom="36px";h.style.right="32px";var p=null;!EmbedDialog.showPreviewOption||mxClient.IS_CHROMEAPP&&!m||navigator.standalone||!(m||mxClient.IS_SVG&&(null==document.documentMode||9<document.documentMode))||(p=mxUtils.button(mxResources.get(5E5>
|
||||
d.length?"preview":"openInNewWindow"),function(){var b=5E5>d.length?n.value:d;if(null!=g)g(b);else if(m)try{var e=a.openLink(b);null!=e&&(null==f||0<f)&&window.setTimeout(mxUtils.bind(this,function(){null!=e&&null!=e.location.href&&e.location.href.substring(0,8)!=b.substring(0,8)&&(e.close(),a.handleError({message:mxResources.get("drawingTooLarge")}))}),f||500)}catch(t){a.handleError({message:t.message||mxResources.get("drawingTooLarge")})}else{var c=window.open().document;c.writeln("<html><head><title>"+
|
||||
encodeURIComponent(mxResources.get("preview"))+'</title><meta charset="utf-8"></head><body>'+d+"</body></html>");c.close()}}),p.className="geBtn",h.appendChild(p));if(!m||7500<d.length){var b=mxUtils.button(mxResources.get("download"),function(){a.hideDialog();a.saveData("embed.txt","txt",d,"text/plain")});b.className="geBtn";h.appendChild(b)}if(m&&(!a.isOffline()||mxClient.IS_CHROMEAPP)){if(51200>d.length){var e=mxUtils.button("",function(){try{var b="https://www.facebook.com/sharer.php?p[url]="+
|
||||
encodeURIComponent(n.value);a.openLink(b)}catch(q){a.handleError({message:q.message||mxResources.get("drawingTooLarge")})}}),b=document.createElement("img");b.setAttribute("src",Editor.facebookImage);b.setAttribute("width","18");b.setAttribute("height","18");b.setAttribute("border","0");e.appendChild(b);e.setAttribute("title",mxResources.get("facebook")+" ("+a.formatFileSize(51200)+" max)");e.style.verticalAlign="bottom";e.style.paddingTop="4px";e.style.minWidth="46px";e.className="geBtn";h.appendChild(e)}7168>
|
||||
d.length&&(e=mxUtils.button("",function(){try{var b="https://twitter.com/intent/tweet?text="+encodeURIComponent("Check out the diagram I made using @drawio")+"&url="+encodeURIComponent(n.value);a.openLink(b)}catch(q){a.handleError({message:q.message||mxResources.get("drawingTooLarge")})}}),b=document.createElement("img"),b.setAttribute("src",Editor.tweetImage),b.setAttribute("width","18"),b.setAttribute("height","18"),b.setAttribute("border","0"),b.style.marginBottom="5px",e.appendChild(b),e.setAttribute("title",
|
||||
mxResources.get("twitter")+" ("+a.formatFileSize(7168)+" max)"),e.style.verticalAlign="bottom",e.style.paddingTop="4px",e.style.minWidth="46px",e.className="geBtn",h.appendChild(e))}b=mxUtils.button(mxResources.get("close"),function(){a.hideDialog()});h.appendChild(b);e=mxUtils.button(mxResources.get("copy"),function(){n.focus();mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?n.select():document.execCommand("selectAll",!1,null);document.execCommand("copy");a.alert(mxResources.get("copiedToClipboard"))});
|
||||
5E5>d.length?mxClient.IS_SF||null!=document.documentMode?b.className="geBtn gePrimaryBtn":(h.appendChild(e),e.className="geBtn gePrimaryBtn",b.className="geBtn"):(h.appendChild(p),b.className="geBtn",p.className="geBtn gePrimaryBtn");c.appendChild(h);this.container=c};EmbedDialog.showPreviewOption=!0;
|
||||
var GoogleSitesDialog=function(a,d){function f(){var a=null!=y.getTitle()?y.getTitle():this.defaultFilename;if(F.checked&&""!=q.value){var c="https://www.draw.io/gadget.xml?type=4&diagram="+encodeURIComponent(mxUtils.htmlEntities(q.value));null!=a&&(c+="&title="+encodeURIComponent(a));0<C.length&&(c+="&s="+C);""!=u.value&&"0"!=u.value&&(c+="&border="+u.value);""!=l.value&&(c+="&height="+l.value);c+="&pan="+(t.checked?"1":"0");c+="&zoom="+(w.checked?"1":"0");c+="&fit="+(v.checked?"1":"0");c+="&resize="+
|
||||
(k.checked?"1":"0");c+="&x0="+Number(e.value);c+="&y0="+p;g.mathEnabled&&(c+="&math=1");A.checked?c+="&edit=_blank":x.checked&&(c+="&edit="+encodeURIComponent(mxUtils.htmlEntities(window.location.href)));b.value=c}else y.constructor==DriveFile||y.constructor==DropboxFile?(c="https://www.draw.io/gadget.xml?embed=0&diagram=",""!=q.value?c+=encodeURIComponent(mxUtils.htmlEntities(q.value))+"&type=3":(c+=y.getHash().substring(1),c=y.constructor==DropboxFile?c+"&type=2":c+"&type=1"),null!=a&&(c+="&title="+
|
||||
encodeURIComponent(a)),""!=l.value&&(a=parseInt(l.value)+parseInt(e.value),c+="&height="+a),b.value=c):b.value=""}var c=document.createElement("div"),g=a.editor.graph,h=g.getGraphBounds(),m=g.view.scale,n=Math.floor(h.x/m-g.view.translate.x),p=Math.floor(h.y/m-g.view.translate.y);mxUtils.write(c,mxResources.get("googleGadget")+":");mxUtils.br(c);var b=document.createElement("input");b.setAttribute("type","text");b.style.marginBottom="8px";b.style.marginTop="2px";b.style.width="410px";c.appendChild(b);
|
||||
|
@ -7186,8 +7187,8 @@ function(b){this.editorUi.actions.get("editShape").funct()})),a.setAttribute("ti
|
|||
"3";Graph.prototype.edgeMode="move"!=urlParams.edge;var q=Graph.prototype.init;Graph.prototype.init=function(){function b(b){a=b;if(mxClient.IS_QUIRKS||7==document.documentMode||8==document.documentMode)a=mxUtils.clone(b)}q.apply(this,arguments);var a=null;mxEvent.addListener(this.container,"mouseenter",b);mxEvent.addListener(this.container,"mousemove",b);mxEvent.addListener(this.container,"mouseleave",function(b){a=null});this.isMouseInsertPoint=function(){return null!=a};var e=this.getInsertPoint;
|
||||
this.getInsertPoint=function(){return null!=a?this.getPointForEvent(a):e.apply(this,arguments)};var c=this.layoutManager.getLayout;this.layoutManager.getLayout=function(b){var a=this.graph.view.getState(b),a=null!=a?a.style:this.graph.getCellStyle(b);if("undefined"!=typeof mxRackContainer&&"rack"==a.childLayout){var e=new mxStackLayout(this.graph,!1);e.setChildGeometry=function(b,a){a.height=Math.max(a.height,20);if(1<a.height/20){var e=a.height%20;a.height+=10<e?20-e:-e}this.graph.getModel().setGeometry(b,
|
||||
a)};e.fill=!0;e.unitSize=mxRackContainer.unitSize|20;e.marginLeft=a.marginLeft||0;e.marginRight=a.marginRight||0;e.marginTop=a.marginTop||0;e.marginBottom=a.marginBottom||0;e.resizeParent=!1;return e}return c.apply(this,arguments)}};var u=Graph.prototype.loadStylesheet;Graph.prototype.loadStylesheet=function(){u.apply(this,arguments);this.currentStyle="default-style2"};Graph.prototype.handleCustomLink=function(b){if("data:action/json,"==b.substring(0,17)&&(b=JSON.parse(b.substring(17)),null!=b.actions)){for(var a=
|
||||
0;a<b.actions.length;a++)null!=b.actions[a].open&&(this.isCustomLink(b.actions[a].open)?this.customLinkClicked(b.actions[a].open):this.openLink(b.actions[a].open));this.model.beginUpdate();try{for(a=0;a<b.actions.length;a++)this.handleLinkAction(b.actions[a])}finally{this.model.endUpdate()}}};Graph.prototype.handleLinkAction=function(b){var a=[];null!=b.select&&this.isEnabled()&&(a=this.getCellsForAction(b.select),this.setSelectionCells(a));null!=b.scroll&&(a=this.getCellsForAction(b.scroll));null!=
|
||||
b.toggle&&this.toggleCells(this.getCellsForAction(b.toggle));null!=b.show&&this.setCellsVisible(this.getCellsForAction(b.show),!0);null!=b.hide&&this.setCellsVisible(this.getCellsForAction(b.hide),!1);null!=b.highlight&&(a=this.getCellsForAction(b.highlight),this.highlightCells(a,b.highlight.color,b.highlight.duration,b.highlight.opacity));0<a.length&&this.scrollCellToVisible(a[0])};Graph.prototype.getCellsForAction=function(b){return this.getCellsById(b.cells).concat(this.getCellsForTags(b.tags))};
|
||||
0;a<b.actions.length;a++)null!=b.actions[a].open&&(this.isCustomLink(b.actions[a].open)?this.customLinkClicked(b.actions[a].open):this.openLink(b.actions[a].open));this.model.beginUpdate();try{for(a=0;a<b.actions.length;a++)this.handleLinkAction(b.actions[a])}finally{this.model.endUpdate()}}};Graph.prototype.handleLinkAction=function(b){var a=[];null!=b.select&&this.isEnabled()&&(a=this.getCellsForAction(b.select),this.setSelectionCells(a));null!=b.highlight&&(a=this.getCellsForAction(b.highlight),
|
||||
this.highlightCells(a,b.highlight.color,b.highlight.duration,b.highlight.opacity));null!=b.toggle&&this.toggleCells(this.getCellsForAction(b.toggle));null!=b.show&&this.setCellsVisible(this.getCellsForAction(b.show),!0);null!=b.hide&&this.setCellsVisible(this.getCellsForAction(b.hide),!1);null!=b.scroll&&(a=this.getCellsForAction(b.scroll));0<a.length&&this.scrollCellToVisible(a[0])};Graph.prototype.getCellsForAction=function(b){return this.getCellsById(b.cells).concat(this.getCellsForTags(b.tags))};
|
||||
Graph.prototype.getCellsById=function(b){var a=[];if(null!=b)for(var e=0;e<b.length;e++)if("*"==b[e])var c=this.getDefaultParent(),a=a.concat(this.model.filterDescendants(function(b){return b!=c},c));else{var l=this.model.getCell(b[e]);null!=l&&a.push(l)}return a};Graph.prototype.getCellsForTags=function(b,a,e){var c=[];if(null!=b){a=null!=a?a:this.model.getDescendants(this.model.getRoot());e=null!=e?e:"tags";for(var k=0;k<a.length;k++)if(this.model.isVertex(a[k])||this.model.isEdge(a[k])){var l=
|
||||
null!=a[k].value&&"object"==typeof a[k].value?mxUtils.trim(a[k].value.getAttribute(e)||""):"",f=!0;if(0<l.length)for(var l=l.toLowerCase().split(" "),d=0;d<b.length&&f;d++)var q=mxUtils.trim(b[d]).toLowerCase(),f=f&&(0==q.length||0<=mxUtils.indexOf(l,q));else f=0==b.length;f&&c.push(a[k])}}return c};Graph.prototype.toggleCells=function(b){this.model.beginUpdate();try{for(var a=0;a<b.length;a++)this.model.setVisible(b[a],!this.model.isVisible(b[a]))}finally{this.model.endUpdate()}};Graph.prototype.setCellsVisible=
|
||||
function(b,a){this.model.beginUpdate();try{for(var e=0;e<b.length;e++)this.model.setVisible(b[e],a)}finally{this.model.endUpdate()}};Graph.prototype.highlightCells=function(b,a,e,c){for(var k=0;k<b.length;k++)this.highlightCell(b[k],a,e,c)};Graph.prototype.highlightCell=function(b,a,e,c){a=null!=a?a:mxConstants.DEFAULT_VALID_COLOR;e=null!=e?e:1E3;b=this.view.getState(b);if(null!=b){var k=Math.max(5,mxUtils.getValue(b.style,mxConstants.STYLE_STROKEWIDTH,1)+4),l=new mxCellHighlight(this,a,k,!1);null!=
|
||||
|
@ -7203,27 +7204,27 @@ a,e=0;do a=this.model.getChildAt(this.model.root,e);while(e++<b&&"1"==mxUtils.ge
|
|||
[SHAPES_PATH+"/mockup/mxMockupMisc.js",STENCIL_PATH+"/mockup/misc.xml"];mxStencilRegistry.libraries["mockup/navigation"]=[SHAPES_PATH+"/mockup/mxMockupNavigation.js",STENCIL_PATH+"/mockup/misc.xml"];mxStencilRegistry.libraries["mockup/text"]=[SHAPES_PATH+"/mockup/mxMockupText.js"];mxStencilRegistry.libraries.floorplan=[SHAPES_PATH+"/mxFloorplan.js",STENCIL_PATH+"/floorplan.xml"];mxStencilRegistry.libraries.bootstrap=[SHAPES_PATH+"/mxBootstrap.js",STENCIL_PATH+"/bootstrap.xml"];mxStencilRegistry.libraries.gmdl=
|
||||
[SHAPES_PATH+"/mxGmdl.js",STENCIL_PATH+"/gmdl.xml"];mxStencilRegistry.libraries.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.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(b){var a=
|
||||
null;null!=b&&0<b.length&&("ER"==b.substring(0,2)?a="mxgraph.er":"sysML"==b.substring(0,5)&&(a="mxgraph.sysml"));return a};var t=mxMarker.createMarker;mxMarker.createMarker=function(b,a,e,c,l,f,d,q,u,g){if(null!=e&&null==mxMarker.markers[e]){var k=this.getPackageForType(e);null!=k&&mxStencilRegistry.getStencil(k)}return t.apply(this,arguments)};PrintDialog.prototype.create=function(b,a){function e(){m.value=Math.max(1,Math.min(q,Math.max(parseInt(m.value),parseInt(h.value))));h.value=Math.max(1,Math.min(q,
|
||||
Math.min(parseInt(m.value),parseInt(h.value))))}function c(a){function e(a,e,k){var l=a.getGraphBounds(),d=0,f=0,q=ba.get(),g=1/a.pageScale,u=A.checked;if(u)var g=parseInt(Q.value),v=parseInt(P.value),g=Math.min(q.height*v/(l.height/a.view.scale),q.width*g/(l.width/a.view.scale));else g=parseInt(p.value)/(100*a.pageScale),isNaN(g)&&(c=1/a.pageScale,p.value="100 %");q=mxRectangle.fromRectangle(q);q.width=Math.ceil(q.width*c);q.height=Math.ceil(q.height*c);g*=c;!u&&a.pageVisible?(l=a.getPageLayout(),
|
||||
null;null!=b&&0<b.length&&("ER"==b.substring(0,2)?a="mxgraph.er":"sysML"==b.substring(0,5)&&(a="mxgraph.sysml"));return a};var t=mxMarker.createMarker;mxMarker.createMarker=function(b,a,e,c,l,f,d,q,u,g){if(null!=e&&null==mxMarker.markers[e]){var k=this.getPackageForType(e);null!=k&&mxStencilRegistry.getStencil(k)}return t.apply(this,arguments)};PrintDialog.prototype.create=function(b,a){function e(){x.value=Math.max(1,Math.min(q,Math.max(parseInt(x.value),parseInt(h.value))));h.value=Math.max(1,Math.min(q,
|
||||
Math.min(parseInt(x.value),parseInt(h.value))))}function c(a){function e(a,e,k){var l=a.getGraphBounds(),d=0,f=0,q=ba.get(),g=1/a.pageScale,u=A.checked;if(u)var g=parseInt(Q.value),v=parseInt(P.value),g=Math.min(q.height*v/(l.height/a.view.scale),q.width*g/(l.width/a.view.scale));else g=parseInt(p.value)/(100*a.pageScale),isNaN(g)&&(c=1/a.pageScale,p.value="100 %");q=mxRectangle.fromRectangle(q);q.width=Math.ceil(q.width*c);q.height=Math.ceil(q.height*c);g*=c;!u&&a.pageVisible?(l=a.getPageLayout(),
|
||||
d-=l.x*q.width,f-=l.y*q.height):u=!0;if(null==e){e=PrintDialog.createPrintPreview(a,g,q,0,d,f,u);e.pageSelector=!1;e.mathEnabled=!1;a=b.getCurrentFile();null!=a&&(e.title=a.getTitle());var w=e.writeHead;e.writeHead=function(a){w.apply(this,arguments);null!=b.editor.fontCss&&(a.writeln('<style type="text/css">'),a.writeln(b.editor.fontCss),a.writeln("</style>"))};if("undefined"!==typeof MathJax){var t=e.renderPage;e.renderPage=function(b,a,e,c,k,l){var d=t.apply(this,arguments);this.graph.mathEnabled?
|
||||
this.mathEnabled=!0:d.className="geDisableMathJax";return d}}e.open(null,null,k,!0)}else{q=a.background;if(null==q||""==q||q==mxConstants.NONE)q="#ffffff";e.backgroundColor=q;e.autoOrigin=u;e.appendGraph(a,g,d,f,k,!0)}return e}var c=parseInt(U.value)/100;isNaN(c)&&(c=1,U.value="100 %");var c=.75*c,k=h.value,d=m.value,f=!t.checked,q=null;f&&(f=k==u&&d==u);if(!f&&null!=b.pages&&b.pages.length){var g=0,f=b.pages.length-1;t.checked||(g=parseInt(k)-1,f=parseInt(d)-1);for(var v=g;v<=f;v++){var w=b.pages[v],
|
||||
k=w==b.currentPage?l:null;if(null==k){var k=b.createTemporaryGraph(l.getStylesheet()),d=!0,g=!1,x=null,n=null;null==w.viewState&&null==w.mapping&&null==w.root&&b.updatePageRoot(w);null!=w.viewState?(d=w.viewState.pageVisible,g=w.viewState.mathEnabled,x=w.viewState.background,n=w.viewState.backgroundImage):null!=w.mapping&&null!=w.mapping.diagramMap&&(g="0"!=w.mapping.diagramMap.get("mathEnabled"),x=w.mapping.diagramMap.get("background"),n=w.mapping.diagramMap.get("backgroundImage"),n=null!=n&&0<n.length?
|
||||
JSON.parse(n):null);k.background=x;k.backgroundImage=null!=n?new mxImage(n.src,n.width,n.height):null;k.pageVisible=d;k.mathEnabled=g;var B=k.getGlobalVariable;k.getGlobalVariable=function(b){return"page"==b?w.getName():"pagenumber"==b?v+1:B.apply(this,arguments)};document.body.appendChild(k.container);b.updatePageRoot(w);k.model.setRoot(w.root)}q=e(k,q,v!=f);k!=l&&k.container.parentNode.removeChild(k.container)}}else q=e(l);q.mathEnabled&&(f=q.wnd.document,f.writeln('<script type="text/x-mathjax-config">'),
|
||||
this.mathEnabled=!0:d.className="geDisableMathJax";return d}}e.open(null,null,k,!0)}else{q=a.background;if(null==q||""==q||q==mxConstants.NONE)q="#ffffff";e.backgroundColor=q;e.autoOrigin=u;e.appendGraph(a,g,d,f,k,!0)}return e}var c=parseInt(U.value)/100;isNaN(c)&&(c=1,U.value="100 %");var c=.75*c,k=h.value,d=x.value,f=!t.checked,q=null;f&&(f=k==u&&d==u);if(!f&&null!=b.pages&&b.pages.length){var g=0,f=b.pages.length-1;t.checked||(g=parseInt(k)-1,f=parseInt(d)-1);for(var v=g;v<=f;v++){var w=b.pages[v],
|
||||
k=w==b.currentPage?l:null;if(null==k){var k=b.createTemporaryGraph(l.getStylesheet()),d=!0,g=!1,m=null,n=null;null==w.viewState&&null==w.mapping&&null==w.root&&b.updatePageRoot(w);null!=w.viewState?(d=w.viewState.pageVisible,g=w.viewState.mathEnabled,m=w.viewState.background,n=w.viewState.backgroundImage):null!=w.mapping&&null!=w.mapping.diagramMap&&(g="0"!=w.mapping.diagramMap.get("mathEnabled"),m=w.mapping.diagramMap.get("background"),n=w.mapping.diagramMap.get("backgroundImage"),n=null!=n&&0<n.length?
|
||||
JSON.parse(n):null);k.background=m;k.backgroundImage=null!=n?new mxImage(n.src,n.width,n.height):null;k.pageVisible=d;k.mathEnabled=g;var B=k.getGlobalVariable;k.getGlobalVariable=function(b){return"page"==b?w.getName():"pagenumber"==b?v+1:B.apply(this,arguments)};document.body.appendChild(k.container);b.updatePageRoot(w);k.model.setRoot(w.root)}q=e(k,q,v!=f);k!=l&&k.container.parentNode.removeChild(k.container)}}else q=e(l);q.mathEnabled&&(f=q.wnd.document,f.writeln('<script type="text/x-mathjax-config">'),
|
||||
f.writeln("MathJax.Hub.Config({"),f.writeln('messageStyle: "none",'),f.writeln('jax: ["input/TeX", "input/MathML", "input/AsciiMath", "output/HTML-CSS"],'),f.writeln('extensions: ["tex2jax.js", "mml2jax.js", "asciimath2jax.js"],'),f.writeln('"HTML-CSS": {'),f.writeln("imageFont: null"),f.writeln("},"),f.writeln("TeX: {"),f.writeln('extensions: ["AMSmath.js", "AMSsymbols.js", "noErrors.js", "noUndefined.js"]'),f.writeln("},"),f.writeln("tex2jax: {"),f.writeln('\tignoreClass: "geDisableMathJax"'),f.writeln("},"),
|
||||
f.writeln("asciimath2jax: {"),f.writeln('\tignoreClass: "geDisableMathJax"'),f.writeln("}"),f.writeln("});"),a&&(f.writeln("MathJax.Hub.Queue(function () {"),f.writeln("window.print();"),f.writeln("});")),f.writeln("\x3c/script>"),f.writeln('<script type="text/javascript" src="https://math.draw.io/current/MathJax.js">\x3c/script>'));q.closeDocument();!q.mathEnabled&&a&&PrintDialog.printPreview(q)}var l=b.editor.graph,f=document.createElement("div"),d=document.createElement("h3");d.style.width="100%";
|
||||
d.style.textAlign="center";d.style.marginTop="0px";mxUtils.write(d,a||mxResources.get("print"));f.appendChild(d);var q=1,u=1,g=document.createElement("div");g.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");g.appendChild(t);d=document.createElement("span");mxUtils.write(d,
|
||||
mxResources.get("printAllPages"));g.appendChild(d);mxUtils.br(g);var w=t.cloneNode(!0);t.setAttribute("checked","checked");w.setAttribute("value","range");g.appendChild(w);d=document.createElement("span");mxUtils.write(d,mxResources.get("pages")+":");g.appendChild(d);var h=document.createElement("input");h.style.cssText="margin:0 8px 0 8px;";h.setAttribute("value","1");h.setAttribute("type","number");h.setAttribute("min","1");h.style.width="50px";g.appendChild(h);d=document.createElement("span");
|
||||
mxUtils.write(d,mxResources.get("to"));g.appendChild(d);var m=h.cloneNode(!0);g.appendChild(m);mxEvent.addListener(h,"focus",function(){w.checked=!0});mxEvent.addListener(m,"focus",function(){w.checked=!0});mxEvent.addListener(h,"change",e);mxEvent.addListener(m,"change",e);if(null!=b.pages&&(q=b.pages.length,null!=b.currentPage))for(d=0;d<b.pages.length;d++)if(b.currentPage==b.pages[d]){u=d+1;h.value=u;m.value=u;break}h.setAttribute("max",q);m.setAttribute("max",q);1<q&&f.appendChild(g);var x=document.createElement("div");
|
||||
x.style.marginBottom="10px";var n=document.createElement("input");n.style.marginRight="8px";n.setAttribute("value","adjust");n.setAttribute("type","radio");n.setAttribute("name","printZoom");x.appendChild(n);d=document.createElement("span");mxUtils.write(d,mxResources.get("adjustTo"));x.appendChild(d);var p=document.createElement("input");p.style.cssText="margin:0 8px 0 8px;";p.setAttribute("value","100 %");p.style.width="50px";x.appendChild(p);mxEvent.addListener(p,"focus",function(){n.checked=!0});
|
||||
f.appendChild(x);var g=g.cloneNode(!1),A=n.cloneNode(!0);A.setAttribute("value","fit");n.setAttribute("checked","checked");d=document.createElement("div");d.style.cssText="display:inline-block;height:100%;vertical-align:top;padding-top:2px;";d.appendChild(A);g.appendChild(d);x=document.createElement("table");x.style.display="inline-block";var N=document.createElement("tbody"),S=document.createElement("tr"),O=S.cloneNode(!0),G=document.createElement("td"),W=G.cloneNode(!0),R=G.cloneNode(!0),T=G.cloneNode(!0),
|
||||
mxUtils.write(d,mxResources.get("to"));g.appendChild(d);var x=h.cloneNode(!0);g.appendChild(x);mxEvent.addListener(h,"focus",function(){w.checked=!0});mxEvent.addListener(x,"focus",function(){w.checked=!0});mxEvent.addListener(h,"change",e);mxEvent.addListener(x,"change",e);if(null!=b.pages&&(q=b.pages.length,null!=b.currentPage))for(d=0;d<b.pages.length;d++)if(b.currentPage==b.pages[d]){u=d+1;h.value=u;x.value=u;break}h.setAttribute("max",q);x.setAttribute("max",q);1<q&&f.appendChild(g);var m=document.createElement("div");
|
||||
m.style.marginBottom="10px";var n=document.createElement("input");n.style.marginRight="8px";n.setAttribute("value","adjust");n.setAttribute("type","radio");n.setAttribute("name","printZoom");m.appendChild(n);d=document.createElement("span");mxUtils.write(d,mxResources.get("adjustTo"));m.appendChild(d);var p=document.createElement("input");p.style.cssText="margin:0 8px 0 8px;";p.setAttribute("value","100 %");p.style.width="50px";m.appendChild(p);mxEvent.addListener(p,"focus",function(){n.checked=!0});
|
||||
f.appendChild(m);var g=g.cloneNode(!1),A=n.cloneNode(!0);A.setAttribute("value","fit");n.setAttribute("checked","checked");d=document.createElement("div");d.style.cssText="display:inline-block;height:100%;vertical-align:top;padding-top:2px;";d.appendChild(A);g.appendChild(d);m=document.createElement("table");m.style.display="inline-block";var N=document.createElement("tbody"),S=document.createElement("tr"),O=S.cloneNode(!0),G=document.createElement("td"),W=G.cloneNode(!0),R=G.cloneNode(!0),T=G.cloneNode(!0),
|
||||
V=G.cloneNode(!0),I=G.cloneNode(!0);G.style.textAlign="right";T.style.textAlign="right";mxUtils.write(G,mxResources.get("fitTo"));var Q=document.createElement("input");Q.style.cssText="margin:0 8px 0 8px;";Q.setAttribute("value","1");Q.setAttribute("min","1");Q.setAttribute("type","number");Q.style.width="40px";W.appendChild(Q);d=document.createElement("span");mxUtils.write(d,mxResources.get("fitToSheetsAcross"));R.appendChild(d);mxUtils.write(T,mxResources.get("fitToBy"));var P=Q.cloneNode(!0);V.appendChild(P);
|
||||
mxEvent.addListener(Q,"focus",function(){A.checked=!0});mxEvent.addListener(P,"focus",function(){A.checked=!0});d=document.createElement("span");mxUtils.write(d,mxResources.get("fitToSheetsDown"));I.appendChild(d);S.appendChild(G);S.appendChild(W);S.appendChild(R);O.appendChild(T);O.appendChild(V);O.appendChild(I);N.appendChild(S);N.appendChild(O);x.appendChild(N);g.appendChild(x);f.appendChild(g);g=document.createElement("div");d=document.createElement("div");d.style.fontWeight="bold";d.style.marginBottom=
|
||||
mxEvent.addListener(Q,"focus",function(){A.checked=!0});mxEvent.addListener(P,"focus",function(){A.checked=!0});d=document.createElement("span");mxUtils.write(d,mxResources.get("fitToSheetsDown"));I.appendChild(d);S.appendChild(G);S.appendChild(W);S.appendChild(R);O.appendChild(T);O.appendChild(V);O.appendChild(I);N.appendChild(S);N.appendChild(O);m.appendChild(N);g.appendChild(m);f.appendChild(g);g=document.createElement("div");d=document.createElement("div");d.style.fontWeight="bold";d.style.marginBottom=
|
||||
"12px";mxUtils.write(d,mxResources.get("paperSize"));g.appendChild(d);d=document.createElement("div");d.style.marginBottom="12px";var ba=PageSetupDialog.addPageFormatPanel(d,"printdialog",b.editor.graph.pageFormat||mxConstants.PAGE_FORMAT_A4_PORTRAIT);g.appendChild(d);d=document.createElement("span");mxUtils.write(d,mxResources.get("pageScale"));g.appendChild(d);var U=document.createElement("input");U.style.cssText="margin:0 8px 0 8px;";U.setAttribute("value","100 %");U.style.width="60px";g.appendChild(U);
|
||||
f.appendChild(g);d=document.createElement("div");d.style.cssText="text-align:right;margin:62px 0 0 0;";g=mxUtils.button(mxResources.get("cancel"),function(){b.hideDialog()});g.className="geBtn";b.editor.cancelFirst&&d.appendChild(g);b.isOffline()||(x=mxUtils.button(mxResources.get("help"),function(){l.openLink("https://desk.draw.io/support/solutions/articles/16000048947")}),x.className="geBtn",d.appendChild(x));PrintDialog.previewEnabled&&(x=mxUtils.button(mxResources.get("preview"),function(){b.hideDialog();
|
||||
c(!1)}),x.className="geBtn",d.appendChild(x));x=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){b.hideDialog();c(!0)});x.className="geBtn gePrimaryBtn";d.appendChild(x);b.editor.cancelFirst||d.appendChild(g);f.appendChild(d);this.container=f};var w=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=
|
||||
f.appendChild(g);d=document.createElement("div");d.style.cssText="text-align:right;margin:62px 0 0 0;";g=mxUtils.button(mxResources.get("cancel"),function(){b.hideDialog()});g.className="geBtn";b.editor.cancelFirst&&d.appendChild(g);b.isOffline()||(m=mxUtils.button(mxResources.get("help"),function(){l.openLink("https://desk.draw.io/support/solutions/articles/16000048947")}),m.className="geBtn",d.appendChild(m));PrintDialog.previewEnabled&&(m=mxUtils.button(mxResources.get("preview"),function(){b.hideDialog();
|
||||
c(!1)}),m.className="geBtn",d.appendChild(m));m=mxUtils.button(mxResources.get(PrintDialog.previewEnabled?"print":"ok"),function(){b.hideDialog();c(!0)});m.className="geBtn gePrimaryBtn";d.appendChild(m);b.editor.cancelFirst||d.appendChild(g);f.appendChild(d);this.container=f};var w=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)):(w.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))}})();
|
||||
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,f,c){c.ui=a.ui;return f};a.afterDecode=function(a,f,c){c.previousColor=c.color;c.previousImage=c.image;c.previousFormat=c.format;null!=c.foldingEnabled&&(c.foldingEnabled=!c.foldingEnabled);null!=c.mathEnabled&&(c.mathEnabled=!c.mathEnabled);null!=c.shadowVisible&&(c.shadowVisible=!c.shadowVisible);return c};mxCodecRegistry.register(a)})();(function(){EditorUi.VERSION="8.8.6";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname)&&"support.draw.io"!=window.location.hostname;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.prototype.emptyDiagramXml='<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/></root></mxGraphModel>';
|
||||
(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,f,c){c.ui=a.ui;return f};a.afterDecode=function(a,f,c){c.previousColor=c.color;c.previousImage=c.image;c.previousFormat=c.format;null!=c.foldingEnabled&&(c.foldingEnabled=!c.foldingEnabled);null!=c.mathEnabled&&(c.mathEnabled=!c.mathEnabled);null!=c.shadowVisible&&(c.shadowVisible=!c.shadowVisible);return c};mxCodecRegistry.register(a)})();(function(){EditorUi.VERSION="8.8.7";EditorUi.compactUi="atlas"!=uiTheme;EditorUi.enableLogging=/.*\.draw\.io$/.test(window.location.hostname)&&"support.draw.io"!=window.location.hostname;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.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.sidebarFooterHeight=36;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.currentFile=null;EditorUi.prototype.printPdfExport=
|
||||
!1;EditorUi.prototype.pdfPageExport=!0;EditorUi.prototype.formatEnabled="0"!=urlParams.format;EditorUi.prototype.closableScratchpad=!0;(function(){EditorUi.prototype.useCanvasForExport=!1;EditorUi.prototype.jpgSupported=!1;try{var b=document.createElement("canvas");EditorUi.prototype.canvasSupported=!(!b.getContext||!b.getContext("2d"))}catch(u){}try{var a=document.createElement("canvas"),c=new Image;c.onload=function(){try{a.getContext("2d").drawImage(c,0,0);var b=a.toDataURL("image/png");EditorUi.prototype.useCanvasForExport=
|
||||
|
@ -7286,10 +7287,10 @@ w:c.width,h:c.height};null!=k&&(b.title=k);a.push(b);z(e);null!=d&&null!=d.paren
|
|||
c.y-=n.view.translate.y;D(a,c)}mxEvent.consume(b)});g.style.border="3px solid transparent";mxEvent.addGestureListeners(g,function(){},mxUtils.bind(this,function(b){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="hidden",null!=d?d.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)",g.style.cursor="copy",n.panningManager.stop(),n.autoScroll=!1,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!1),
|
||||
null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="hidden"),mxEvent.consume(b))}),mxUtils.bind(this,function(b){n.isMouseDown&&null!=n.panningManager&&null!=n.graphHandler&&(g.style.border="3px solid transparent",null!=d&&(d.style.border="3px dotted lightGray"),g.style.cursor="default",this.sidebar.showTooltips=!0,n.panningManager.stop(),n.graphHandler.reset(),n.isMouseDown=!1,n.autoScroll=!0,L(b),mxEvent.consume(b))}));mxEvent.addListener(g,"mouseleave",mxUtils.bind(this,function(b){n.isMouseDown&&
|
||||
null!=n.graphHandler.shape&&(n.graphHandler.shape.node.style.visibility="visible",g.style.border="3px solid transparent",g.style.cursor="",n.autoScroll=!0,null!=n.graphHandler.guide&&n.graphHandler.guide.setVisible(!0),null!=n.graphHandler.hint&&(n.graphHandler.hint.style.visibility="visible"),null!=d&&(d.style.border="3px dotted lightGray"))}));Graph.fileSupport&&(mxEvent.addListener(g,"dragover",mxUtils.bind(this,function(b){null!=d?d.style.border="3px dotted rgb(254, 137, 12)":g.style.border="3px dotted rgb(254, 137, 12)";
|
||||
b.dataTransfer.dropEffect="copy";g.style.cursor="copy";this.sidebar.hideTooltip();b.stopPropagation();b.preventDefault()})),mxEvent.addListener(g,"drop",mxUtils.bind(this,function(b){g.style.border="3px solid transparent";g.style.cursor="";null!=d&&(d.style.border="3px dotted lightGray");0<b.dataTransfer.files.length&&this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,e,k,l,q,v,w,u,t){if(null!=c&&"image/"==e.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+
|
||||
this.convertDataUri(c),c=[new mxCell("",new mxGeometry(0,0,q,v),c)],c[0].vertex=!0,D(c,new mxRectangle(0,0,q,v),b,mxEvent.isAltDown(b)?null:w.substring(0,w.lastIndexOf(".")).replace(/_/g," ")),null!=d&&null!=d.parentNode&&0<a.length&&(d.parentNode.removeChild(d),d=null);else{var h=!1,m=mxUtils.bind(this,function(c,e){if(null!=c&&"text/xml"==e){var k=mxUtils.parseXml(c);if("mxlibrary"==k.documentElement.nodeName)try{var l=JSON.parse(mxUtils.getTextContent(k.documentElement));f(l,g);a=a.concat(l);z(b);
|
||||
this.spinner.stop();h=!0}catch(U){}else if("mxfile"==k.documentElement.nodeName)try{for(var q=k.documentElement.getElementsByTagName("diagram"),k=0;k<q.length;k++){var l=mxUtils.getTextContent(q[k]),v=this.stringToCells(this.editor.graph.decompress(l)),w=this.editor.graph.getBoundingBoxFromGeometry(v);D(v,new mxRectangle(0,0,w.width,w.height),b)}h=!0}catch(U){null!=window.console&&console.log("error in drop handler:",U)}}h||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));
|
||||
null!=d&&null!=d.parentNode&&0<a.length&&(d.parentNode.removeChild(d),d=null)});null!=t&&null!=w&&(/(\.vsdx?)($|\?)/i.test(w)||/(\.vssx)($|\?)/i.test(w))?this.importVisio(t,function(b){m(b,"text/xml")},null,w):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,w)&&null!=t?this.parseFile(t,mxUtils.bind(this,function(b){4==b.readyState&&(this.spinner.stop(),200<=b.status&&299>=b.status?m(b.responseText,"text/xml"):this.handleError({message:mxResources.get(413==b.status?"drawingTooLarge":
|
||||
b.dataTransfer.dropEffect="copy";g.style.cursor="copy";this.sidebar.hideTooltip();b.stopPropagation();b.preventDefault()})),mxEvent.addListener(g,"drop",mxUtils.bind(this,function(b){g.style.border="3px solid transparent";g.style.cursor="";null!=d&&(d.style.border="3px dotted lightGray");0<b.dataTransfer.files.length&&this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,mxUtils.bind(this,function(c,e,k,l,q,v,w,u,h){if(null!=c&&"image/"==e.substring(0,6))c="shape=image;verticalLabelPosition=bottom;verticalAlign=top;aspect=fixed;image="+
|
||||
this.convertDataUri(c),c=[new mxCell("",new mxGeometry(0,0,q,v),c)],c[0].vertex=!0,D(c,new mxRectangle(0,0,q,v),b,mxEvent.isAltDown(b)?null:w.substring(0,w.lastIndexOf(".")).replace(/_/g," ")),null!=d&&null!=d.parentNode&&0<a.length&&(d.parentNode.removeChild(d),d=null);else{var t=!1,m=mxUtils.bind(this,function(c,e){if(null!=c&&"text/xml"==e){var k=mxUtils.parseXml(c);if("mxlibrary"==k.documentElement.nodeName)try{var l=JSON.parse(mxUtils.getTextContent(k.documentElement));f(l,g);a=a.concat(l);z(b);
|
||||
this.spinner.stop();t=!0}catch(U){}else if("mxfile"==k.documentElement.nodeName)try{for(var q=k.documentElement.getElementsByTagName("diagram"),k=0;k<q.length;k++){var l=mxUtils.getTextContent(q[k]),v=this.stringToCells(this.editor.graph.decompress(l)),w=this.editor.graph.getBoundingBoxFromGeometry(v);D(v,new mxRectangle(0,0,w.width,w.height),b)}t=!0}catch(U){null!=window.console&&console.log("error in drop handler:",U)}}t||(this.spinner.stop(),this.handleError({message:mxResources.get("errorLoadingFile")}));
|
||||
null!=d&&null!=d.parentNode&&0<a.length&&(d.parentNode.removeChild(d),d=null)});null!=h&&null!=w&&(/(\.vsdx?)($|\?)/i.test(w)||/(\.vssx)($|\?)/i.test(w))?this.importVisio(h,function(b){m(b,"text/xml")},null,w):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(c,w)&&null!=h?this.parseFile(h,mxUtils.bind(this,function(b){4==b.readyState&&(this.spinner.stop(),200<=b.status&&299>=b.status?m(b.responseText,"text/xml"):this.handleError({message:mxResources.get(413==b.status?"drawingTooLarge":
|
||||
"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))})):m(c,e)}}));b.stopPropagation();b.preventDefault()})),mxEvent.addListener(g,"dragleave",function(b){null!=d?d.style.border="3px dotted lightGray":(g.style.border="3px solid transparent",g.style.cursor="");b.stopPropagation();b.preventDefault()}));v=v.cloneNode(!1);v.setAttribute("src",Editor.editImage);v.setAttribute("title",mxResources.get("edit"));k.insertBefore(v,k.firstChild);mxEvent.addListener(v,"click",K);mxEvent.addListener(g,
|
||||
"dblclick",function(b){mxEvent.getSource(b)==g&&K(b)});c=v.cloneNode(!1);c.setAttribute("src",Editor.plusImage);c.setAttribute("title",mxResources.get("add"));k.insertBefore(c,k.firstChild);mxEvent.addListener(c,"click",L);this.isOffline()||".scratchpad"!=b.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;",mxUtils.write(c,"?"),mxEvent.addGestureListeners(c,
|
||||
mxUtils.bind(this,function(b){this.openLink(EditorUi.scratchpadHelpLink);mxEvent.consume(b)})),k.insertBefore(c,k.firstChild))}h.appendChild(k);h.style.paddingRight=18*k.childNodes.length+"px"}};"1"==urlParams.offline||EditorUi.isElectronApp?EditorUi.prototype.footerHeight=4:("1"==urlParams.savesidebar&&(Sidebar.prototype.thumbWidth=64,Sidebar.prototype.thumbHeight=64),EditorUi.prototype.footerHeight=760<=screen.width&&240<=screen.height?46:0,EditorUi.prototype.createFooter=function(){var b=document.getElementById("geFooter");
|
||||
|
@ -7318,12 +7319,12 @@ this.exportDialog=null)});if(null!=this.exportDialog)c.apply(this);else{this.exp
|
|||
"4px 2px 4px 2px";this.exportDialog.style.color="#ffffff";mxUtils.setOpacity(this.exportDialog,70);this.exportDialog.style.left=e.left+"px";this.exportDialog.style.bottom=parseInt(this.chromelessToolbar.style.bottom)+this.chromelessToolbar.offsetHeight+4+"px";e=mxUtils.getCurrentStyle(this.editor.graph.container);this.exportDialog.style.zIndex=e.zIndex;var d=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});d.spin(this.exportDialog);
|
||||
this.exportToCanvas(mxUtils.bind(this,function(b){d.stop();this.exportDialog.style.width="auto";this.exportDialog.style.height="auto";this.exportDialog.style.padding="10px";var a=this.createImageDataUri(b,null,"png");b=document.createElement("img");b.style.maxWidth="140px";b.style.maxHeight="140px";b.style.cursor="pointer";b.setAttribute("title",mxResources.get("openInNewWindow"));b.setAttribute("border","0");b.setAttribute("src",a);this.exportDialog.appendChild(b);mxEvent.addListener(b,"click",mxUtils.bind(this,
|
||||
function(){this.openInNewWindow(a.substring(a.indexOf(",")+1),"image/png",!0);c.apply(this,arguments)}))}),null,this.thumbImageCache,null,mxUtils.bind(this,function(b){this.spinner.stop();this.handleError(b)}));mxEvent.addListener(this.editor.graph.container,"click",c);document.body.appendChild(this.exportDialog)}mxEvent.consume(b)}),Editor.cameraLargeImage,mxResources.get("export"))}d.apply(this,arguments)};EditorUi.prototype.saveData=function(b,a,c,d,f){this.isLocalFileSave()?this.saveLocalFile(c,
|
||||
b,d,f,a):this.saveRequest(b,a,mxUtils.bind(this,function(b,e){return this.createEchoRequest(c,b,d,f,a,e)}),c,f,d)};EditorUi.prototype.saveRequest=function(b,a,c,d,f,g,w){w=null!=w?w:!mxClient.IS_IOS||!navigator.standalone;var e=this.getServiceCount(!1);b=new CreateDialog(this,b,mxUtils.bind(this,function(b,e){if("_blank"==e||null!=b&&0<b.length){var k=c("_blank"==e?null:b,e==App.MODE_DEVICE||"download"==e||null==e||"_blank"==e?"0":"1");null!=k&&(e==App.MODE_DEVICE||"download"==e||"_blank"==e?k.simulate(document,
|
||||
b,d,f,a):this.saveRequest(b,a,mxUtils.bind(this,function(b,e){return this.createEchoRequest(c,b,d,f,a,e)}),c,f,d)};EditorUi.prototype.saveRequest=function(b,a,c,d,f,g,h){h=null!=h?h:!mxClient.IS_IOS||!navigator.standalone;var e=this.getServiceCount(!1);b=new CreateDialog(this,b,mxUtils.bind(this,function(b,e){if("_blank"==e||null!=b&&0<b.length){var k=c("_blank"==e?null:b,e==App.MODE_DEVICE||"download"==e||null==e||"_blank"==e?"0":"1");null!=k&&(e==App.MODE_DEVICE||"download"==e||"_blank"==e?k.simulate(document,
|
||||
"_blank"):this.pickFolder(e,mxUtils.bind(this,function(c){g=null!=g?g:"pdf"==a?"application/pdf":"image/"+a;if(null!=d)try{this.exportFile(d,b,g,!0,e,c)}catch(C){this.handleError(C)}else this.spinner.spin(document.body,mxResources.get("saving"))&&k.send(mxUtils.bind(this,function(){this.spinner.stop();if(200<=k.getStatus()&&299>=k.getStatus())try{this.exportFile(k.getText(),b,g,!0,e,c)}catch(C){this.handleError(C)}else this.handleError({message:mxResources.get("errorSavingFile")})}),function(b){this.spinner.stop();
|
||||
this.handleError(b)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,w,null,1<e,4<e?3:4,d,g,f);this.showDialog(b.container,380,e==(mxClient.IS_IOS?0:1)?160:4<e?390:270,!0,!0);b.init()};EditorUi.prototype.getEditBlankXml=function(){return this.getFileData(!0)};EditorUi.prototype.exportFile=function(b,a,c,d,f,g){};EditorUi.prototype.pickFolder=function(b,a,c){a(null)};EditorUi.prototype.exportSvg=function(b,a,c,d,f,g,w,h,m){if(this.spinner.spin(document.body,
|
||||
mxResources.get("export"))){var e=this.editor.graph.isSelectionEmpty();c=null!=c?c:e;e=a?null:this.editor.graph.background;e==mxConstants.NONE&&(e=null);null==e&&0==a&&(e="#ffffff");var l=this.editor.graph.getSvg(e,b,w,h,null,c);d&&this.editor.graph.addSvgShadow(l);var q=this.getBaseFilename()+".svg",u=mxUtils.bind(this,function(b){this.spinner.stop();f&&b.setAttribute("content",this.getFileData(!0,null,null,null,c,m));if(null!=this.editor.fontCss){var a=b.ownerDocument,a=null!=a.createElementNS?
|
||||
this.handleError(b)})})))}}),mxUtils.bind(this,function(){this.hideDialog()}),mxResources.get("saveAs"),mxResources.get("download"),!1,!1,h,null,1<e,4<e?3:4,d,g,f);this.showDialog(b.container,380,e==(mxClient.IS_IOS?0:1)?160:4<e?390:270,!0,!0);b.init()};EditorUi.prototype.getEditBlankXml=function(){return this.getFileData(!0)};EditorUi.prototype.exportFile=function(b,a,c,d,f,g){};EditorUi.prototype.pickFolder=function(b,a,c){a(null)};EditorUi.prototype.exportSvg=function(b,a,c,d,f,g,h,m,n){if(this.spinner.spin(document.body,
|
||||
mxResources.get("export"))){var e=this.editor.graph.isSelectionEmpty();c=null!=c?c:e;e=a?null:this.editor.graph.background;e==mxConstants.NONE&&(e=null);null==e&&0==a&&(e="#ffffff");var l=this.editor.graph.getSvg(e,b,h,m,null,c);d&&this.editor.graph.addSvgShadow(l);var q=this.getBaseFilename()+".svg",w=mxUtils.bind(this,function(b){this.spinner.stop();f&&b.setAttribute("content",this.getFileData(!0,null,null,null,c,n));if(null!=this.editor.fontCss){var a=b.ownerDocument,a=null!=a.createElementNS?
|
||||
a.createElementNS(mxConstants.NS_SVG,"style"):a.createElement("style");a.setAttribute("type","text/css");mxUtils.setTextContent(a,this.editor.fontCss);b.getElementsByTagName("defs")[0].appendChild(a)}var e='<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">\n'+mxUtils.getXml(b);this.isLocalFileSave()||e.length<=MAX_REQUEST_SIZE?this.saveData(q,"svg",e,"image/svg+xml"):this.handleError({message:mxResources.get("drawingTooLarge")},mxResources.get("error"),
|
||||
mxUtils.bind(this,function(){mxUtils.popup(e)}))});this.convertMath(this.editor.graph,l,!1,mxUtils.bind(this,function(){g?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(l,u,this.thumbImageCache)):u(l)}))}};EditorUi.prototype.addCheckbox=function(b,a,c,d,f,g){g=null!=g?g:!0;var e=document.createElement("input");e.style.marginRight="8px";e.style.marginTop="16px";e.setAttribute("type","checkbox");c&&(e.setAttribute("checked","checked"),e.defaultChecked=!0);d&&e.setAttribute("disabled",
|
||||
mxUtils.bind(this,function(){mxUtils.popup(e)}))});this.convertMath(this.editor.graph,l,!1,mxUtils.bind(this,function(){g?(null==this.thumbImageCache&&(this.thumbImageCache={}),this.convertImages(l,w,this.thumbImageCache)):w(l)}))}};EditorUi.prototype.addCheckbox=function(b,a,c,d,f,g){g=null!=g?g:!0;var e=document.createElement("input");e.style.marginRight="8px";e.style.marginTop="16px";e.setAttribute("type","checkbox");c&&(e.setAttribute("checked","checked"),e.defaultChecked=!0);d&&e.setAttribute("disabled",
|
||||
"disabled");g&&(b.appendChild(e),c=document.createElement("span"),mxUtils.write(c,a),b.appendChild(c),f||mxUtils.br(b),mxEvent.addListener(c,"click",mxUtils.bind(this,function(b){"disabled"!=e.getAttribute("disabled")&&(e.checked=!e.checked,mxEvent.consume(b))})));return e};EditorUi.prototype.addEditButton=function(b,a){var c=this.addCheckbox(b,mxResources.get("edit")+":",!0,null,!0);c.style.marginLeft="24px";var e=this.getCurrentFile(),d="";null!=e&&e.getMode()!=App.MODE_DEVICE&&e.getMode()!=App.MODE_BROWSER&&
|
||||
(d=window.location.href);var f=document.createElement("select");f.style.width="120px";f.style.marginLeft="8px";f.style.marginRight="10px";f.className="geBtn";e=document.createElement("option");e.setAttribute("value","blank");mxUtils.write(e,mxResources.get("makeCopy"));f.appendChild(e);e=document.createElement("option");e.setAttribute("value","custom");mxUtils.write(e,mxResources.get("custom")+"...");f.appendChild(e);b.appendChild(f);mxEvent.addListener(f,"change",mxUtils.bind(this,function(){if("custom"==
|
||||
f.value){var b=new FilenameDialog(this,d,mxResources.get("ok"),function(b){null!=b?d=b:f.value="blank"},mxResources.get("url"),null,null,null,null,function(){f.value="blank"});this.showDialog(b.container,300,80,!0,!1);b.init()}}));mxEvent.addListener(c,"change",mxUtils.bind(this,function(){c.checked&&(null==a||a.checked)?f.removeAttribute("disabled"):f.setAttribute("disabled","disabled")}));mxUtils.br(b);return{getLink:function(){return c.checked?"blank"===f.value?"_blank":d:null},getEditInput:function(){return c},
|
||||
|
@ -7343,19 +7344,19 @@ L.getEditSelect().removeAttribute("disabled"):L.getEditSelect().setAttribute("di
|
|||
mxUtils.write(l,b||mxResources.get("link"));l.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:12px";e.appendChild(l);var q=this.getCurrentFile(),l="https://desk.draw.io/support/solutions/articles/16000051941";b=0;if(null!=q&&q.constructor==window.DriveFile&&!a){b=80;var l="https://desk.draw.io/support/solutions/articles/16000039384",k=document.createElement("div");k.style.cssText="border-bottom:1px solid lightGray;padding-bottom:14px;padding-top:6px;margin-bottom:14px;text-align:center;";
|
||||
var v=document.createElement("div");v.style.whiteSpace="normal";mxUtils.write(v,mxResources.get("linkAccountRequired"));k.appendChild(v);v=mxUtils.button(mxResources.get("share"),mxUtils.bind(this,function(){this.drive.showPermissions(q.getId())}));v.style.marginTop="12px";v.className="geBtn";k.appendChild(v);e.appendChild(k);v=document.createElement("a");v.style.paddingLeft="12px";v.style.color="gray";v.style.fontSize="11px";v.setAttribute("href","javascript:void(0);");mxUtils.write(v,mxResources.get("check"));
|
||||
k.appendChild(v);mxEvent.addListener(v,"click",mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("loading"))&&this.getPublicUrl(this.getCurrentFile(),mxUtils.bind(this,function(b){this.spinner.stop();b=new ErrorDialog(this,null,mxResources.get(null!=b?"diagramIsPublic":"diagramIsNotPublic"),mxResources.get("ok"));this.showDialog(b.container,300,80,!0,!1);b.init()}))}))}var h=null,m=null;if(null!=c||null!=d)b+=30,mxUtils.write(e,mxResources.get("width")+":"),h=document.createElement("input"),
|
||||
h.setAttribute("type","text"),h.style.marginRight="16px",h.style.width="50px",h.style.marginLeft="6px",h.style.marginRight="16px",h.style.marginBottom="10px",h.value="100%",e.appendChild(h),mxUtils.write(e,mxResources.get("height")+":"),m=document.createElement("input"),m.setAttribute("type","text"),m.style.width="50px",m.style.marginLeft="6px",m.style.marginBottom="10px",m.value=d+"px",e.appendChild(m),mxUtils.br(e);var u=this.addLinkSection(e,g);c=null!=this.pages&&1<this.pages.length;var n=null;
|
||||
if(null==q||q.constructor!=window.DriveFile||a)n=this.addCheckbox(e,mxResources.get("allPages"),c,!c);var t=this.addCheckbox(e,mxResources.get("lightbox"),!0),p=this.addEditButton(e,t),L=p.getEditInput(),B=this.addCheckbox(e,mxResources.get("layers"),!0);B.style.marginLeft=L.style.marginLeft;B.style.marginBottom="16px";B.style.marginTop="8px";mxEvent.addListener(t,"change",function(){t.checked?(B.removeAttribute("disabled"),L.removeAttribute("disabled")):(B.setAttribute("disabled","disabled"),L.setAttribute("disabled",
|
||||
"disabled"));L.checked&&t.checked?p.getEditSelect().removeAttribute("disabled"):p.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){f(u.getTarget(),u.getColor(),null==n?!0:n.checked,t.checked,p.getLink(),B.checked,null!=h?h.value:null,null!=m?m.value:null)}),null,mxResources.get("create"),l);this.showDialog(a.container,340,254+b,!0,!0);null!=h?(h.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?h.select():
|
||||
document.execCommand("selectAll",!1,null)):u.focus()};EditorUi.prototype.showRemoteExportDialog=function(b,a,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(f);var g=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),l=d?null:this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),
|
||||
!0),f=this.editor.graph,q=d?null:this.addCheckbox(e,mxResources.get("transparentBackground"),f.background==mxConstants.NONE||null==f.background);null!=q&&(q.style.marginBottom="16px");b=new CustomDialog(this,e,mxUtils.bind(this,function(){c(!g.checked,null!=l?l.checked:!1,null!=q?q.checked:!1)}),null,b,a);this.showDialog(b.container,300,d?100:186,!0,!0)};EditorUi.prototype.showExportDialog=function(b,a,c,d,f,g,h,m){h=null!=h?h:!0;var e=document.createElement("div");e.style.whiteSpace="nowrap";var k=
|
||||
h.setAttribute("type","text"),h.style.marginRight="16px",h.style.width="50px",h.style.marginLeft="6px",h.style.marginRight="16px",h.style.marginBottom="10px",h.value="100%",e.appendChild(h),mxUtils.write(e,mxResources.get("height")+":"),m=document.createElement("input"),m.setAttribute("type","text"),m.style.width="50px",m.style.marginLeft="6px",m.style.marginBottom="10px",m.value=d+"px",e.appendChild(m),mxUtils.br(e);var n=this.addLinkSection(e,g);c=null!=this.pages&&1<this.pages.length;var u=null;
|
||||
if(null==q||q.constructor!=window.DriveFile||a)u=this.addCheckbox(e,mxResources.get("allPages"),c,!c);var t=this.addCheckbox(e,mxResources.get("lightbox"),!0),p=this.addEditButton(e,t),L=p.getEditInput(),B=this.addCheckbox(e,mxResources.get("layers"),!0);B.style.marginLeft=L.style.marginLeft;B.style.marginBottom="16px";B.style.marginTop="8px";mxEvent.addListener(t,"change",function(){t.checked?(B.removeAttribute("disabled"),L.removeAttribute("disabled")):(B.setAttribute("disabled","disabled"),L.setAttribute("disabled",
|
||||
"disabled"));L.checked&&t.checked?p.getEditSelect().removeAttribute("disabled"):p.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){f(n.getTarget(),n.getColor(),null==u?!0:u.checked,t.checked,p.getLink(),B.checked,null!=h?h.value:null,null!=m?m.value:null)}),null,mxResources.get("create"),l);this.showDialog(a.container,340,254+b,!0,!0);null!=h?(h.focus(),mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||mxClient.IS_QUIRKS?h.select():
|
||||
document.execCommand("selectAll",!1,null)):n.focus()};EditorUi.prototype.showRemoteExportDialog=function(b,a,c,d){var e=document.createElement("div");e.style.whiteSpace="nowrap";var f=document.createElement("h3");mxUtils.write(f,mxResources.get("image"));f.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(f);var g=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,this.editor.graph.isSelectionEmpty()),l=d?null:this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),
|
||||
!0),f=this.editor.graph,h=d?null:this.addCheckbox(e,mxResources.get("transparentBackground"),f.background==mxConstants.NONE||null==f.background);null!=h&&(h.style.marginBottom="16px");b=new CustomDialog(this,e,mxUtils.bind(this,function(){c(!g.checked,null!=l?l.checked:!1,null!=h?h.checked:!1)}),null,b,a);this.showDialog(b.container,300,d?100:186,!0,!0)};EditorUi.prototype.showExportDialog=function(b,a,c,d,f,g,h,m){h=null!=h?h:!0;var e=document.createElement("div");e.style.whiteSpace="nowrap";var k=
|
||||
this.editor.graph,l="jpeg"==m?196:300,q=document.createElement("h3");mxUtils.write(q,b);q.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:10px";e.appendChild(q);mxUtils.write(e,mxResources.get("zoom")+":");var w=document.createElement("input");w.setAttribute("type","text");w.style.marginRight="16px";w.style.width="60px";w.style.marginLeft="4px";w.style.marginRight="12px";w.value=this.lastExportZoom||"100%";e.appendChild(w);mxUtils.write(e,mxResources.get("borderWidth")+":");
|
||||
var n=document.createElement("input");n.setAttribute("type","text");n.style.marginRight="16px";n.style.width="60px";n.style.marginLeft="4px";n.value=this.lastExportBorder||"0";e.appendChild(n);mxUtils.br(e);var u=this.addCheckbox(e,mxResources.get("transparentBackground"),k.background==mxConstants.NONE||null==k.background,null,null,"jpeg"!=m),t=this.addCheckbox(e,mxResources.get("selectionOnly"),!1,k.isSelectionEmpty()),p=document.createElement("input");p.style.marginTop="16px";p.style.marginRight=
|
||||
"8px";p.style.marginLeft="24px";p.setAttribute("disabled","disabled");p.setAttribute("type","checkbox");g&&(e.appendChild(p),mxUtils.write(e,mxResources.get("crop")),mxUtils.br(e),l+=26,mxEvent.addListener(t,"change",function(){t.checked?p.removeAttribute("disabled"):p.setAttribute("disabled","disabled")}));k.isSelectionEmpty()||(p.setAttribute("checked","checked"),p.defaultChecked=!0);var x=this.addCheckbox(e,mxResources.get("shadow"),k.shadowVisible),B=document.createElement("input");B.style.marginTop=
|
||||
"16px";B.style.marginRight="8px";B.setAttribute("type","checkbox");!this.isOffline()&&this.canvasSupported||B.setAttribute("disabled","disabled");a&&(e.appendChild(B),mxUtils.write(e,mxResources.get("embedImages")),mxUtils.br(e),l+=26);var H=this.addCheckbox(e,mxResources.get("includeCopyOfMyDiagram"),h,null,null,"jpeg"!=m),E=null!=this.pages&&1<this.pages.length,J=this.addCheckbox(e,E?mxResources.get("allPages"):"",E,!E,null,"jpeg"!=m);J.style.marginLeft="24px";J.style.marginBottom="16px";E||(J.style.visibility=
|
||||
"hidden");mxEvent.addListener(H,"change",function(){H.checked&&E?J.removeAttribute("disabled"):J.setAttribute("disabled","disabled")});h&&E||J.setAttribute("disabled","disabled");b=new CustomDialog(this,e,mxUtils.bind(this,function(){this.lastExportBorder=n.value;this.lastExportZoom=w.value;f(w.value,u.checked,!t.checked,x.checked,H.checked,B.checked,n.value,p.checked,!J.checked)}),null,c,d);this.showDialog(b.container,340,l,!0,!0);w.focus();mxClient.IS_GC||mxClient.IS_FF||5<=document.documentMode||
|
||||
mxClient.IS_QUIRKS?w.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(b,a,c,d,f){var e=document.createElement("div");e.style.whiteSpace="nowrap";var g=this.editor.graph;if(null!=a){var l=document.createElement("h3");mxUtils.write(l,a);l.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(l)}var q=this.addCheckbox(e,mxResources.get("fit"),!0),k=this.addCheckbox(e,mxResources.get("shadow"),g.shadowVisible&&d,
|
||||
!d),v=this.addCheckbox(e,c),h=this.addCheckbox(e,mxResources.get("lightbox"),!0),m=this.addEditButton(e,h),n=m.getEditInput(),u=1<g.model.getChildCount(g.model.getRoot()),p=this.addCheckbox(e,mxResources.get("layers"),u,!u);p.style.marginLeft=n.style.marginLeft;p.style.marginBottom="12px";p.style.marginTop="8px";mxEvent.addListener(h,"change",function(){h.checked?(u&&p.removeAttribute("disabled"),n.removeAttribute("disabled")):(p.setAttribute("disabled","disabled"),n.setAttribute("disabled","disabled"));
|
||||
n.checked&&h.checked?m.getEditSelect().removeAttribute("disabled"):m.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){b(q.checked,k.checked,v.checked,h.checked,m.getLink(),p.checked)}),null,mxResources.get("embed"),f);this.showDialog(a.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(b,a,c,d,f,g,h,m){function e(a){var e=" ",l="";d&&(e=" 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('https://www.draw.io/?client=1&lightbox=1"+
|
||||
mxClient.IS_QUIRKS?w.select():document.execCommand("selectAll",!1,null)};EditorUi.prototype.showEmbedImageDialog=function(b,a,c,d,f){var e=document.createElement("div");e.style.whiteSpace="nowrap";var g=this.editor.graph;if(null!=a){var l=document.createElement("h3");mxUtils.write(l,a);l.style.cssText="width:100%;text-align:center;margin-top:0px;margin-bottom:4px";e.appendChild(l)}var h=this.addCheckbox(e,mxResources.get("fit"),!0),k=this.addCheckbox(e,mxResources.get("shadow"),g.shadowVisible&&d,
|
||||
!d),v=this.addCheckbox(e,c),q=this.addCheckbox(e,mxResources.get("lightbox"),!0),m=this.addEditButton(e,q),n=m.getEditInput(),u=1<g.model.getChildCount(g.model.getRoot()),p=this.addCheckbox(e,mxResources.get("layers"),u,!u);p.style.marginLeft=n.style.marginLeft;p.style.marginBottom="12px";p.style.marginTop="8px";mxEvent.addListener(q,"change",function(){q.checked?(u&&p.removeAttribute("disabled"),n.removeAttribute("disabled")):(p.setAttribute("disabled","disabled"),n.setAttribute("disabled","disabled"));
|
||||
n.checked&&q.checked?m.getEditSelect().removeAttribute("disabled"):m.getEditSelect().setAttribute("disabled","disabled")});a=new CustomDialog(this,e,mxUtils.bind(this,function(){b(h.checked,k.checked,v.checked,q.checked,m.getLink(),p.checked)}),null,mxResources.get("embed"),f);this.showDialog(a.container,280,280,!0,!0)};EditorUi.prototype.createEmbedImage=function(b,a,c,d,f,g,h,m){function e(a){var e=" ",l="";d&&(e=" 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('https://www.draw.io/?client=1&lightbox=1"+
|
||||
(f?"&edit=_blank":"")+(g?"&layers=1":"")+"');}})(this);\"",l+="cursor:pointer;");b&&(l+="max-width:100%;");var v="";c&&(v=' width="'+Math.round(k.width)+'" height="'+Math.round(k.height)+'"');h('<img src="'+a+'"'+v+(""!=l?' style="'+l+'"':"")+e+"/>")}var k=this.editor.graph.getGraphBounds();if(this.isExportToCanvas())this.exportToCanvas(mxUtils.bind(this,function(b){var a=d?this.getFileData(!0):null;b=this.createImageDataUri(b,a,"png");e(b)}),null,null,null,mxUtils.bind(this,function(b){m({message:mxResources.get("unknownError")})}),
|
||||
null,!0,c?2:1,null,a);else if(a=this.getFileData(!0),k.width*k.height<=MAX_AREA&&a.length<=MAX_REQUEST_SIZE){var l="";c&&(l="&w="+Math.round(2*k.width)+"&h="+Math.round(2*k.height));var q=new mxXmlRequest(EXPORT_URL,"format=png&base64=1&embedXml="+(d?"1":"0")+l+"&xml="+encodeURIComponent(a));q.send(mxUtils.bind(this,function(){200<=q.getStatus()&&299>=q.getStatus()?e("data:image/png;base64,"+q.getText()):m({message:mxResources.get("unknownError")})}))}else m({message:mxResources.get("drawingTooLarge")})};
|
||||
EditorUi.prototype.createEmbedSvg=function(b,a,c,d,f,g,h){var e=this.editor.graph.getSvg(),l=e.getElementsByTagName("a");if(null!=l)for(var k=0;k<l.length;k++){var v=l[k].getAttribute("href");null!=v&&"#"==v.charAt(0)&&"_blank"==l[k].getAttribute("target")&&l[k].removeAttribute("target")}d&&e.setAttribute("content",this.getFileData(!0));a&&this.editor.graph.addSvgShadow(e);if(c){var q=" ",m="";d&&(q="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('https://www.draw.io/?client=1&lightbox=1"+
|
||||
|
@ -7388,117 +7389,117 @@ for(a=1;a<b.length;a++)this.insertPage(),this.pasteLucidChart(b[a]);this.selectP
|
|||
a,c,!0))}));else if("data:"==b.substring(0,5)||!this.isOffline()&&(f||/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(b))){var e=this.editor.graph;if("data:image/png;base64,"==b.substring(0,22)){var l=this.extractGraphModelFromPng(b),k=this.importXml(l,a,c,g,!0);if(0<k.length)return k}if("data:image/svg+xml;"==b.substring(0,19))try{if(l=null,"data:image/svg+xml;base64,"==b.substring(0,26)?(l=b.substring(b.indexOf(",")+1),l=window.atob&&!mxClient.IS_SF?atob(l):Base64.decode(l,!0)):l=decodeURIComponent(b.substring(b.indexOf(",")+
|
||||
1)),k=this.importXml(l,a,c,g,!0),0<k.length)return k}catch(v){}this.loadImage(b,mxUtils.bind(this,function(d){if("data:"==b.substring(0,5))this.resizeImage(d,b,mxUtils.bind(this,function(b,d,f){e.setSelectionCell(e.insertVertex(null,null,"",e.snap(a),e.snap(c),d,f,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+this.convertDataUri(b)+";"))}),h,this.maxImageSize);else{var f=Math.min(1,Math.min(this.maxImageSize/d.width,this.maxImageSize/
|
||||
d.height)),k=Math.round(d.width*f);d=Math.round(d.height*f);e.setSelectionCell(e.insertVertex(null,null,"",e.snap(a),e.snap(c),k,d,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+b+";"))}}),mxUtils.bind(this,function(){var f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,b,e.snap(a),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.updateCellSize(f),e.fireEvent(new mxEventObject("textInserted","cells",
|
||||
[f]))}finally{e.getModel().endUpdate()}e.setSelectionCell(f)}))}else{b=this.editor.graph.zapGremlins(mxUtils.trim(b));if(this.isCompatibleString(b))return this.importXml(b,a,c,g);if(0<b.length)if('{"state":"{\\"Properties\\":'==b.substring(0,26))this.importLucidChart(b,a,c,g);else{e=this.editor.graph;f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,"",e.snap(a),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.fireEvent(new mxEventObject("textInserted","cells",[f])),f.value=
|
||||
b,e.updateCellSize(f),/\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(f.value)&&e.setLinkForCell(f,f.value),f.geometry.width+=e.gridSize,f.geometry.height+=e.gridSize}finally{e.getModel().endUpdate()}return[f]}}return[]};EditorUi.prototype.formatFileSize=function(b){var a=-1;do b/=1024,a++;while(1024<b);return Math.max(b,.1).toFixed(1)+
|
||||
" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[a]};EditorUi.prototype.convertDataUri=function(b){if("data:"==b.substring(0,5)){var a=b.indexOf(";");0<a&&(b=b.substring(0,a)+b.substring(b.indexOf(",",a+1)))}return b};EditorUi.prototype.isRemoteFileFormat=function(b,a){return/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(b)};EditorUi.prototype.importLocalFile=function(b,a){if(b&&Graph.fileSupport&&(!mxClient.IS_IE&&!mxClient.IS_IE11||0>navigator.appVersion.indexOf("Windows NT 6.1"))){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.click()}else{window.openNew=!1;window.openKey="import";if(!a){var e=Editor.useLocalStorage;Editor.useLocalStorage=!b}window.openFile=new OpenFile(mxUtils.bind(this,function(b){this.hideDialog(b)}));window.openFile.setConsumer(mxUtils.bind(this,function(b,a){if(null!=a&&Graph.fileSupport&&/(\.vsdx?)($|\?)/i.test(a)){var c=new Blob([b],{type:"application/octet-stream"});
|
||||
this.importVisio(c,mxUtils.bind(this,function(b){this.importXml(b)}),null,a)}else this.editor.graph.setSelectionCells(this.importXml(b))}));this.showDialog((new OpenDialog(this)).container,360,220,!0,!0,function(){window.openFile=null});if(!a){var d=this.dialog,f=d.close;this.dialog.close=mxUtils.bind(this,function(b){Editor.useLocalStorage=e;f.apply(d,arguments);b&&null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.showSplash()})}}};EditorUi.prototype.importFile=function(b,a,c,d,f,g,h,m,n,k,
|
||||
v){k=null!=k?k:!0;var e=!1,l=null,q=mxUtils.bind(this,function(b){var a=null;null!=b&&"<mxlibrary"==b.substring(0,10)?this.loadLibrary(new LocalLibrary(this,b,h)):a=this.importXml(b,c,d,k);null!=m&&m(a)});"image"==a.substring(0,5)?(n=!1,"image/png"==a.substring(0,9)&&(a=v?null:this.extractGraphModelFromPng(b),null!=a&&0<a.length&&(l=this.importXml(a,c,d,k),n=!0)),n||(l=this.editor.graph,a=b.indexOf(";"),0<a&&(b=b.substring(0,a)+b.substring(b.indexOf(",",a+1))),k&&l.isGridEnabled()&&(c=l.snap(c),d=
|
||||
l.snap(d)),l=[l.insertVertex(null,null,"",c,d,f,g,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+b+";")])):/(\.*<graphml )/.test(b)&&"undefined"!==typeof window.mxGraphMlCodec?(new mxGraphMlCodec).decode(b,mxUtils.bind(this,function(b){b=this.importXml(b,c,d,k);null!=m&&m(b)})):null!=n&&null!=h&&(/(\.vsdx?)($|\?)/i.test(h)||/(\.vssx)($|\?)/i.test(h))?(e=!0,this.importVisio(n,q)):!this.isOffline()&&(new XMLHttpRequest).upload&&
|
||||
this.isRemoteFileFormat(b,h)?(e=!0,this.parseFile(null!=n?n:new Blob([b],{type:"application/octet-stream"}),mxUtils.bind(this,function(b){4==b.readyState&&(200<=b.status&&299>=b.status?q(b.responseText):null!=m&&m(null))}),h)):/(\.vsd)($|\?)/i.test(h)||(l=this.insertTextAt(this.validateFileData(b),c,d,!0,null,k));e||null==m||m(l);return l};EditorUi.prototype.base64Encode=function(b){for(var a="",c=0,d=b.length,f,g,h;c<d;){f=b.charCodeAt(c++)&255;if(c==d){a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>
|
||||
2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4);a+="==";break}g=b.charCodeAt(c++);if(c==d){a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(g&240)>>4);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((g&15)<<2);a+="=";break}h=b.charCodeAt(c++);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>
|
||||
2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(g&240)>>4);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((g&15)<<2|(h&192)>>6);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(h&63)}return a};EditorUi.prototype.importFiles=function(b,a,c,d,f,g,h,m,n,k,v,p){a=null!=a?a:0;c=null!=c?c:0;d=null!=d?d:this.maxImageSize;k=null!=k?k:this.maxImageBytes;var e=null!=a&&null!=c,l=!0,q=!1;if(!mxClient.IS_CHROMEAPP&&
|
||||
null!=b)for(var w=v||this.resampleThreshold,t=0;t<b.length;t++)if("image/"==b[t].type.substring(0,6)&&b[t].size>w){q=!0;break}var u=mxUtils.bind(this,function(){var q=this.editor.graph,n=q.gridSize;f=null!=f?f:mxUtils.bind(this,function(b,a,c,d,f,k,g,l,h){return null!=b&&"<mxlibrary"==b.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,b,g)),null):this.importFile(b,a,c,d,f,k,g,l,h,e,p)});g=null!=g?g:mxUtils.bind(this,function(b){q.setSelectionCells(b)});if(this.spinner.spin(document.body,
|
||||
mxResources.get("loading")))for(var w=b.length,t=w,u=[],x=mxUtils.bind(this,function(b,a){u[b]=a;if(0==--t){this.spinner.stop();if(null!=m)m(u);else{var c=[];q.getModel().beginUpdate();try{for(var e=0;e<u.length;e++){var d=u[e]();null!=d&&(c=c.concat(d))}}finally{q.getModel().endUpdate()}}g(c)}}),F=0;F<w;F++)mxUtils.bind(this,function(e){var g=b[e],m=new FileReader;m.onload=mxUtils.bind(this,function(b){if(null==h||h(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var m=
|
||||
b.target.result,w=m.indexOf(","),t=decodeURIComponent(escape(atob(m.substring(w+1)))),u=mxUtils.parseXml(t),t=u.getElementsByTagName("svg");if(0<t.length){var t=t[0],B=p?null:t.getAttribute("content");null!=B&&"<"!=B.charAt(0)&&"%"!=B.charAt(0)&&(B=unescape(window.atob?atob(B):Base64.decode(B,!0)));null!=B&&"%"==B.charAt(0)&&(B=decodeURIComponent(B));null==B||"<mxfile "!==B.substring(0,8)&&"<mxGraphModel "!==B.substring(0,14)?x(e,mxUtils.bind(this,function(){try{if(m.substring(0,w+1),null!=u){var b=
|
||||
u.getElementsByTagName("svg");if(0<b.length){var k=b[0],h=parseFloat(k.getAttribute("width")),v=parseFloat(k.getAttribute("height")),p=k.getAttribute("viewBox");if(null==p||0==p.length)k.setAttribute("viewBox","0 0 "+h+" "+v);else if(isNaN(h)||isNaN(v)){var t=p.split(" ");3<t.length&&(h=parseFloat(t[2]),v=parseFloat(t[3]))}m=this.createSvgDataUri(mxUtils.getXml(k));var B=Math.min(1,Math.min(d/Math.max(1,h)),d/Math.max(1,v)),x=f(m,g.type,a+e*n,c+e*n,Math.max(1,Math.round(h*B)),Math.max(1,Math.round(v*
|
||||
B)),g.name,l);if(isNaN(h)||isNaN(v)){var E=new Image;E.onload=mxUtils.bind(this,function(){h=Math.max(1,E.width);v=Math.max(1,E.height);x[0].geometry.width=h;x[0].geometry.height=v;k.setAttribute("viewBox","0 0 "+h+" "+v);m=this.createSvgDataUri(mxUtils.getXml(k));var b=m.indexOf(";");0<b&&(m=m.substring(0,b)+m.substring(m.indexOf(",",b+1)));q.setCellStyles("image",m,[x[0]])});E.src=this.createSvgDataUri(mxUtils.getXml(k))}return x}}}catch(da){}return null})):x(e,mxUtils.bind(this,function(){return f(B,
|
||||
"text/xml",a+e*n,c+e*n,0,0,g.name)}))}}else{t=!1;if("image/png"==g.type){var E=p?null:this.extractGraphModelFromPng(b.target.result);if(null!=E&&0<E.length){var F=new Image;F.src=b.target.result;x(e,mxUtils.bind(this,function(){return f(E,"text/xml",a+e*n,c+e*n,F.width,F.height,g.name)}));t=!0}}t||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,function(){}),null,mxResources.get("ok"),
|
||||
mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(b.target.result,mxUtils.bind(this,function(h){this.resizeImage(h,b.target.result,mxUtils.bind(this,function(h,m,q){x(e,mxUtils.bind(this,function(){if(null!=h&&h.length<k){var w=l&&this.isResampleImage(b.target.result,v)?Math.min(1,Math.min(d/m,d/q)):1;return f(h,g.type,a+e*n,c+e*n,Math.round(m*w),Math.round(q*w),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),l,d,v)}),mxUtils.bind(this,
|
||||
function(){this.handleError({message:mxResources.get("invalidOrMissingFile")})})))}else f(b.target.result,g.type,a+e*n,c+e*n,240,160,g.name,function(b){x(e,function(){return b})})});/(\.vsdx?)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?f(null,g.type,a+e*n,c+e*n,240,160,g.name,function(b){x(e,function(){return b})},g):"image"==g.type.substring(0,5)?m.readAsDataURL(g):m.readAsText(g)})(F)});q?this.confirmImageResize(function(b){l=b;u()},n):u()};EditorUi.prototype.confirmImageResize=function(b,
|
||||
a){a=null!=a?a:!1;var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},e=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():null,d=function(e,d){if(e||a)mxSettings.setResizeImages(e?d:null),mxSettings.save();c();b(d)};null==e||a?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(b){d(b,!0)},function(b){d(b,!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):d(!1,e)};EditorUi.prototype.parseFile=function(b,a,c){c=null!=c?c:b.name;var e=new FormData;e.append("format","xml");e.append("upfile",b,c);var d=new XMLHttpRequest;d.open("POST",OPEN_URL);d.onreadystatechange=function(){a(d)};d.send(e)};EditorUi.prototype.isResampleImage=function(b,a){a=null!=a?a:this.resampleThreshold;return b.length>
|
||||
a};EditorUi.prototype.resizeImage=function(b,a,c,d,f,g){f=null!=f?f:this.maxImageSize;var e=Math.max(1,b.width),l=Math.max(1,b.height);if(d&&this.isResampleImage(a,g))try{var h=Math.max(e/f,l/f);if(1<h){var k=Math.round(e/h),m=Math.round(l/h),n=document.createElement("canvas");n.width=k;n.height=m;n.getContext("2d").drawImage(b,0,0,k,m);var q=n.toDataURL();if(q.length<a.length){var p=document.createElement("canvas");p.width=k;p.height=m;var t=p.toDataURL();q!==t&&(a=q,e=k,l=m)}}}catch(z){}c(a,e,l)};
|
||||
EditorUi.prototype.crcTable=[];for(var f=0;256>f;f++)for(var c=f,g=0;8>g;g++)c=1==(c&1)?3988292384^c>>>1:c>>>1,EditorUi.prototype.crcTable[f]=c;EditorUi.prototype.updateCRC=function(b,a,c,d){for(var e=0;e<d;e++)b=EditorUi.prototype.crcTable[(b^a[c+e])&255]^b>>>8;return b};EditorUi.prototype.crc32=function(b){this.crcTable=this.crcTable||this.createCrcTable();for(var a=-1,c=0;c<b.length;c++)a=a>>>8^this.crcTable[(a^b.charCodeAt(c))&255];return(a^-1)>>>0};EditorUi.prototype.writeGraphModelToPng=function(b,
|
||||
a,c,d,f){function e(b,a){var c=h;h+=a;return b.substring(c,h)}function g(b){b=e(b,4);return b.charCodeAt(3)+(b.charCodeAt(2)<<8)+(b.charCodeAt(1)<<16)+(b.charCodeAt(0)<<24)}function l(b){return String.fromCharCode(b>>24&255,b>>16&255,b>>8&255,b&255)}b=b.substring(b.indexOf(",")+1);b=window.atob?atob(b):Base64.decode(b,!0);var h=0;if(e(b,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,10,26,10))null!=f&&f();else if(e(b,4),"IHDR"!=e(b,4))null!=f&&f();else{e(b,17);f=b.substring(0,h);do{var k=
|
||||
g(b);if("IDAT"==e(b,4)){f=b.substring(0,h-8);c=c+String.fromCharCode(0)+("zTXt"==a?String.fromCharCode(0):"")+d;d=4294967295;d=this.updateCRC(d,a,0,4);d=this.updateCRC(d,c,0,c.length);f+=l(c.length)+a+c+l(d^4294967295);f+=b.substring(h-8,b.length);break}f+=b.substring(h-8,h-4+k);e(b,k);e(b,4)}while(k);return"data:image/png;base64,"+(window.btoa?btoa(f):Base64.encode(f,!0))}};EditorUi.prototype.extractGraphModelFromPng=function(b){var a=null;try{var c=b.substring(b.indexOf(",")+1),d=window.atob&&!mxClient.IS_SF?
|
||||
atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(b,c,e){b=d.substring(b+8,b+8+e);"zTXt"==c?(e=b.indexOf(String.fromCharCode(0)),"mxGraphModel"==b.substring(0,e)&&(b=this.editor.graph.bytesToString(pako.inflateRaw(b.substring(e+2))).replace(/\+/g," "),null!=b&&0<b.length&&(a=b))):"tEXt"==c&&(b=b.split(String.fromCharCode(0)),1<b.length&&"mxGraphModel"==b[0]&&(a=b[1]));if(null!=a||"IDAT"==c)return!0}))}catch(u){}null!=a&&"%"==a.charAt(0)&&(a=decodeURIComponent(a));null!=a&&
|
||||
"%"==a.charAt(0)&&(a=decodeURIComponent(a));return a};EditorUi.prototype.loadImage=function(b,a,c){var e=new Image;e.onload=function(){a(e)};null!=c&&(e.onerror=c);e.src=b};var h=EditorUi.prototype.init;EditorUi.prototype.init=function(){"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var b=this,a=this.editor.graph;a.getLinkTitle=function(a){return b.getLinkTitle(a)};a.customLinkClicked=function(a){try{b.handleCustomLink(a)}catch(L){b.handleError(L)}};this.isOffline()||
|
||||
"undefined"===typeof window.EditDataDialog||(EditDataDialog.placeholderHelpLink="https://desk.draw.io/support/solutions/articles/16000051979");var c=b.editor.getEditBlankUrl;this.editor.getEditBlankUrl=function(a){a=null!=a?a:"";if(null!=b.pages&&null!=b.currentPage)for(var e=0;e<b.pages.length;e++)if(b.pages[e]==b.currentPage){0<e&&(a+=(0<a.length?"&":"?")+"page="+e);break}"1"==urlParams.dev&&(a+=(0<a.length?"&":"?")+"dev=1&drawdev=1");return c.apply(this,arguments)};var d=a.addClickHandler;a.addClickHandler=
|
||||
function(b,c,e){var f=c;c=function(b,c){if(null==c){var e=mxEvent.getSource(b);"a"==e.nodeName.toLowerCase()&&(c=e.getAttribute("href"))}null==c||!a.isCustomLink(c)||!mxEvent.isTouchEvent(b)&&mxEvent.isPopupTrigger(b)||(a.customLinkClicked(c),mxEvent.consume(b));null!=f&&f(b,c)};d.call(this,b,c,e)};h.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(a.view.canvas.ownerSVGElement,null,!0);b.actions.get("print").funct=function(){b.showDialog((new PrintDialog(b)).container,360,null!=
|
||||
b.pages&&1<b.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");var f=a.getGlobalVariable;a.getGlobalVariable=function(a){return"page"==a&&null!=b.currentPage?b.currentPage.getName():"pagenumber"==a?null!=b.currentPage&&null!=b.pages?mxUtils.indexOf(b.pages,b.currentPage)+1:1:f.apply(this,arguments)};var g=a.createLinkForHint;a.createLinkForHint=function(b,c){null!=b&&a.isCustomLink(b)&&(c=a.getLinkTitle(b));var e=g.call(this,b,c);null!=b&&a.isCustomLink(b)&&mxEvent.addListener(e,
|
||||
"click",function(c){a.customLinkClicked(b);mxEvent.consume(c)});return e};var m=a.labelLinkClicked;a.labelLinkClicked=function(b,c,e){var d=c.getAttribute("href");if(null==d||!a.isCustomLink(d)||!mxEvent.isTouchEvent(e)&&mxEvent.isPopupTrigger(e))m.apply(this,arguments);else{if(!a.isEnabled()||null!=b&&a.isCellLocked(b.cell))a.customLinkClicked(d),a.getRubberband().reset();mxEvent.consume(e)}};this.editor.getOrCreateFilename=function(){var a=b.defaultFilename,c=b.getCurrentFile();null!=c&&(a=null!=
|
||||
c.getTitle()?c.getTitle():a);return a};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 p=function(){window.setTimeout(function(){k.innerHTML=" ";k.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_IE||a.container.addEventListener("paste",mxUtils.bind(this,function(b){var a=this.editor.graph;if(!mxEvent.isConsumed(b))try{for(var c=b.clipboardData||b.originalEvent.clipboardData,e=!1,d=0;d<c.types.length;d++)if("text/"===c.types[d].substring(0,5)){e=!0;break}if(!e){var f=c.items;for(index in f){var k=f[index];if("file"===k.kind){if(a.isEditing())this.importFiles([k.getAsFile()],
|
||||
0,0,this.maxImageSize,function(b,c,e,d,f,k){a.insertImage(b,f,k)},function(){},function(b){return"image/"==b.type.substring(0,6)},function(b){for(var a=0;a<b.length;a++)b[a]()});else{var g=this.editor.graph.getInsertPoint();this.importFiles([k.getAsFile()],g.x,g.y,this.maxImageSize);mxEvent.consume(b)}break}}}}catch(Z){}}),!1);var k=document.createElement("div");k.style.position="absolute";k.style.whiteSpace="nowrap";k.style.overflow="hidden";k.style.display="block";k.contentEditable=!0;mxUtils.setOpacity(k,
|
||||
0);k.style.width="1px";k.style.height="1px";k.innerHTML=" ";var v=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,"keydown",mxUtils.bind(this,function(b){var c=mxEvent.getSource(b);null==a.container||!a.isEnabled()||a.isMouseDown||a.isEditing()||null!=this.dialog||"INPUT"==c.nodeName||"TEXTAREA"==c.nodeName||!(224==b.keyCode||!mxClient.IS_MAC&&17==b.keyCode||mxClient.IS_MAC&&91==b.keyCode)||
|
||||
v||(k.style.left=a.container.scrollLeft+10+"px",k.style.top=a.container.scrollTop+10+"px",a.container.appendChild(k),v=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){k.focus();document.execCommand("selectAll",!1,null)},0):(k.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(b){var c=b.keyCode;window.setTimeout(mxUtils.bind(this,function(){!v||224!=c&&17!=c&&91!=c||(v=!1,a.isEditing()||null!=this.dialog||null==a.container||a.container.focus(),
|
||||
k.parentNode.removeChild(k),mxUtils.clearSelection())}),0)}));mxEvent.addListener(k,"copy",mxUtils.bind(this,function(b){a.isEnabled()&&(mxClipboard.copy(a),this.copyCells(k),p())}));mxEvent.addListener(k,"cut",mxUtils.bind(this,function(b){a.isEnabled()&&(this.copyCells(k,!0),p())}));mxEvent.addListener(k,"paste",mxUtils.bind(this,function(b){a.isEnabled()&&!a.isCellLocked(a.getDefaultParent())&&(k.innerHTML=" ",k.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(b,k);k.innerHTML=
|
||||
" "}),0))}),!0);var F=this.isSelectionAllowed;this.isSelectionAllowed=function(b){return mxEvent.getSource(b)==k?!0:F.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(b){var a=this.editor.graph,c=a.cellEditor.text2,e=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(b){null!=
|
||||
e&&(e.parentNode.removeChild(e),e=null);b.stopPropagation();b.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(b){null==e&&(!mxClient.IS_IE||10<document.documentMode)&&(e=this.highlightElement(c));b.stopPropagation();b.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(b){null!=e&&(e.parentNode.removeChild(e),e=null);if(0<b.dataTransfer.files.length)this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,function(b,c,e,d,f,k){a.insertImage(b,
|
||||
f,k)},function(){},function(b){return"image/"==b.type.substring(0,6)},function(b){for(var a=0;a<b.length;a++)b[a]()},mxEvent.isControlDown(b));else if(0<=mxUtils.indexOf(b.dataTransfer.types,"text/uri-list")){var c=b.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(b){var e=Math.max(1,b.width);b=Math.max(1,b.height);var d=this.maxImageSize,d=Math.min(1,Math.min(d/Math.max(1,e)),d/Math.max(1,b));a.insertImage(decodeURIComponent(c),
|
||||
e*d,b*d)})):document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(b.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(b.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/plain"));b.stopPropagation();b.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){n=document.createElement("div");n.style.position="absolute";
|
||||
n.style.top="95px";n.style.left="250px";n.style.width="2000px";n.style.height="30px";n.style.background="whiteSmoke";document.body.appendChild(n);var C=document.createElement("div");C.style.position="absolute";C.style.top="125px";C.style.left="220px";C.style.width="30px";C.style.height="1000px";C.style.background="whiteSmoke";document.body.appendChild(C);var y=document.createElement("div");y.style.position="absolute";y.style.top="95px";y.style.left="220px";y.style.width="30px";y.style.height="30px";
|
||||
y.style.background="whiteSmoke";document.body.appendChild(y);this.vRuler=new mxRuler(this.editor.graph,C,!0);this.hRuler=new mxRuler(this.editor.graph,n,!1)}if("1"==urlParams.test){n=document.getElementById("geFooter");null!=n&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",
|
||||
this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),n.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(b,a){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 K=this.isSelectionAllowed;this.isSelectionAllowed=function(b){return mxEvent.getSource(b)==this.styleInput?!0:K.apply(this,arguments)}}n=document.getElementById("geInfo");null!=n&&n.parentNode.removeChild(n);if(Graph.fileSupport&&(!this.editor.chromeless||this.editor.editable)){var z=null;mxEvent.addListener(a.container,"dragleave",function(b){a.isEnabled()&&(null!=z&&(z.parentNode.removeChild(z),z=null),b.stopPropagation(),b.preventDefault())});
|
||||
mxEvent.addListener(a.container,"dragover",mxUtils.bind(this,function(b){null==z&&(!mxClient.IS_IE||10<document.documentMode)&&(z=this.highlightElement(a.container));null!=this.sidebar&&this.sidebar.hideTooltip();b.stopPropagation();b.preventDefault()}));mxEvent.addListener(a.container,"drop",mxUtils.bind(this,function(b){null!=z&&(z.parentNode.removeChild(z),z=null);if(a.isEnabled()){var c=mxUtils.convertPoint(a.container,mxEvent.getClientX(b),mxEvent.getClientY(b)),e=a.view.translate,d=a.view.scale,
|
||||
f=c.x/d-e.x,k=c.y/d-e.y;mxEvent.isAltDown(b)&&(k=f=0);if(0<b.dataTransfer.files.length)this.importFiles(b.dataTransfer.files,f,k,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(b),null,null,mxEvent.isShiftDown(b));else{var g=0<=mxUtils.indexOf(b.dataTransfer.types,"text/uri-list")?b.dataTransfer.getData("text/uri-list"):null,c=this.extractGraphModelFromEvent(b,null!=this.pages);if(null!=c)a.setSelectionCells(this.importXml(c,f,k,!0));else if(0<=mxUtils.indexOf(b.dataTransfer.types,"text/html")){var l=
|
||||
b.dataTransfer.getData("text/html"),c=document.createElement("div");c.innerHTML=l;var h=null,e=c.getElementsByTagName("img");null!=e&&1==e.length?(l=e[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(l)||(h=!0)):(c=c.getElementsByTagName("a"),null!=c&&1==c.length&&(l=c[0].getAttribute("href")));var m=!0,v=mxUtils.bind(this,function(){a.setSelectionCells(this.insertTextAt(l,f,k,!0,h,null,m))});h&&l.length>this.resampleThreshold?this.confirmImageResize(function(b){m=b;v()},mxEvent.isControlDown(b)):
|
||||
v()}else null!=g&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)?this.loadImage(decodeURIComponent(g),mxUtils.bind(this,function(b){var c=Math.max(1,b.width);b=Math.max(1,b.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,c)),e/Math.max(1,b));a.setSelectionCell(a.insertVertex(null,null,"",f,k,c*e,b*e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+g+";"))}),mxUtils.bind(this,function(b){a.setSelectionCells(this.insertTextAt(g,
|
||||
f,k,!0))})):0<=mxUtils.indexOf(b.dataTransfer.types,"text/plain")&&a.setSelectionCells(this.insertTextAt(b.dataTransfer.getData("text/plain"),f,k,!0))}}b.stopPropagation();b.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();this.installSettings()};EditorUi.prototype.getLinkTitle=function(b){var a=Graph.prototype.getLinkTitle.apply(this,arguments);if("data:page/id,"==b.substring(0,13)){var c=b.indexOf(",");0<c&&(a=this.getPageById(b.substring(c+1)),a=null!=a?
|
||||
a.getName():mxResources.get("pageNotFound"))}else"data:"==b.substring(0,5)&&(a=mxResources.get("action"));return a};EditorUi.prototype.handleCustomLink=function(b){if("data:page/id,"==b.substring(0,13)){var a=b.indexOf(",");(b=this.getPageById(b.substring(a+1)))&&this.selectPage(b)}else this.editor.graph.handleCustomLink(b)};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.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle();this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle();this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[]));this.addListener("styleChanged",mxUtils.bind(this,function(b,a){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()}));this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget());
|
||||
this.fireEvent(new mxEventObject("copyConnectChanged"));this.addListener("copyConnectChanged",mxUtils.bind(this,function(b,a){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());mxSettings.save()}));this.editor.graph.pageFormat=mxSettings.getPageFormat();this.addListener("pageFormatChanged",mxUtils.bind(this,function(b,a){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()}));this.editor.graph.view.gridColor=mxSettings.getGridColor();this.addListener("gridColorChanged",
|
||||
mxUtils.bind(this,function(b,a){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()}));if(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)this.editor.addListener("autosaveChanged",mxUtils.bind(this,function(b,a){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(b,a){var c=this.editor.graph;if(c.isSelectionEmpty())b.innerHTML="";else{var e=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),d=mxUtils.getXml(this.editor.graph.encodeCells(e));mxUtils.setTextContent(b,encodeURIComponent(d));a?(c.removeCells(e,
|
||||
!1),c.lastPasteXml=null):(c.lastPasteXml=d,c.pasteCounter=0);b.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(b,a){if(!mxEvent.isConsumed(b)){var c=a.getElementsByTagName("span");if(null!=c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var e=c[0].getAttribute("data-lucid-content");null!=e&&0<e.length&&(this.importLucidChart(e,0,0),mxEvent.consume(b))}else{var e=this.editor.graph,d=mxUtils.trim(mxClient.IS_QUIRKS||
|
||||
8==document.documentMode?mxUtils.getTextContent(a):a.textContent),f=!1;try{var g=d.lastIndexOf("%3E");0<=g&&g<d.length-3&&(d=d.substring(0,g+3))}catch(A){}try{var c=a.getElementsByTagName("span"),h=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):decodeURIComponent(d);this.isCompatibleString(h)&&(f=!0,d=h)}catch(A){}e.lastPasteXml==d?e.pasteCounter++:(e.lastPasteXml=d,e.pasteCounter=0);c=e.pasteCounter*e.gridSize;if(null!=d&&0<d.length&&(f||this.isCompatibleString(d)?e.setSelectionCells(this.importXml(d,
|
||||
c,c)):(f=e.getInsertPoint(),e.isMouseInsertPoint()&&(c=0,e.lastPasteXml==d&&0<e.pasteCounter&&e.pasteCounter--),e.setSelectionCells(this.insertTextAt(d,f.x+c,f.y+c,!0))),!e.isSelectionEmpty())){e.scrollCellToVisible(e.getSelectionCell());null!=this.hoverIcons&&this.hoverIcons.update(e.view.getState(e.getSelectionCell()));try{mxEvent.consume(b)}catch(A){}}}}};EditorUi.prototype.addFileDropHandler=function(b){if(Graph.fileSupport)for(var a=null,c=0;c<b.length;c++)mxEvent.addListener(b[c],"dragleave",
|
||||
function(b){null!=a&&(a.parentNode.removeChild(a),a=null);b.stopPropagation();b.preventDefault()}),mxEvent.addListener(b[c],"dragover",mxUtils.bind(this,function(b){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==a&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(a=this.highlightElement());b.stopPropagation();b.preventDefault()})),mxEvent.addListener(b[c],"drop",mxUtils.bind(this,function(b){null!=a&&(a.parentNode.removeChild(a),a=null);if(this.editor.graph.isEnabled()||
|
||||
"1"!=urlParams.embed)if(0<b.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(b)&&!mxEvent.isShiftDown(b)):this.openFiles(b.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(b);if(null==c){var e=null!=b.dataTransfer?b.dataTransfer:b.clipboardData;null!=e&&(10==document.documentMode||11==document.documentMode?c=e.getData("Text"):(c=null,c=0<=mxUtils.indexOf(e.types,
|
||||
"text/uri-list")?b.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(e.types,"text/html")?e.getData("text/html"):null,null!=c&&0<c.length?(e=document.createElement("div"),e.innerHTML=c,e=e.getElementsByTagName("img"),0<e.length&&(c=e[0].getAttribute("src"))):0<=mxUtils.indexOf(e.types,"text/plain")&&(c=e.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(b){200<=b.getStatus()&&299>=b.getStatus()&&this.openLocalFile(b.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}b.stopPropagation();b.preventDefault()}))};
|
||||
EditorUi.prototype.highlightElement=function(b){var a=0,c=0,d,f;if(null==b){f=document.body;var g=document.documentElement;d=(f.clientWidth||g.clientWidth)-3;f=Math.max(f.clientHeight||0,g.clientHeight)-3}else a=b.offsetTop,c=b.offsetLeft,d=b.clientWidth,f=b.clientHeight;g=document.createElement("div");g.style.zIndex=mxPopupMenu.prototype.zIndex+2;g.style.border="3px dotted rgb(254, 137, 12)";g.style.pointerEvents="none";g.style.position="absolute";g.style.top=a+"px";g.style.left=c+"px";g.style.width=
|
||||
Math.max(0,d-3)+"px";g.style.height=Math.max(0,f-3)+"px";null!=b&&b.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(g):document.body.appendChild(g);return g};EditorUi.prototype.stringToCells=function(b){b=mxUtils.parseXml(b);var a=this.editor.extractGraphModel(b.documentElement);b=[];if(null!=a){var c=new mxCodec(a.ownerDocument),d=new mxGraphModel;c.decode(a,d);a=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(a);c++)b.push(d.getChildAt(a,c))}return b};EditorUi.prototype.openFiles=
|
||||
function(b,a){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=0;c<b.length;c++)mxUtils.bind(this,function(b){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var e=c.target.result,d=b.name;if(null!=d&&0<d.length){!this.useCanvasForExport&&/(\.png)$/i.test(d)&&(d=d.substring(0,d.length-4)+".xml");var f=mxUtils.bind(this,function(b){d=0<=d.lastIndexOf(".")?d.substring(0,d.lastIndexOf("."))+".xml":d+".xml";if("<mxlibrary"==b.substring(0,10)){null==this.getCurrentFile()&&
|
||||
"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,a);try{this.loadLibrary(new LocalLibrary(this,b,d))}catch(v){this.handleError(v,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(b,d,a)});if(/(\.vsdx?)($|\?)/i.test(d)||/(\.vssx)($|\?)/i.test(d))this.importVisio(b,mxUtils.bind(this,function(b){this.spinner.stop();f(b)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(e,d))this.parseFile(b,mxUtils.bind(this,
|
||||
function(b){4==b.readyState&&(this.spinner.stop(),200<=b.status&&299>=b.status?f(b.responseText):this.handleError({message:mxResources.get(413==b.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))}));else if('{"state":"{\\"Properties\\":'==e.substring(0,26))/(\.json)$/i.test(d)&&(d=d.substring(0,d.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,d,a),this.importLucidChart(e,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));
|
||||
else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,a);try{this.loadLibrary(new LocalLibrary(this,c.target.result,b.name))}catch(k){this.handleError(k,mxResources.get("errorLoadingFile"))}}else"image/png"==b.type.substring(0,9)&&(e=this.extractGraphModelFromPng(e)),this.spinner.stop(),this.openLocalFile(e,d,a)}});c.onerror=mxUtils.bind(this,function(b){this.spinner.stop();
|
||||
this.handleError(b);window.openFile=null});"image"===b.type.substring(0,5)&&"image/svg"!==b.type.substring(0,9)?c.readAsDataURL(b):c.readAsText(b)})(b[c])};EditorUi.prototype.openLocalFile=function(b,a,c){var e=this.getCurrentFile(),d=mxUtils.bind(this,function(){window.openFile=null;if(null==a&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var e=mxUtils.parseXml(b);null!=e&&(this.editor.setGraphXml(e.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,b,
|
||||
a||this.defaultFilename,c))});null!=b&&0<b.length&&(null==e||!e.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?d():(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&null!=e&&e.isModified()?this.confirm(mxResources.get("allChangesLost"),null,d,mxResources.get("cancel"),mxResources.get("discardChanges")):(window.openFile=new OpenFile(function(){window.openFile=null}),window.openFile.setData(b,a),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),
|
||||
null,d,mxResources.get("cancel"),mxResources.get("discardChanges"))}))))};EditorUi.prototype.getBasenames=function(){var b={};if(null!=this.pages)for(var a=0;a<this.pages.length;a++)this.updatePageRoot(this.pages[a]),this.addBasenamesForCell(this.pages[a].root,b);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),b);var a=[],c;for(c in b)a.push(c);return a};EditorUi.prototype.addBasenamesForCell=function(b,a){function c(b){if(null!=b){var c=b.lastIndexOf(".");0<c&&(b=b.substring(c+1,
|
||||
b.length));null==a[b]&&(a[b]=!0)}}var e=this.editor.graph,d=e.getCellStyle(b);c(mxStencilRegistry.getBasenameForStencil(d[mxConstants.STYLE_SHAPE]));e.model.isEdge(b)&&(c(mxMarker.getPackageForType(d[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(d[mxConstants.STYLE_ENDARROW])));for(var d=e.model.getChildCount(b),f=0;f<d;f++)this.addBasenamesForCell(e.model.getChildAt(b,f),a)};EditorUi.prototype.setGraphEnabled=function(b){this.diagramContainer.style.visibility=b?"":"hidden";this.formatContainer.style.visibility=
|
||||
b?"":"hidden";this.sidebarFooterContainer.style.display=b?"":"none";this.sidebarContainer.style.display=b?"":"none";this.hsplit.style.display=b?"":"none";this.editor.graph.setEnabled(b);null!=this.tabContainer&&(this.tabContainer.style.visibility=b?"":"hidden");b||(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(b,a,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);null!=b&&0<b.length?(this.setFileData(b),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(b,a){null!=b?b.getPublicUrl(a):a(null)};EditorUi.prototype.createLoadMessage=function(b){var a=this.editor.graph;return{event:b,pageVisible:a.pageVisible,translate:a.view.translate,scale:a.view.scale,page:a.view.getBackgroundPageBounds(),bounds:a.getGraphBounds()}};EditorUi.prototype.installMessageHandler=function(b){var a=null,c=!1,d=!1,f=null,g=mxUtils.bind(this,function(b,
|
||||
a){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,g);mxEvent.addListener(window,"message",mxUtils.bind(this,function(e){function g(b){if(null!=b&&"function"===typeof b.charAt&&"<"!=b.charAt(0))try{"data:image/svg+xml;base64,"==b.substring(0,26)?b=atob(b.substring(26)):"data:image/svg+xml;utf8,"==b.substring(0,24)&&
|
||||
(b=b.substring(24)),null!=b&&("%"==b.charAt(0)?b=decodeURIComponent(b):"<"!=b.charAt(0)&&(b=this.editor.graph.decompress(b)))}catch(J){}return b}if(e.source==(window.opener||window.parent)){var k=e.data;if("json"==urlParams.proto){try{k=JSON.parse(k)}catch(E){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();var l=new FilenameDialog(this,k.defaultValue||"",null!=k.okKey?mxResources.get(k.okKey):null,function(b){null!=b&&h.postMessage(JSON.stringify({event:"prompt",value:b,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){l=null;l="data:image/png;base64,"==k.xml.substring(0,22)?this.extractGraphModelFromPng(k.xml):g(k.xml);
|
||||
this.spinner.stop();l=new DraftDialog(this,mxResources.get("draftFound",[k.name||this.defaultFilename]),l,mxUtils.bind(this,function(){this.hideDialog();h.postMessage(JSON.stringify({event:"draft",result:"edit",message:k}),"*")}),mxUtils.bind(this,function(){this.hideDialog();h.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();
|
||||
h.postMessage(JSON.stringify({event:"draft",result:"ignore",message:k}),"*")}):null);this.showDialog(l.container,640,480,!0,!1,mxUtils.bind(this,function(b){b&&this.actions.get("exit").funct()}));try{l.init()}catch(E){h.postMessage(JSON.stringify({event:"draft",error:E.toString(),message:k}),"*")}return}if("template"==k.action){this.spinner.stop();var l=1==k.enableRecent,m=1==k.enableSearch,l=new NewDialog(this,!1,null!=k.callback,mxUtils.bind(this,function(a,c){a=a||this.emptyDiagramXml;null!=k.callback?
|
||||
h.postMessage(JSON.stringify({event:"template",xml:a,blank:a==this.emptyDiagramXml,name:c}),"*"):(b(a,e,a!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}),null,null,null,null,null,null,null,l?mxUtils.bind(this,function(b){this.recentReadyCallback=b;h.postMessage(JSON.stringify({event:"recentDocs"}),"*")}):null,m?mxUtils.bind(this,function(b,a){this.searchReadyCallback=a;h.postMessage(JSON.stringify({event:"searchDocs",searchStr:b}),"*")}):null,function(b,a,c){h.postMessage(JSON.stringify({event:"template",
|
||||
docUrl:b,info:a,name:c}),"*")});this.showDialog(l.container,620,440,!0,!1,mxUtils.bind(this,function(b){b&&this.actions.get("exit").funct()}));l.init();return}if("searchDocsList"==k.action)this.searchReadyCallback(k.list,k.errorMsg);else if("recentDocsList"==k.action)this.recentReadyCallback(k.list,k.errorMsg);else{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 n=null!=k.messageKey?mxResources.get(k.messageKey):k.message;null==k.show||k.show?this.spinner.spin(document.body,n):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 p=null!=k.xml?k.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var q=this.editor.graph,
|
||||
w=mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();var a=this.createLoadMessage("export");a.format=k.format;a.message=k;a.data=b;a.xml=encodeURIComponent(p);h.postMessage(JSON.stringify(a),"*")}),t=mxUtils.bind(this,function(b){null==b&&(b=Editor.blankImage);"xmlpng"==k.format&&(b=this.writeGraphModelToPng(b,"zTXt","mxGraphModel",atob(this.editor.graph.compress(p))));q!=this.editor.graph&&q.container.parentNode.removeChild(q.container);w(b)});if(this.isExportToCanvas()){if(null!=
|
||||
this.pages&&this.currentPage!=this.pages[0]){var q=this.createTemporaryGraph(q.getStylesheet()),u=q.getGlobalVariable,B=this.pages[0];q.getGlobalVariable=function(b){return"page"==b?B.getName():"pagenumber"==b?1:u.apply(this,arguments)};document.body.appendChild(q.container);q.model.setRoot(B.root)}this.exportToCanvas(mxUtils.bind(this,function(b){t(b.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,function(){t(null)}),null,null,null,null,null,null,q)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+
|
||||
("xmlpng"==k.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(p)))).send(mxUtils.bind(this,function(b){200<=b.getStatus()&&299>=b.getStatus()?w("data:image/png;base64,"+b.getText()):t(null)}),mxUtils.bind(this,function(){t(null)}))}}else{null!=k.xml&&0<k.xml.length&&this.setFileData(k.xml);n=this.createLoadMessage("export");if("html2"==k.format||"html"==k.format&&("0"!=urlParams.pages||null!=this.pages&&1<this.pages.length))l=this.getXmlFileData(),n.xml=mxUtils.getXml(l),n.data=
|
||||
this.getFileData(null,null,!0,null,null,null,l),n.format=k.format;else if("html"==k.format)p=this.editor.getGraphXml(),n.data=this.getHtml(p,this.editor.graph),n.xml=mxUtils.getXml(p),n.format=k.format;else{mxSvgCanvas2D.prototype.foAltText=null;l=this.editor.graph.background;l==mxConstants.NONE&&(l=null);n.xml=this.getFileData(!0);n.format="svg";if(k.embedImages||null==k.embedImages){if(null==k.spin&&null==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(n.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();n.data=this.createSvgDataUri(b);h.postMessage(JSON.stringify(n),"*")})):this.convertImages(this.editor.graph.getSvg(l),mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();n.data=this.createSvgDataUri(mxUtils.getXml(b));h.postMessage(JSON.stringify(n),"*")}));return}l="xmlsvg"==k.format?this.getEmbeddedSvg(this.getFileData(!0),
|
||||
this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(l));n.data=this.createSvgDataUri(l)}h.postMessage(JSON.stringify(n),"*")}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&&(l=document.createElement("span"),mxUtils.write(l,k.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight=
|
||||
"12px",this.buttonContainer.style.paddingTop="12px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(l),this.embedFilenameSpan=l),k=null!=k.xmlpng?this.extractGraphModelFromPng(k.xmlpng):null!=k.xml&&"data:image/png;base64,"==k.xml.substring(0,22)?this.extractGraphModelFromPng(k.xml):k.xml;else{h.postMessage(JSON.stringify({error:"unknownMessage",
|
||||
data:JSON.stringify(k)}),"*");return}}}k=g(k);c=!0;try{b(k,e)}catch(E){this.handleError(E)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var x=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});f=x();d&&null==a&&(a=mxUtils.bind(this,function(b,a){var e=x();if(e!=f&&!c){var d=this.createLoadMessage("autosave");d.xml=e;e=JSON.stringify(d);(window.opener||window.parent).postMessage(e,
|
||||
"*")}f=e}),this.editor.graph.model.addListener(mxEvent.CHANGE,a),this.editor.graph.addListener("gridSizeChanged",a),this.editor.graph.addListener("shadowVisibleChanged",a),this.addListener("pageFormatChanged",a),this.addListener("pageScaleChanged",a),this.addListener("backgroundColorChanged",a),this.addListener("backgroundImageChanged",a),this.addListener("foldingEnabledChanged",a),this.addListener("mathEnabledChanged",a),this.addListener("gridEnabledChanged",a),this.addListener("guidesEnabledChanged",
|
||||
a),this.addListener("pageViewChanged",a));"1"!=urlParams.returnbounds&&"json"!=urlParams.proto||h.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}}));var h=window.opener||window.parent,g="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";h.postMessage(g,"*")};EditorUi.prototype.addEmbedButtons=function(){if(null!=this.menubar){var b=document.createElement("div");b.style.display="inline-block";b.style.position="absolute";b.style.paddingTop="atlas"==uiTheme?
|
||||
"2px":"3px";b.style.paddingLeft="8px";b.style.paddingBottom="2px";var a=document.createElement("button");mxUtils.write(a,mxResources.get("save"));a.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)");a.className="geBigButton";a.style.fontSize="12px";a.style.padding="4px 6px 4px 6px";a.style.borderRadius="3px";mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));b.appendChild(a);"1"==urlParams.saveAndExit&&(a=document.createElement("a"),
|
||||
mxUtils.write(a,mxResources.get("saveAndExit")),a.setAttribute("title",mxResources.get("saveAndExit")),a.style.fontSize="12px",a.style.marginLeft="6px",a.style.padding="4px",a.style.cursor="pointer",mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),b.appendChild(a));a=document.createElement("a");mxUtils.write(a,mxResources.get("exit"));a.setAttribute("title",mxResources.get("exit"));a.style.fontSize="12px";a.style.marginLeft="6px";a.style.marginRight=
|
||||
"20px";a.style.padding="4px";a.style.cursor="pointer";mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()}));b.appendChild(a);this.toolbar.container.appendChild(b);this.toolbar.staticElements.push(b);b.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(b){this.importCsv(b)}),
|
||||
null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(b,a){try{var c=b.split("\n"),e=[];if(0<c.length){var d={},f=null,g=null,h="",m="auto",k="auto",n=null,p=null,C=40,y=40,K=0,z=this.editor.graph;z.getGraphBounds();for(var D=function(){null!=a?a(aa):(z.setSelectionCells(aa),z.scrollCellToVisible(z.getSelectionCell()))},L=z.getFreeInsertPoint(),B=L.x,H=L.y,L=H,E=null,
|
||||
J="auto",M=[],X=null,Z=null,N=0;N<c.length&&"#"==c[N].charAt(0);){b=c[N];for(N++;N<c.length&&"\\"==b.charAt(b.length-1)&&"#"==c[N].charAt(0);)b=b.substring(0,b.length-1)+mxUtils.trim(c[N].substring(1)),N++;if("#"!=b.charAt(1)){var S=b.indexOf(":");if(0<S){var O=mxUtils.trim(b.substring(1,S)),G=mxUtils.trim(b.substring(S+1));"label"==O?E=z.sanitizeHtml(G):"style"==O?f=G:"identity"==O&&0<G.length&&"-"!=G?g=G:"namespace"==O&&0<G.length&&"-"!=G?h=G:"width"==O?m=G:"height"==O?k=G:"left"==O&&0<G.length?
|
||||
n=G:"top"==O&&0<G.length?p=G:"ignore"==O?Z=G.split(","):"connect"==O?M.push(JSON.parse(G)):"link"==O?X=G:"padding"==O?K=parseFloat(G):"edgespacing"==O?C=parseFloat(G):"nodespacing"==O?y=parseFloat(G):"layout"==O&&(J=G)}}}var W=this.editor.csvToArray(c[N]),S=null;if(null!=g)for(var R=0;R<W.length;R++)if(g==W[R]){S=R;break}null==E&&(E="%"+W[0]+"%");if(null!=M)for(var T=0;T<M.length;T++)null==d[M[T].to]&&(d[M[T].to]={});z.model.beginUpdate();try{for(R=N+1;R<c.length;R++){var V=this.editor.csvToArray(c[R]);
|
||||
if(V.length==W.length){var I=null,Q=null!=S?h+V[S]:null;null!=Q&&(I=z.model.getCell(Q));null==I&&(I=new mxCell(E,new mxGeometry(B,L,0,0),f||"whiteSpace=wrap;html=1;"),I.vertex=!0,I.id=Q);for(var P=0;P<V.length;P++)z.setAttributeForCell(I,W[P],V[P]);z.setAttributeForCell(I,"placeholders","1");I.style=z.replacePlaceholders(I,I.style);for(T=0;T<M.length;T++)d[M[T].to][I.getAttribute(M[T].to)]=I;null!=X&&"link"!=X&&(z.setLinkForCell(I,I.getAttribute(X)),z.setAttributeForCell(I,X,null));z.fireEvent(new mxEventObject("cellsInserted",
|
||||
"cells",[I]));var ba=this.editor.graph.getPreferredSizeForCell(I);I.vertex&&(null!=n&&null!=I.getAttribute(n)&&(I.geometry.x=B+parseFloat(I.getAttribute(n))),null!=p&&null!=I.getAttribute(p)&&(I.geometry.y=H+parseFloat(I.getAttribute(p))),"@"==m.charAt(0)&&null!=I.getAttribute(m.substring(1))?I.geometry.width=parseFloat(I.getAttribute(m.substring(1))):I.geometry.width="auto"==m?ba.width+K:parseFloat(m),"@"==k.charAt(0)&&null!=I.getAttribute(k.substring(1))?I.geometry.height=parseFloat(I.getAttribute(k.substring(1))):
|
||||
I.geometry.height="auto"==k?ba.height+K:parseFloat(k),L+=I.geometry.height+y);e.push(z.addCell(I))}}for(var U=e.slice(),aa=e.slice(),T=0;T<M.length;T++)for(var Y=M[T],R=0;R<e.length;R++){var I=e[R],ia=I.getAttribute(Y.from);if(null!=ia){z.setAttributeForCell(I,Y.from,null);for(var ja=ia.split(","),P=0;P<ja.length;P++){var ca=d[Y.to][ja[P]];null!=ca&&(E=Y.label,null!=Y.fromlabel&&(E=(I.getAttribute(Y.fromlabel)||"")+(E||"")),null!=Y.tolabel&&(E=(E||"")+(ca.getAttribute(Y.tolabel)||"")),aa.push(z.insertEdge(null,
|
||||
null,E||"",Y.invert?ca:I,Y.invert?I:ca,Y.style||z.createCurrentEdgeStyle())),mxUtils.remove(Y.invert?I:ca,U))}}}if(null!=Z)for(R=0;R<e.length;R++)for(I=e[R],P=0;P<Z.length;P++)z.setAttributeForCell(I,mxUtils.trim(Z[P]),null);var fa=new mxParallelEdgeLayout(z);fa.spacing=C;var ka=function(){fa.execute(z.getDefaultParent());for(var b=0;b<e.length;b++){var a=z.getCellGeometry(e[b]);a.x=Math.round(z.snap(a.x));a.y=Math.round(z.snap(a.y));"auto"==m&&(a.width=Math.round(z.snap(a.width)));"auto"==k&&(a.height=
|
||||
Math.round(z.snap(a.height)))}};if("circle"==J){var da=new mxCircleLayout(z);da.resetEdges=!1;var la=da.isVertexIgnored;da.isVertexIgnored=function(b){return la.apply(this,arguments)||0>mxUtils.indexOf(e,b)};this.executeLayout(function(){da.execute(z.getDefaultParent());ka()},!0,D);D=null}else if("horizontaltree"==J||"verticaltree"==J||"auto"==J&&aa.length==2*e.length-1&&1==U.length){z.view.validate();var ga=new mxCompactTreeLayout(z,"horizontaltree"==J);ga.levelDistance=y;ga.edgeRouting=!1;ga.resetEdges=
|
||||
!1;this.executeLayout(function(){ga.execute(z.getDefaultParent(),0<U.length?U[0]:null)},!0,D);D=null}else if("horizontalflow"==J||"verticalflow"==J||"auto"==J&&1==U.length){z.view.validate();var ha=new mxHierarchicalLayout(z,"horizontalflow"==J?mxConstants.DIRECTION_WEST:mxConstants.DIRECTION_NORTH);ha.intraCellSpacing=y;ha.disableEdgeStyle=!1;this.executeLayout(function(){ha.execute(z.getDefaultParent(),aa);z.moveCells(aa,B,H)},!0,D);D=null}else if("organic"==J||"auto"==J&&aa.length>e.length){z.view.validate();
|
||||
var ea=new mxFastOrganicLayout(z);ea.forceConstant=3*y;ea.resetEdges=!1;var na=ea.isVertexIgnored;ea.isVertexIgnored=function(b){return na.apply(this,arguments)||0>mxUtils.indexOf(e,b)};fa=new mxParallelEdgeLayout(z);fa.spacing=C;this.executeLayout(function(){ea.execute(z.getDefaultParent());ka()},!0,D);D=null}this.hideDialog()}finally{z.model.endUpdate()}null!=D&&D()}}catch(ma){this.handleError(ma)}};EditorUi.prototype.getSearch=function(b){var a="";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&
|
||||
null!=b&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(b,d)&&null!=urlParams[d]&&(a+=c+d+"="+urlParams[d],c="&")}else a=window.location.search;return a};EditorUi.prototype.getUrl=function(b){b=null!=b?b:window.location.pathname;var a=0<b.indexOf("?")?1:0;if("1"==urlParams.offline)b+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&
|
||||
(b=0==a?b+"?":b+"&",null!=urlParams[d]&&(b+=d+"="+urlParams[d],a++))}return b};EditorUi.prototype.showLinkDialog=function(b,a,c){b=new LinkDialog(this,b,a,c,!0);this.showDialog(b.container,480,130,!0,!0);b.init()};var m=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(b){var a=m.apply(this,arguments),c=this.editor.graph,d=a.getSourceGraphBounds;a.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&null!=this.source.minimumGraphSize){var b=
|
||||
this.source.getPagePadding(),a=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*b.x/a),Math.ceil(this.source.minimumGraphSize.height-2*b.y/a))}return d.apply(this,arguments)};var f=a.getSourceContainerSize;a.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var b=this.source.getPagePadding(),a=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*a-2*
|
||||
b.x),Math.ceil(this.source.minimumGraphSize.height*a-2*b.y))}return f.apply(this,arguments)};a.getOutlineOffset=function(b){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var e=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(a.outline.container.clientWidth/b-(this.source.minimumGraphSize.width-2*e.x))/2)-e.x),Math.round(Math.max(0,(a.outline.container.clientHeight/b-(this.source.minimumGraphSize.height-2*e.y))/2)-e.y-5/b))}return new mxPoint(8/b,
|
||||
8/b)};var g=a.init;a.init=function(){g.apply(this,arguments);a.outline.view.getBackgroundPageBounds=function(){var b=c.getPageLayout(),a=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+b.x*a.width),this.scale*(this.translate.y+b.y*a.height),this.scale*b.width*a.width,this.scale*b.height*a.height)};a.outline.view.validateBackgroundPage()};this.editor.addListener("pageSelected",function(b,c){var e=c.getProperty("change"),d=a.source,f=a.outline;f.pageScale=d.pageScale;f.pageFormat=
|
||||
[f]))}finally{e.getModel().endUpdate()}e.setSelectionCell(f)}))}else{b=this.editor.graph.zapGremlins(mxUtils.trim(b));if(this.isCompatibleString(b))return this.importXml(b,a,c,g);if(0<b.length)if('{"state":"{\\"Properties\\":'==b.substring(0,26))this.importLucidChart(b,a,c,g);else{e=this.editor.graph;f=null;e.getModel().beginUpdate();try{f=e.insertVertex(e.getDefaultParent(),null,"",e.snap(a),e.snap(c),1,1,"text;"+(d?"html=1;":"")),e.fireEvent(new mxEventObject("textInserted","cells",[f])),"<"==b.charAt(0)&&
|
||||
b.indexOf(">")==b.length-1&&(b=mxUtils.htmlEntities(b)),f.value=b,e.updateCellSize(f),/\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(f.value)&&e.setLinkForCell(f,f.value),f.geometry.width+=e.gridSize,f.geometry.height+=e.gridSize}finally{e.getModel().endUpdate()}return[f]}}return[]};EditorUi.prototype.formatFileSize=function(b){var a=-1;
|
||||
do b/=1024,a++;while(1024<b);return Math.max(b,.1).toFixed(1)+" kB; MB; GB; TB;PB;EB;ZB;YB".split(";")[a]};EditorUi.prototype.convertDataUri=function(b){if("data:"==b.substring(0,5)){var a=b.indexOf(";");0<a&&(b=b.substring(0,a)+b.substring(b.indexOf(",",a+1)))}return b};EditorUi.prototype.isRemoteFileFormat=function(b,a){return/(\"contentType\":\s*\"application\/gliffy\+json\")/.test(b)};EditorUi.prototype.importLocalFile=function(b,a){if(b&&Graph.fileSupport&&(!mxClient.IS_IE&&!mxClient.IS_IE11||
|
||||
0>navigator.appVersion.indexOf("Windows NT 6.1"))){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.click()}else{window.openNew=!1;window.openKey="import";if(!a){var e=Editor.useLocalStorage;Editor.useLocalStorage=!b}window.openFile=new OpenFile(mxUtils.bind(this,function(b){this.hideDialog(b)}));window.openFile.setConsumer(mxUtils.bind(this,function(b,
|
||||
a){if(null!=a&&Graph.fileSupport&&/(\.vsdx?)($|\?)/i.test(a)){var c=new Blob([b],{type:"application/octet-stream"});this.importVisio(c,mxUtils.bind(this,function(b){this.importXml(b)}),null,a)}else this.editor.graph.setSelectionCells(this.importXml(b))}));this.showDialog((new OpenDialog(this)).container,360,220,!0,!0,function(){window.openFile=null});if(!a){var d=this.dialog,f=d.close;this.dialog.close=mxUtils.bind(this,function(b){Editor.useLocalStorage=e;f.apply(d,arguments);b&&null==this.getCurrentFile()&&
|
||||
"1"!=urlParams.embed&&this.showSplash()})}}};EditorUi.prototype.importFile=function(b,a,c,d,f,g,h,m,n,k,v){k=null!=k?k:!0;var e=!1,l=null,q=mxUtils.bind(this,function(b){var a=null;null!=b&&"<mxlibrary"==b.substring(0,10)?this.loadLibrary(new LocalLibrary(this,b,h)):a=this.importXml(b,c,d,k);null!=m&&m(a)});"image"==a.substring(0,5)?(n=!1,"image/png"==a.substring(0,9)&&(a=v?null:this.extractGraphModelFromPng(b),null!=a&&0<a.length&&(l=this.importXml(a,c,d,k),n=!0)),n||(l=this.editor.graph,a=b.indexOf(";"),
|
||||
0<a&&(b=b.substring(0,a)+b.substring(b.indexOf(",",a+1))),k&&l.isGridEnabled()&&(c=l.snap(c),d=l.snap(d)),l=[l.insertVertex(null,null,"",c,d,f,g,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+b+";")])):/(\.*<graphml )/.test(b)&&"undefined"!==typeof window.mxGraphMlCodec?(new mxGraphMlCodec).decode(b,mxUtils.bind(this,function(b){b=this.importXml(b,c,d,k);null!=m&&m(b)})):null!=n&&null!=h&&(/(\.vsdx?)($|\?)/i.test(h)||/(\.vssx)($|\?)/i.test(h))?
|
||||
(e=!0,this.importVisio(n,q)):!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(b,h)?(e=!0,this.parseFile(null!=n?n:new Blob([b],{type:"application/octet-stream"}),mxUtils.bind(this,function(b){4==b.readyState&&(200<=b.status&&299>=b.status?q(b.responseText):null!=m&&m(null))}),h)):/(\.vsd)($|\?)/i.test(h)||(l=this.insertTextAt(this.validateFileData(b),c,d,!0,null,k));e||null==m||m(l);return l};EditorUi.prototype.base64Encode=function(b){for(var a="",c=0,d=b.length,f,g,h;c<d;){f=
|
||||
b.charCodeAt(c++)&255;if(c==d){a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4);a+="==";break}g=b.charCodeAt(c++);if(c==d){a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(g&240)>>4);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((g&
|
||||
15)<<2);a+="=";break}h=b.charCodeAt(c++);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(f>>2);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((f&3)<<4|(g&240)>>4);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt((g&15)<<2|(h&192)>>6);a+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(h&63)}return a};EditorUi.prototype.importFiles=function(b,a,c,d,f,g,h,m,n,k,v,p){a=null!=a?a:0;c=null!=
|
||||
c?c:0;d=null!=d?d:this.maxImageSize;k=null!=k?k:this.maxImageBytes;var e=null!=a&&null!=c,l=!0,q=!1;if(!mxClient.IS_CHROMEAPP&&null!=b)for(var w=v||this.resampleThreshold,t=0;t<b.length;t++)if("image/"==b[t].type.substring(0,6)&&b[t].size>w){q=!0;break}var u=mxUtils.bind(this,function(){var n=this.editor.graph,q=n.gridSize;f=null!=f?f:mxUtils.bind(this,function(b,a,c,d,f,k,g,l,h){return null!=b&&"<mxlibrary"==b.substring(0,10)?(this.spinner.stop(),this.loadLibrary(new LocalLibrary(this,b,g)),null):
|
||||
this.importFile(b,a,c,d,f,k,g,l,h,e,p)});g=null!=g?g:mxUtils.bind(this,function(b){n.setSelectionCells(b)});if(this.spinner.spin(document.body,mxResources.get("loading")))for(var w=b.length,t=w,u=[],x=mxUtils.bind(this,function(b,a){u[b]=a;if(0==--t){this.spinner.stop();if(null!=m)m(u);else{var c=[];n.getModel().beginUpdate();try{for(var e=0;e<u.length;e++){var d=u[e]();null!=d&&(c=c.concat(d))}}finally{n.getModel().endUpdate()}}g(c)}}),F=0;F<w;F++)mxUtils.bind(this,function(e){var g=b[e],m=new FileReader;
|
||||
m.onload=mxUtils.bind(this,function(b){if(null==h||h(g))if("image/"==g.type.substring(0,6))if("image/svg"==g.type.substring(0,9)){var m=b.target.result,w=m.indexOf(","),t=decodeURIComponent(escape(atob(m.substring(w+1)))),u=mxUtils.parseXml(t),t=u.getElementsByTagName("svg");if(0<t.length){var t=t[0],B=p?null:t.getAttribute("content");null!=B&&"<"!=B.charAt(0)&&"%"!=B.charAt(0)&&(B=unescape(window.atob?atob(B):Base64.decode(B,!0)));null!=B&&"%"==B.charAt(0)&&(B=decodeURIComponent(B));null==B||"<mxfile "!==
|
||||
B.substring(0,8)&&"<mxGraphModel "!==B.substring(0,14)?x(e,mxUtils.bind(this,function(){try{if(m.substring(0,w+1),null!=u){var b=u.getElementsByTagName("svg");if(0<b.length){var k=b[0],h=parseFloat(k.getAttribute("width")),v=parseFloat(k.getAttribute("height")),p=k.getAttribute("viewBox");if(null==p||0==p.length)k.setAttribute("viewBox","0 0 "+h+" "+v);else if(isNaN(h)||isNaN(v)){var t=p.split(" ");3<t.length&&(h=parseFloat(t[2]),v=parseFloat(t[3]))}m=this.createSvgDataUri(mxUtils.getXml(k));var B=
|
||||
Math.min(1,Math.min(d/Math.max(1,h)),d/Math.max(1,v)),x=f(m,g.type,a+e*q,c+e*q,Math.max(1,Math.round(h*B)),Math.max(1,Math.round(v*B)),g.name,l);if(isNaN(h)||isNaN(v)){var E=new Image;E.onload=mxUtils.bind(this,function(){h=Math.max(1,E.width);v=Math.max(1,E.height);x[0].geometry.width=h;x[0].geometry.height=v;k.setAttribute("viewBox","0 0 "+h+" "+v);m=this.createSvgDataUri(mxUtils.getXml(k));var b=m.indexOf(";");0<b&&(m=m.substring(0,b)+m.substring(m.indexOf(",",b+1)));n.setCellStyles("image",m,
|
||||
[x[0]])});E.src=this.createSvgDataUri(mxUtils.getXml(k))}return x}}}catch(da){}return null})):x(e,mxUtils.bind(this,function(){return f(B,"text/xml",a+e*q,c+e*q,0,0,g.name)}))}}else{t=!1;if("image/png"==g.type){var E=p?null:this.extractGraphModelFromPng(b.target.result);if(null!=E&&0<E.length){var F=new Image;F.src=b.target.result;x(e,mxUtils.bind(this,function(){return f(E,"text/xml",a+e*q,c+e*q,F.width,F.height,g.name)}));t=!0}}t||(mxClient.IS_CHROMEAPP?(this.spinner.stop(),this.showError(mxResources.get("error"),
|
||||
mxResources.get("dragAndDropNotSupported"),mxResources.get("cancel"),mxUtils.bind(this,function(){}),null,mxResources.get("ok"),mxUtils.bind(this,function(){this.actions.get("import").funct()}))):this.loadImage(b.target.result,mxUtils.bind(this,function(h){this.resizeImage(h,b.target.result,mxUtils.bind(this,function(h,m,n){x(e,mxUtils.bind(this,function(){if(null!=h&&h.length<k){var w=l&&this.isResampleImage(b.target.result,v)?Math.min(1,Math.min(d/m,d/n)):1;return f(h,g.type,a+e*q,c+e*q,Math.round(m*
|
||||
w),Math.round(n*w),g.name)}this.handleError({message:mxResources.get("imageTooBig")});return null}))}),l,d,v)}),mxUtils.bind(this,function(){this.handleError({message:mxResources.get("invalidOrMissingFile")})})))}else f(b.target.result,g.type,a+e*q,c+e*q,240,160,g.name,function(b){x(e,function(){return b})})});/(\.vsdx?)($|\?)/i.test(g.name)||/(\.vssx)($|\?)/i.test(g.name)?f(null,g.type,a+e*q,c+e*q,240,160,g.name,function(b){x(e,function(){return b})},g):"image"==g.type.substring(0,5)?m.readAsDataURL(g):
|
||||
m.readAsText(g)})(F)});q?this.confirmImageResize(function(b){l=b;u()},n):u()};EditorUi.prototype.confirmImageResize=function(b,a){a=null!=a?a:!1;var c=null!=this.spinner&&null!=this.spinner.pause?this.spinner.pause():function(){},e=isLocalStorage||mxClient.IS_CHROMEAPP?mxSettings.getResizeImages():null,d=function(e,d){if(e||a)mxSettings.setResizeImages(e?d:null),mxSettings.save();c();b(d)};null==e||a?this.showDialog((new ConfirmDialog(this,mxResources.get("resizeLargeImages"),function(b){d(b,!0)},
|
||||
function(b){d(b,!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):d(!1,e)};EditorUi.prototype.parseFile=function(b,a,c){c=null!=c?c:b.name;var e=new FormData;e.append("format","xml");e.append("upfile",b,c);var d=new XMLHttpRequest;d.open("POST",OPEN_URL);d.onreadystatechange=
|
||||
function(){a(d)};d.send(e)};EditorUi.prototype.isResampleImage=function(b,a){a=null!=a?a:this.resampleThreshold;return b.length>a};EditorUi.prototype.resizeImage=function(b,a,c,d,f,g){f=null!=f?f:this.maxImageSize;var e=Math.max(1,b.width),l=Math.max(1,b.height);if(d&&this.isResampleImage(a,g))try{var h=Math.max(e/f,l/f);if(1<h){var k=Math.round(e/h),m=Math.round(l/h),n=document.createElement("canvas");n.width=k;n.height=m;n.getContext("2d").drawImage(b,0,0,k,m);var q=n.toDataURL();if(q.length<a.length){var p=
|
||||
document.createElement("canvas");p.width=k;p.height=m;var t=p.toDataURL();q!==t&&(a=q,e=k,l=m)}}}catch(z){}c(a,e,l)};EditorUi.prototype.crcTable=[];for(var f=0;256>f;f++)for(var c=f,g=0;8>g;g++)c=1==(c&1)?3988292384^c>>>1:c>>>1,EditorUi.prototype.crcTable[f]=c;EditorUi.prototype.updateCRC=function(b,a,c,d){for(var e=0;e<d;e++)b=EditorUi.prototype.crcTable[(b^a[c+e])&255]^b>>>8;return b};EditorUi.prototype.crc32=function(b){this.crcTable=this.crcTable||this.createCrcTable();for(var a=-1,c=0;c<b.length;c++)a=
|
||||
a>>>8^this.crcTable[(a^b.charCodeAt(c))&255];return(a^-1)>>>0};EditorUi.prototype.writeGraphModelToPng=function(b,a,c,d,f){function e(b,a){var c=h;h+=a;return b.substring(c,h)}function g(b){b=e(b,4);return b.charCodeAt(3)+(b.charCodeAt(2)<<8)+(b.charCodeAt(1)<<16)+(b.charCodeAt(0)<<24)}function l(b){return String.fromCharCode(b>>24&255,b>>16&255,b>>8&255,b&255)}b=b.substring(b.indexOf(",")+1);b=window.atob?atob(b):Base64.decode(b,!0);var h=0;if(e(b,8)!=String.fromCharCode(137)+"PNG"+String.fromCharCode(13,
|
||||
10,26,10))null!=f&&f();else if(e(b,4),"IHDR"!=e(b,4))null!=f&&f();else{e(b,17);f=b.substring(0,h);do{var k=g(b);if("IDAT"==e(b,4)){f=b.substring(0,h-8);c=c+String.fromCharCode(0)+("zTXt"==a?String.fromCharCode(0):"")+d;d=4294967295;d=this.updateCRC(d,a,0,4);d=this.updateCRC(d,c,0,c.length);f+=l(c.length)+a+c+l(d^4294967295);f+=b.substring(h-8,b.length);break}f+=b.substring(h-8,h-4+k);e(b,k);e(b,4)}while(k);return"data:image/png;base64,"+(window.btoa?btoa(f):Base64.encode(f,!0))}};EditorUi.prototype.extractGraphModelFromPng=
|
||||
function(b){var a=null;try{var c=b.substring(b.indexOf(",")+1),d=window.atob&&!mxClient.IS_SF?atob(c):Base64.decode(c,!0);EditorUi.parsePng(d,mxUtils.bind(this,function(b,c,e){b=d.substring(b+8,b+8+e);"zTXt"==c?(e=b.indexOf(String.fromCharCode(0)),"mxGraphModel"==b.substring(0,e)&&(b=this.editor.graph.bytesToString(pako.inflateRaw(b.substring(e+2))).replace(/\+/g," "),null!=b&&0<b.length&&(a=b))):"tEXt"==c&&(b=b.split(String.fromCharCode(0)),1<b.length&&"mxGraphModel"==b[0]&&(a=b[1]));if(null!=a||
|
||||
"IDAT"==c)return!0}))}catch(u){}null!=a&&"%"==a.charAt(0)&&(a=decodeURIComponent(a));null!=a&&"%"==a.charAt(0)&&(a=decodeURIComponent(a));return a};EditorUi.prototype.loadImage=function(b,a,c){var e=new Image;e.onload=function(){a(e)};null!=c&&(e.onerror=c);e.src=b};var h=EditorUi.prototype.init;EditorUi.prototype.init=function(){"undefined"!==typeof window.mxSettings&&(this.formatWidth=mxSettings.getFormatWidth());var b=this,a=this.editor.graph;a.getLinkTitle=function(a){return b.getLinkTitle(a)};
|
||||
a.customLinkClicked=function(a){try{b.handleCustomLink(a)}catch(L){b.handleError(L)}};this.isOffline()||"undefined"===typeof window.EditDataDialog||(EditDataDialog.placeholderHelpLink="https://desk.draw.io/support/solutions/articles/16000051979");var c=b.editor.getEditBlankUrl;this.editor.getEditBlankUrl=function(a){a=null!=a?a:"";if(null!=b.pages&&null!=b.currentPage)for(var e=0;e<b.pages.length;e++)if(b.pages[e]==b.currentPage){0<e&&(a+=(0<a.length?"&":"?")+"page="+e);break}"1"==urlParams.dev&&
|
||||
(a+=(0<a.length?"&":"?")+"dev=1&drawdev=1");return c.apply(this,arguments)};var d=a.addClickHandler;a.addClickHandler=function(b,c,e){var f=c;c=function(b,c){if(null==c){var e=mxEvent.getSource(b);"a"==e.nodeName.toLowerCase()&&(c=e.getAttribute("href"))}null==c||!a.isCustomLink(c)||!mxEvent.isTouchEvent(b)&&mxEvent.isPopupTrigger(b)||(a.customLinkClicked(c),mxEvent.consume(b));null!=f&&f(b,c)};d.call(this,b,c,e)};h.apply(this,arguments);mxClient.IS_SVG&&this.editor.graph.addSvgShadow(a.view.canvas.ownerSVGElement,
|
||||
null,!0);b.actions.get("print").funct=function(){b.showDialog((new PrintDialog(b)).container,360,null!=b.pages&&1<b.pages.length?420:360,!0,!0)};this.defaultFilename=mxResources.get("untitledDiagram");var f=a.getGlobalVariable;a.getGlobalVariable=function(a){return"page"==a&&null!=b.currentPage?b.currentPage.getName():"pagenumber"==a?null!=b.currentPage&&null!=b.pages?mxUtils.indexOf(b.pages,b.currentPage)+1:1:f.apply(this,arguments)};var g=a.createLinkForHint;a.createLinkForHint=function(b,c){null!=
|
||||
b&&a.isCustomLink(b)&&(c=a.getLinkTitle(b));var e=g.call(this,b,c);null!=b&&a.isCustomLink(b)&&mxEvent.addListener(e,"click",function(c){a.customLinkClicked(b);mxEvent.consume(c)});return e};var m=a.labelLinkClicked;a.labelLinkClicked=function(b,c,e){var d=c.getAttribute("href");if(null==d||!a.isCustomLink(d)||!mxEvent.isTouchEvent(e)&&mxEvent.isPopupTrigger(e))m.apply(this,arguments);else{if(!a.isEnabled()||null!=b&&a.isCellLocked(b.cell))a.customLinkClicked(d),a.getRubberband().reset();mxEvent.consume(e)}};
|
||||
this.editor.getOrCreateFilename=function(){var a=b.defaultFilename,c=b.getCurrentFile();null!=c&&(a=null!=c.getTitle()?c.getTitle():a);return a};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 p=function(){window.setTimeout(function(){k.innerHTML=" ";k.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_IE||a.container.addEventListener("paste",mxUtils.bind(this,function(b){var a=this.editor.graph;if(!mxEvent.isConsumed(b))try{for(var c=b.clipboardData||b.originalEvent.clipboardData,e=!1,d=0;d<c.types.length;d++)if("text/"===
|
||||
c.types[d].substring(0,5)){e=!0;break}if(!e){var f=c.items;for(index in f){var k=f[index];if("file"===k.kind){if(a.isEditing())this.importFiles([k.getAsFile()],0,0,this.maxImageSize,function(b,c,e,d,f,k){a.insertImage(b,f,k)},function(){},function(b){return"image/"==b.type.substring(0,6)},function(b){for(var a=0;a<b.length;a++)b[a]()});else{var g=this.editor.graph.getInsertPoint();this.importFiles([k.getAsFile()],g.x,g.y,this.maxImageSize);mxEvent.consume(b)}break}}}}catch(Z){}}),!1);var k=document.createElement("div");
|
||||
k.style.position="absolute";k.style.whiteSpace="nowrap";k.style.overflow="hidden";k.style.display="block";k.contentEditable=!0;mxUtils.setOpacity(k,0);k.style.width="1px";k.style.height="1px";k.innerHTML=" ";var v=!1;this.keyHandler.bindControlKey(88,null);this.keyHandler.bindControlKey(67,null);this.keyHandler.bindControlKey(86,null);mxEvent.addListener(document,"keydown",mxUtils.bind(this,function(b){var c=mxEvent.getSource(b);null==a.container||!a.isEnabled()||a.isMouseDown||a.isEditing()||
|
||||
null!=this.dialog||"INPUT"==c.nodeName||"TEXTAREA"==c.nodeName||!(224==b.keyCode||!mxClient.IS_MAC&&17==b.keyCode||mxClient.IS_MAC&&91==b.keyCode)||v||(k.style.left=a.container.scrollLeft+10+"px",k.style.top=a.container.scrollTop+10+"px",a.container.appendChild(k),v=!0,mxClient.IS_QUIRKS?window.setTimeout(function(){k.focus();document.execCommand("selectAll",!1,null)},0):(k.focus(),document.execCommand("selectAll",!1,null)))}));mxEvent.addListener(document,"keyup",mxUtils.bind(this,function(b){var c=
|
||||
b.keyCode;window.setTimeout(mxUtils.bind(this,function(){!v||224!=c&&17!=c&&91!=c||(v=!1,a.isEditing()||null!=this.dialog||null==a.container||a.container.focus(),k.parentNode.removeChild(k),mxUtils.clearSelection())}),0)}));mxEvent.addListener(k,"copy",mxUtils.bind(this,function(b){a.isEnabled()&&(mxClipboard.copy(a),this.copyCells(k),p())}));mxEvent.addListener(k,"cut",mxUtils.bind(this,function(b){a.isEnabled()&&(this.copyCells(k,!0),p())}));mxEvent.addListener(k,"paste",mxUtils.bind(this,function(b){a.isEnabled()&&
|
||||
!a.isCellLocked(a.getDefaultParent())&&(k.innerHTML=" ",k.focus(),window.setTimeout(mxUtils.bind(this,function(){this.pasteCells(b,k);k.innerHTML=" "}),0))}),!0);var F=this.isSelectionAllowed;this.isSelectionAllowed=function(b){return mxEvent.getSource(b)==k?!0:F.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(b){var a=this.editor.graph,c=a.cellEditor.text2,e=null;null!=c&&(mxEvent.addListener(c,"dragleave",function(b){null!=e&&(e.parentNode.removeChild(e),e=null);b.stopPropagation();b.preventDefault()}),mxEvent.addListener(c,"dragover",mxUtils.bind(this,function(b){null==e&&(!mxClient.IS_IE||10<document.documentMode)&&(e=this.highlightElement(c));b.stopPropagation();b.preventDefault()})),mxEvent.addListener(c,"drop",mxUtils.bind(this,function(b){null!=e&&(e.parentNode.removeChild(e),
|
||||
e=null);if(0<b.dataTransfer.files.length)this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,function(b,c,e,d,f,k){a.insertImage(b,f,k)},function(){},function(b){return"image/"==b.type.substring(0,6)},function(b){for(var a=0;a<b.length;a++)b[a]()},mxEvent.isControlDown(b));else if(0<=mxUtils.indexOf(b.dataTransfer.types,"text/uri-list")){var c=b.dataTransfer.getData("text/uri-list");/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(c)?this.loadImage(decodeURIComponent(c),mxUtils.bind(this,function(b){var e=
|
||||
Math.max(1,b.width);b=Math.max(1,b.height);var d=this.maxImageSize,d=Math.min(1,Math.min(d/Math.max(1,e)),d/Math.max(1,b));a.insertImage(decodeURIComponent(c),e*d,b*d)})):document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/plain"))}else 0<=mxUtils.indexOf(b.dataTransfer.types,"text/html")?document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/html")):0<=mxUtils.indexOf(b.dataTransfer.types,"text/plain")&&document.execCommand("insertHTML",!1,b.dataTransfer.getData("text/plain"));
|
||||
b.stopPropagation();b.preventDefault()})))}));if("1"==urlParams.ruler&&"undefined"!==typeof mxRuler){n=document.createElement("div");n.style.position="absolute";n.style.top="95px";n.style.left="250px";n.style.width="2000px";n.style.height="30px";n.style.background="whiteSmoke";document.body.appendChild(n);var C=document.createElement("div");C.style.position="absolute";C.style.top="125px";C.style.left="220px";C.style.width="30px";C.style.height="1000px";C.style.background="whiteSmoke";document.body.appendChild(C);
|
||||
var y=document.createElement("div");y.style.position="absolute";y.style.top="95px";y.style.left="220px";y.style.width="30px";y.style.height="30px";y.style.background="whiteSmoke";document.body.appendChild(y);this.vRuler=new mxRuler(this.editor.graph,C,!0);this.hRuler=new mxRuler(this.editor.graph,n,!1)}if("1"==urlParams.test){n=document.getElementById("geFooter");null!=n&&(this.styleInput=document.createElement("input"),this.styleInput.setAttribute("type","text"),this.styleInput.style.position="absolute",
|
||||
this.styleInput.style.top="14px",this.styleInput.style.left="2px",this.styleInput.style.width="98%",this.styleInput.style.visibility="hidden",this.styleInput.style.opacity="0.9",mxEvent.addListener(this.styleInput,"change",mxUtils.bind(this,function(){this.editor.graph.getModel().setStyle(this.editor.graph.getSelectionCell(),this.styleInput.value)})),n.appendChild(this.styleInput),this.editor.graph.getSelectionModel().addListener(mxEvent.CHANGE,mxUtils.bind(this,function(b,a){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 K=this.isSelectionAllowed;this.isSelectionAllowed=function(b){return mxEvent.getSource(b)==this.styleInput?!0:K.apply(this,arguments)}}n=document.getElementById("geInfo");null!=n&&n.parentNode.removeChild(n);if(Graph.fileSupport&&(!this.editor.chromeless||this.editor.editable)){var z=null;mxEvent.addListener(a.container,
|
||||
"dragleave",function(b){a.isEnabled()&&(null!=z&&(z.parentNode.removeChild(z),z=null),b.stopPropagation(),b.preventDefault())});mxEvent.addListener(a.container,"dragover",mxUtils.bind(this,function(b){null==z&&(!mxClient.IS_IE||10<document.documentMode)&&(z=this.highlightElement(a.container));null!=this.sidebar&&this.sidebar.hideTooltip();b.stopPropagation();b.preventDefault()}));mxEvent.addListener(a.container,"drop",mxUtils.bind(this,function(b){null!=z&&(z.parentNode.removeChild(z),z=null);if(a.isEnabled()){var c=
|
||||
mxUtils.convertPoint(a.container,mxEvent.getClientX(b),mxEvent.getClientY(b)),e=a.view.translate,d=a.view.scale,f=c.x/d-e.x,k=c.y/d-e.y;mxEvent.isAltDown(b)&&(k=f=0);if(0<b.dataTransfer.files.length)this.importFiles(b.dataTransfer.files,f,k,this.maxImageSize,null,null,null,null,mxEvent.isControlDown(b),null,null,mxEvent.isShiftDown(b));else{var g=0<=mxUtils.indexOf(b.dataTransfer.types,"text/uri-list")?b.dataTransfer.getData("text/uri-list"):null,c=this.extractGraphModelFromEvent(b,null!=this.pages);
|
||||
if(null!=c)a.setSelectionCells(this.importXml(c,f,k,!0));else if(0<=mxUtils.indexOf(b.dataTransfer.types,"text/html")){var l=b.dataTransfer.getData("text/html"),c=document.createElement("div");c.innerHTML=l;var h=null,e=c.getElementsByTagName("img");null!=e&&1==e.length?(l=e[0].getAttribute("src"),/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(l)||(h=!0)):(c=c.getElementsByTagName("a"),null!=c&&1==c.length&&(l=c[0].getAttribute("href")));var m=!0,v=mxUtils.bind(this,function(){a.setSelectionCells(this.insertTextAt(l,
|
||||
f,k,!0,h,null,m))});h&&l.length>this.resampleThreshold?this.confirmImageResize(function(b){m=b;v()},mxEvent.isControlDown(b)):v()}else null!=g&&/\.(gif|jpg|jpeg|tiff|png|svg)$/i.test(g)?this.loadImage(decodeURIComponent(g),mxUtils.bind(this,function(b){var c=Math.max(1,b.width);b=Math.max(1,b.height);var e=this.maxImageSize,e=Math.min(1,Math.min(e/Math.max(1,c)),e/Math.max(1,b));a.setSelectionCell(a.insertVertex(null,null,"",f,k,c*e,b*e,"shape=image;verticalLabelPosition=bottom;labelBackgroundColor=#ffffff;verticalAlign=top;aspect=fixed;imageAspect=0;image="+
|
||||
g+";"))}),mxUtils.bind(this,function(b){a.setSelectionCells(this.insertTextAt(g,f,k,!0))})):0<=mxUtils.indexOf(b.dataTransfer.types,"text/plain")&&a.setSelectionCells(this.insertTextAt(b.dataTransfer.getData("text/plain"),f,k,!0))}}b.stopPropagation();b.preventDefault()}),!1)}this.initPages();"1"==urlParams.embed&&this.initializeEmbedMode();this.installSettings()};EditorUi.prototype.getLinkTitle=function(b){var a=Graph.prototype.getLinkTitle.apply(this,arguments);if("data:page/id,"==b.substring(0,
|
||||
13)){var c=b.indexOf(",");0<c&&(a=this.getPageById(b.substring(c+1)),a=null!=a?a.getName():mxResources.get("pageNotFound"))}else"data:"==b.substring(0,5)&&(a=mxResources.get("action"));return a};EditorUi.prototype.handleCustomLink=function(b){if("data:page/id,"==b.substring(0,13)){var a=b.indexOf(",");(b=this.getPageById(b.substring(a+1)))&&this.selectPage(b)}else this.editor.graph.handleCustomLink(b)};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.editor.graph.currentEdgeStyle=mxSettings.getCurrentEdgeStyle();this.editor.graph.currentVertexStyle=mxSettings.getCurrentVertexStyle();this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[]));this.addListener("styleChanged",mxUtils.bind(this,function(b,a){mxSettings.setCurrentEdgeStyle(this.editor.graph.currentEdgeStyle);
|
||||
mxSettings.setCurrentVertexStyle(this.editor.graph.currentVertexStyle);mxSettings.save()}));this.editor.graph.connectionHandler.setCreateTarget(mxSettings.isCreateTarget());this.fireEvent(new mxEventObject("copyConnectChanged"));this.addListener("copyConnectChanged",mxUtils.bind(this,function(b,a){mxSettings.setCreateTarget(this.editor.graph.connectionHandler.isCreateTarget());mxSettings.save()}));this.editor.graph.pageFormat=mxSettings.getPageFormat();this.addListener("pageFormatChanged",mxUtils.bind(this,
|
||||
function(b,a){mxSettings.setPageFormat(this.editor.graph.pageFormat);mxSettings.save()}));this.editor.graph.view.gridColor=mxSettings.getGridColor();this.addListener("gridColorChanged",mxUtils.bind(this,function(b,a){mxSettings.setGridColor(this.editor.graph.view.gridColor);mxSettings.save()}));if(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)this.editor.addListener("autosaveChanged",mxUtils.bind(this,function(b,a){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(b,a){var c=this.editor.graph;if(c.isSelectionEmpty())b.innerHTML=
|
||||
"";else{var e=mxUtils.sortCells(c.model.getTopmostCells(c.getSelectionCells())),d=mxUtils.getXml(this.editor.graph.encodeCells(e));mxUtils.setTextContent(b,encodeURIComponent(d));a?(c.removeCells(e,!1),c.lastPasteXml=null):(c.lastPasteXml=d,c.pasteCounter=0);b.focus();document.execCommand("selectAll",!1,null)}};EditorUi.prototype.pasteCells=function(b,a){if(!mxEvent.isConsumed(b)){var c=a.getElementsByTagName("span");if(null!=c&&0<c.length&&"application/vnd.lucid.chart.objects"===c[0].getAttribute("data-lucid-type")){var e=
|
||||
c[0].getAttribute("data-lucid-content");null!=e&&0<e.length&&(this.importLucidChart(e,0,0),mxEvent.consume(b))}else{var e=this.editor.graph,d=mxUtils.trim(mxClient.IS_QUIRKS||8==document.documentMode?mxUtils.getTextContent(a):a.textContent),f=!1;try{var g=d.lastIndexOf("%3E");0<=g&&g<d.length-3&&(d=d.substring(0,g+3))}catch(A){}try{var c=a.getElementsByTagName("span"),h=null!=c&&0<c.length?mxUtils.trim(decodeURIComponent(c[0].textContent)):decodeURIComponent(d);this.isCompatibleString(h)&&(f=!0,d=
|
||||
h)}catch(A){}e.lastPasteXml==d?e.pasteCounter++:(e.lastPasteXml=d,e.pasteCounter=0);c=e.pasteCounter*e.gridSize;if(null!=d&&0<d.length&&(f||this.isCompatibleString(d)?e.setSelectionCells(this.importXml(d,c,c)):(f=e.getInsertPoint(),e.isMouseInsertPoint()&&(c=0,e.lastPasteXml==d&&0<e.pasteCounter&&e.pasteCounter--),e.setSelectionCells(this.insertTextAt(d,f.x+c,f.y+c,!0))),!e.isSelectionEmpty())){e.scrollCellToVisible(e.getSelectionCell());null!=this.hoverIcons&&this.hoverIcons.update(e.view.getState(e.getSelectionCell()));
|
||||
try{mxEvent.consume(b)}catch(A){}}}}};EditorUi.prototype.addFileDropHandler=function(b){if(Graph.fileSupport)for(var a=null,c=0;c<b.length;c++)mxEvent.addListener(b[c],"dragleave",function(b){null!=a&&(a.parentNode.removeChild(a),a=null);b.stopPropagation();b.preventDefault()}),mxEvent.addListener(b[c],"dragover",mxUtils.bind(this,function(b){(this.editor.graph.isEnabled()||"1"!=urlParams.embed)&&null==a&&(!mxClient.IS_IE||10<document.documentMode&&12>document.documentMode)&&(a=this.highlightElement());
|
||||
b.stopPropagation();b.preventDefault()})),mxEvent.addListener(b[c],"drop",mxUtils.bind(this,function(b){null!=a&&(a.parentNode.removeChild(a),a=null);if(this.editor.graph.isEnabled()||"1"!=urlParams.embed)if(0<b.dataTransfer.files.length)this.hideDialog(),"1"==urlParams.embed?this.importFiles(b.dataTransfer.files,0,0,this.maxImageSize,null,null,null,null,!mxEvent.isControlDown(b)&&!mxEvent.isShiftDown(b)):this.openFiles(b.dataTransfer.files,!0);else{var c=this.extractGraphModelFromEvent(b);if(null==
|
||||
c){var e=null!=b.dataTransfer?b.dataTransfer:b.clipboardData;null!=e&&(10==document.documentMode||11==document.documentMode?c=e.getData("Text"):(c=null,c=0<=mxUtils.indexOf(e.types,"text/uri-list")?b.dataTransfer.getData("text/uri-list"):0<=mxUtils.indexOf(e.types,"text/html")?e.getData("text/html"):null,null!=c&&0<c.length?(e=document.createElement("div"),e.innerHTML=c,e=e.getElementsByTagName("img"),0<e.length&&(c=e[0].getAttribute("src"))):0<=mxUtils.indexOf(e.types,"text/plain")&&(c=e.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(b){200<=b.getStatus()&&299>=b.getStatus()&&this.openLocalFile(b.getText(),null,!0)})):/^https?:\/\//.test(c)&&(null==this.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(c):window.openWindow((mxClient.IS_CHROMEAPP?
|
||||
"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(c)))))}else this.openLocalFile(c,null,!0)}b.stopPropagation();b.preventDefault()}))};EditorUi.prototype.highlightElement=function(b){var a=0,c=0,d,f;if(null==b){f=document.body;var g=document.documentElement;d=(f.clientWidth||g.clientWidth)-3;f=Math.max(f.clientHeight||0,g.clientHeight)-3}else a=b.offsetTop,c=b.offsetLeft,d=b.clientWidth,f=b.clientHeight;g=document.createElement("div");g.style.zIndex=
|
||||
mxPopupMenu.prototype.zIndex+2;g.style.border="3px dotted rgb(254, 137, 12)";g.style.pointerEvents="none";g.style.position="absolute";g.style.top=a+"px";g.style.left=c+"px";g.style.width=Math.max(0,d-3)+"px";g.style.height=Math.max(0,f-3)+"px";null!=b&&b.parentNode==this.editor.graph.container?this.editor.graph.container.appendChild(g):document.body.appendChild(g);return g};EditorUi.prototype.stringToCells=function(b){b=mxUtils.parseXml(b);var a=this.editor.extractGraphModel(b.documentElement);b=
|
||||
[];if(null!=a){var c=new mxCodec(a.ownerDocument),d=new mxGraphModel;c.decode(a,d);a=d.getChildAt(d.getRoot(),0);for(c=0;c<d.getChildCount(a);c++)b.push(d.getChildAt(a,c))}return b};EditorUi.prototype.openFiles=function(b,a){if(this.spinner.spin(document.body,mxResources.get("loading")))for(var c=0;c<b.length;c++)mxUtils.bind(this,function(b){var c=new FileReader;c.onload=mxUtils.bind(this,function(c){var e=c.target.result,d=b.name;if(null!=d&&0<d.length){!this.useCanvasForExport&&/(\.png)$/i.test(d)&&
|
||||
(d=d.substring(0,d.length-4)+".xml");var f=mxUtils.bind(this,function(b){d=0<=d.lastIndexOf(".")?d.substring(0,d.lastIndexOf("."))+".xml":d+".xml";if("<mxlibrary"==b.substring(0,10)){null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,a);try{this.loadLibrary(new LocalLibrary(this,b,d))}catch(v){this.handleError(v,mxResources.get("errorLoadingFile"))}}else this.openLocalFile(b,d,a)});if(/(\.vsdx?)($|\?)/i.test(d)||/(\.vssx)($|\?)/i.test(d))this.importVisio(b,
|
||||
mxUtils.bind(this,function(b){this.spinner.stop();f(b)}));else if(Graph.fileSupport&&!this.isOffline()&&(new XMLHttpRequest).upload&&this.isRemoteFileFormat(e,d))this.parseFile(b,mxUtils.bind(this,function(b){4==b.readyState&&(this.spinner.stop(),200<=b.status&&299>=b.status?f(b.responseText):this.handleError({message:mxResources.get(413==b.status?"drawingTooLarge":"invalidOrMissingFile")},mxResources.get("errorLoadingFile")))}));else if('{"state":"{\\"Properties\\":'==e.substring(0,26))/(\.json)$/i.test(d)&&
|
||||
(d=d.substring(0,d.length-5)+".xml"),this.openLocalFile(this.emptyDiagramXml,d,a),this.importLucidChart(e,0,0,null,mxUtils.bind(this,function(){this.editor.undoManager.clear();this.spinner.stop()}));else if("<mxlibrary"==c.target.result.substring(0,10)){this.spinner.stop();null==this.getCurrentFile()&&"1"!=urlParams.embed&&this.openLocalFile(this.emptyDiagramXml,this.defaultFilename,a);try{this.loadLibrary(new LocalLibrary(this,c.target.result,b.name))}catch(k){this.handleError(k,mxResources.get("errorLoadingFile"))}}else"image/png"==
|
||||
b.type.substring(0,9)&&(e=this.extractGraphModelFromPng(e)),this.spinner.stop(),this.openLocalFile(e,d,a)}});c.onerror=mxUtils.bind(this,function(b){this.spinner.stop();this.handleError(b);window.openFile=null});"image"===b.type.substring(0,5)&&"image/svg"!==b.type.substring(0,9)?c.readAsDataURL(b):c.readAsText(b)})(b[c])};EditorUi.prototype.openLocalFile=function(b,a,c){var e=this.getCurrentFile(),d=mxUtils.bind(this,function(){window.openFile=null;if(null==a&&null!=this.getCurrentFile()&&this.isDiagramEmpty()){var e=
|
||||
mxUtils.parseXml(b);null!=e&&(this.editor.setGraphXml(e.documentElement),this.editor.graph.selectAll())}else this.fileLoaded(new LocalFile(this,b,a||this.defaultFilename,c))});null!=b&&0<b.length&&(null==e||!e.isModified()&&(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)?d():(mxClient.IS_CHROMEAPP||EditorUi.isElectronApp)&&null!=e&&e.isModified()?this.confirm(mxResources.get("allChangesLost"),null,d,mxResources.get("cancel"),mxResources.get("discardChanges")):(window.openFile=new OpenFile(function(){window.openFile=
|
||||
null}),window.openFile.setData(b,a),window.openWindow(this.getUrl(),null,mxUtils.bind(this,function(){this.confirm(mxResources.get("allChangesLost"),null,d,mxResources.get("cancel"),mxResources.get("discardChanges"))}))))};EditorUi.prototype.getBasenames=function(){var b={};if(null!=this.pages)for(var a=0;a<this.pages.length;a++)this.updatePageRoot(this.pages[a]),this.addBasenamesForCell(this.pages[a].root,b);else this.addBasenamesForCell(this.editor.graph.model.getRoot(),b);var a=[],c;for(c in b)a.push(c);
|
||||
return a};EditorUi.prototype.addBasenamesForCell=function(b,a){function c(b){if(null!=b){var c=b.lastIndexOf(".");0<c&&(b=b.substring(c+1,b.length));null==a[b]&&(a[b]=!0)}}var e=this.editor.graph,d=e.getCellStyle(b);c(mxStencilRegistry.getBasenameForStencil(d[mxConstants.STYLE_SHAPE]));e.model.isEdge(b)&&(c(mxMarker.getPackageForType(d[mxConstants.STYLE_STARTARROW])),c(mxMarker.getPackageForType(d[mxConstants.STYLE_ENDARROW])));for(var d=e.model.getChildCount(b),f=0;f<d;f++)this.addBasenamesForCell(e.model.getChildAt(b,
|
||||
f),a)};EditorUi.prototype.setGraphEnabled=function(b){this.diagramContainer.style.visibility=b?"":"hidden";this.formatContainer.style.visibility=b?"":"hidden";this.sidebarFooterContainer.style.display=b?"":"none";this.sidebarContainer.style.display=b?"":"none";this.hsplit.style.display=b?"":"none";this.editor.graph.setEnabled(b);null!=this.tabContainer&&(this.tabContainer.style.visibility=b?"":"hidden");b||(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(b,a,c){this.spinner.stop();this.addEmbedButtons();this.setGraphEnabled(!0);
|
||||
null!=b&&0<b.length?(this.setFileData(b),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(b,a){null!=b?b.getPublicUrl(a):a(null)};EditorUi.prototype.createLoadMessage=function(b){var a=this.editor.graph;return{event:b,pageVisible:a.pageVisible,translate:a.view.translate,scale:a.view.scale,page:a.view.getBackgroundPageBounds(),bounds:a.getGraphBounds()}};
|
||||
EditorUi.prototype.installMessageHandler=function(b){var a=null,c=!1,d=!1,f=null,g=mxUtils.bind(this,function(b,a){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,g);mxEvent.addListener(window,"message",mxUtils.bind(this,function(e){function g(b){if(null!=b&&"function"===typeof b.charAt&&"<"!=b.charAt(0))try{"data:image/svg+xml;base64,"==
|
||||
b.substring(0,26)?b=atob(b.substring(26)):"data:image/svg+xml;utf8,"==b.substring(0,24)&&(b=b.substring(24)),null!=b&&("%"==b.charAt(0)?b=decodeURIComponent(b):"<"!=b.charAt(0)&&(b=this.editor.graph.decompress(b)))}catch(J){}return b}if(e.source==(window.opener||window.parent)){var k=e.data;if("json"==urlParams.proto){try{k=JSON.parse(k)}catch(E){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();var l=new FilenameDialog(this,k.defaultValue||"",null!=k.okKey?mxResources.get(k.okKey):null,function(b){null!=b&&h.postMessage(JSON.stringify({event:"prompt",value:b,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){l=null;l="data:image/png;base64,"==
|
||||
k.xml.substring(0,22)?this.extractGraphModelFromPng(k.xml):g(k.xml);this.spinner.stop();l=new DraftDialog(this,mxResources.get("draftFound",[k.name||this.defaultFilename]),l,mxUtils.bind(this,function(){this.hideDialog();h.postMessage(JSON.stringify({event:"draft",result:"edit",message:k}),"*")}),mxUtils.bind(this,function(){this.hideDialog();h.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();h.postMessage(JSON.stringify({event:"draft",result:"ignore",message:k}),"*")}):null);this.showDialog(l.container,640,480,!0,!1,mxUtils.bind(this,function(b){b&&this.actions.get("exit").funct()}));try{l.init()}catch(E){h.postMessage(JSON.stringify({event:"draft",error:E.toString(),message:k}),"*")}return}if("template"==k.action){this.spinner.stop();var l=1==k.enableRecent,m=1==k.enableSearch,l=new NewDialog(this,!1,null!=k.callback,mxUtils.bind(this,
|
||||
function(a,c){a=a||this.emptyDiagramXml;null!=k.callback?h.postMessage(JSON.stringify({event:"template",xml:a,blank:a==this.emptyDiagramXml,name:c}),"*"):(b(a,e,a!=this.emptyDiagramXml),this.editor.modified||this.editor.setStatus(""))}),null,null,null,null,null,null,null,l?mxUtils.bind(this,function(b){this.recentReadyCallback=b;h.postMessage(JSON.stringify({event:"recentDocs"}),"*")}):null,m?mxUtils.bind(this,function(b,a){this.searchReadyCallback=a;h.postMessage(JSON.stringify({event:"searchDocs",
|
||||
searchStr:b}),"*")}):null,function(b,a,c){h.postMessage(JSON.stringify({event:"template",docUrl:b,info:a,name:c}),"*")});this.showDialog(l.container,620,440,!0,!1,mxUtils.bind(this,function(b){b&&this.actions.get("exit").funct()}));l.init();return}if("searchDocsList"==k.action)this.searchReadyCallback(k.list,k.errorMsg);else if("recentDocsList"==k.action)this.recentReadyCallback(k.list,k.errorMsg);else{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 n=null!=k.messageKey?mxResources.get(k.messageKey):k.message;null==k.show||k.show?this.spinner.spin(document.body,n):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 p=null!=k.xml?
|
||||
k.xml:this.getFileData(!0);this.editor.graph.setEnabled(!1);var q=this.editor.graph,w=mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();var a=this.createLoadMessage("export");a.format=k.format;a.message=k;a.data=b;a.xml=encodeURIComponent(p);h.postMessage(JSON.stringify(a),"*")}),t=mxUtils.bind(this,function(b){null==b&&(b=Editor.blankImage);"xmlpng"==k.format&&(b=this.writeGraphModelToPng(b,"zTXt","mxGraphModel",atob(this.editor.graph.compress(p))));q!=this.editor.graph&&
|
||||
q.container.parentNode.removeChild(q.container);w(b)});if(this.isExportToCanvas()){if(null!=this.pages&&this.currentPage!=this.pages[0]){var q=this.createTemporaryGraph(q.getStylesheet()),u=q.getGlobalVariable,B=this.pages[0];q.getGlobalVariable=function(b){return"page"==b?B.getName():"pagenumber"==b?1:u.apply(this,arguments)};document.body.appendChild(q.container);q.model.setRoot(B.root)}this.exportToCanvas(mxUtils.bind(this,function(b){t(b.toDataURL("image/png"))}),null,null,null,mxUtils.bind(this,
|
||||
function(){t(null)}),null,null,null,null,null,null,q)}else(new mxXmlRequest(EXPORT_URL,"format=png&embedXml="+("xmlpng"==k.format?"1":"0")+"&base64=1&xml="+encodeURIComponent(encodeURIComponent(p)))).send(mxUtils.bind(this,function(b){200<=b.getStatus()&&299>=b.getStatus()?w("data:image/png;base64,"+b.getText()):t(null)}),mxUtils.bind(this,function(){t(null)}))}}else{null!=k.xml&&0<k.xml.length&&this.setFileData(k.xml);n=this.createLoadMessage("export");if("html2"==k.format||"html"==k.format&&("0"!=
|
||||
urlParams.pages||null!=this.pages&&1<this.pages.length))l=this.getXmlFileData(),n.xml=mxUtils.getXml(l),n.data=this.getFileData(null,null,!0,null,null,null,l),n.format=k.format;else if("html"==k.format)p=this.editor.getGraphXml(),n.data=this.getHtml(p,this.editor.graph),n.xml=mxUtils.getXml(p),n.format=k.format;else{mxSvgCanvas2D.prototype.foAltText=null;l=this.editor.graph.background;l==mxConstants.NONE&&(l=null);n.xml=this.getFileData(!0);n.format="svg";if(k.embedImages||null==k.embedImages){if(null==
|
||||
k.spin&&null==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(n.xml,this.editor.graph,null,!0,mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();n.data=this.createSvgDataUri(b);h.postMessage(JSON.stringify(n),"*")})):this.convertImages(this.editor.graph.getSvg(l),mxUtils.bind(this,function(b){this.editor.graph.setEnabled(!0);this.spinner.stop();n.data=
|
||||
this.createSvgDataUri(mxUtils.getXml(b));h.postMessage(JSON.stringify(n),"*")}));return}l="xmlsvg"==k.format?this.getEmbeddedSvg(this.getFileData(!0),this.editor.graph,null,!0):mxUtils.getXml(this.editor.graph.getSvg(l));n.data=this.createSvgDataUri(l)}h.postMessage(JSON.stringify(n),"*")}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&&(l=document.createElement("span"),mxUtils.write(l,k.title),"atlas"==uiTheme?(this.buttonContainer.style.paddingRight="12px",this.buttonContainer.style.paddingTop="12px"):"min"!=uiTheme&&(this.buttonContainer.style.paddingRight="38px",this.buttonContainer.style.paddingTop="6px"),null!=this.embedFilenameSpan&&this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan),this.buttonContainer.appendChild(l),this.embedFilenameSpan=l),k=null!=k.xmlpng?
|
||||
this.extractGraphModelFromPng(k.xmlpng):null!=k.xml&&"data:image/png;base64,"==k.xml.substring(0,22)?this.extractGraphModelFromPng(k.xml):k.xml;else{h.postMessage(JSON.stringify({error:"unknownMessage",data:JSON.stringify(k)}),"*");return}}}k=g(k);c=!0;try{b(k,e)}catch(E){this.handleError(E)}c=!1;null!=urlParams.modified&&this.editor.setStatus("");var x=mxUtils.bind(this,function(){return"0"!=urlParams.pages||null!=this.pages&&1<this.pages.length?this.getFileData(!0):mxUtils.getXml(this.editor.getGraphXml())});
|
||||
f=x();d&&null==a&&(a=mxUtils.bind(this,function(b,a){var e=x();if(e!=f&&!c){var d=this.createLoadMessage("autosave");d.xml=e;e=JSON.stringify(d);(window.opener||window.parent).postMessage(e,"*")}f=e}),this.editor.graph.model.addListener(mxEvent.CHANGE,a),this.editor.graph.addListener("gridSizeChanged",a),this.editor.graph.addListener("shadowVisibleChanged",a),this.addListener("pageFormatChanged",a),this.addListener("pageScaleChanged",a),this.addListener("backgroundColorChanged",a),this.addListener("backgroundImageChanged",
|
||||
a),this.addListener("foldingEnabledChanged",a),this.addListener("mathEnabledChanged",a),this.addListener("gridEnabledChanged",a),this.addListener("guidesEnabledChanged",a),this.addListener("pageViewChanged",a));"1"!=urlParams.returnbounds&&"json"!=urlParams.proto||h.postMessage(JSON.stringify(this.createLoadMessage("load")),"*")}}));var h=window.opener||window.parent,g="json"==urlParams.proto?JSON.stringify({event:"init"}):urlParams.ready||"ready";h.postMessage(g,"*")};EditorUi.prototype.addEmbedButtons=
|
||||
function(){if(null!=this.menubar){var b=document.createElement("div");b.style.display="inline-block";b.style.position="absolute";b.style.paddingTop="atlas"==uiTheme?"2px":"3px";b.style.paddingLeft="8px";b.style.paddingBottom="2px";var a=document.createElement("button");mxUtils.write(a,mxResources.get("save"));a.setAttribute("title",mxResources.get("save")+" ("+Editor.ctrlKey+"+S)");a.className="geBigButton";a.style.fontSize="12px";a.style.padding="4px 6px 4px 6px";a.style.borderRadius="3px";mxEvent.addListener(a,
|
||||
"click",mxUtils.bind(this,function(){this.actions.get("save").funct()}));b.appendChild(a);"1"==urlParams.saveAndExit&&(a=document.createElement("a"),mxUtils.write(a,mxResources.get("saveAndExit")),a.setAttribute("title",mxResources.get("saveAndExit")),a.style.fontSize="12px",a.style.marginLeft="6px",a.style.padding="4px",a.style.cursor="pointer",mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("saveAndExit").funct()})),b.appendChild(a));a=document.createElement("a");mxUtils.write(a,
|
||||
mxResources.get("exit"));a.setAttribute("title",mxResources.get("exit"));a.style.fontSize="12px";a.style.marginLeft="6px";a.style.marginRight="20px";a.style.padding="4px";a.style.cursor="pointer";mxEvent.addListener(a,"click",mxUtils.bind(this,function(){this.actions.get("exit").funct()}));b.appendChild(a);this.toolbar.container.appendChild(b);this.toolbar.staticElements.push(b);b.style.right="atlas"!=uiTheme?"52px":"42px"}};EditorUi.prototype.showImportCsvDialog=function(){null==this.importCsvDialog&&
|
||||
(this.importCsvDialog=new TextareaDialog(this,mxResources.get("csv")+":",Editor.defaultCsvValue,mxUtils.bind(this,function(b){this.importCsv(b)}),null,null,620,430,null,!0,!0,mxResources.get("import")));this.showDialog(this.importCsvDialog.container,640,520,!0,!0);this.importCsvDialog.init()};EditorUi.prototype.importCsv=function(b,a){try{var c=b.split("\n"),e=[];if(0<c.length){var d={},f=null,g=null,h="",m="auto",k="auto",n=null,p=null,C=40,y=40,K=0,z=this.editor.graph;z.getGraphBounds();for(var D=
|
||||
function(){null!=a?a(aa):(z.setSelectionCells(aa),z.scrollCellToVisible(z.getSelectionCell()))},L=z.getFreeInsertPoint(),B=L.x,H=L.y,L=H,E=null,J="auto",M=[],X=null,Z=null,N=0;N<c.length&&"#"==c[N].charAt(0);){b=c[N];for(N++;N<c.length&&"\\"==b.charAt(b.length-1)&&"#"==c[N].charAt(0);)b=b.substring(0,b.length-1)+mxUtils.trim(c[N].substring(1)),N++;if("#"!=b.charAt(1)){var S=b.indexOf(":");if(0<S){var O=mxUtils.trim(b.substring(1,S)),G=mxUtils.trim(b.substring(S+1));"label"==O?E=z.sanitizeHtml(G):
|
||||
"style"==O?f=G:"identity"==O&&0<G.length&&"-"!=G?g=G:"namespace"==O&&0<G.length&&"-"!=G?h=G:"width"==O?m=G:"height"==O?k=G:"left"==O&&0<G.length?n=G:"top"==O&&0<G.length?p=G:"ignore"==O?Z=G.split(","):"connect"==O?M.push(JSON.parse(G)):"link"==O?X=G:"padding"==O?K=parseFloat(G):"edgespacing"==O?C=parseFloat(G):"nodespacing"==O?y=parseFloat(G):"layout"==O&&(J=G)}}}var W=this.editor.csvToArray(c[N]),S=null;if(null!=g)for(var R=0;R<W.length;R++)if(g==W[R]){S=R;break}null==E&&(E="%"+W[0]+"%");if(null!=
|
||||
M)for(var T=0;T<M.length;T++)null==d[M[T].to]&&(d[M[T].to]={});z.model.beginUpdate();try{for(R=N+1;R<c.length;R++){var V=this.editor.csvToArray(c[R]);if(V.length==W.length){var I=null,Q=null!=S?h+V[S]:null;null!=Q&&(I=z.model.getCell(Q));null==I&&(I=new mxCell(E,new mxGeometry(B,L,0,0),f||"whiteSpace=wrap;html=1;"),I.vertex=!0,I.id=Q);for(var P=0;P<V.length;P++)z.setAttributeForCell(I,W[P],V[P]);z.setAttributeForCell(I,"placeholders","1");I.style=z.replacePlaceholders(I,I.style);for(T=0;T<M.length;T++)d[M[T].to][I.getAttribute(M[T].to)]=
|
||||
I;null!=X&&"link"!=X&&(z.setLinkForCell(I,I.getAttribute(X)),z.setAttributeForCell(I,X,null));z.fireEvent(new mxEventObject("cellsInserted","cells",[I]));var ba=this.editor.graph.getPreferredSizeForCell(I);I.vertex&&(null!=n&&null!=I.getAttribute(n)&&(I.geometry.x=B+parseFloat(I.getAttribute(n))),null!=p&&null!=I.getAttribute(p)&&(I.geometry.y=H+parseFloat(I.getAttribute(p))),"@"==m.charAt(0)&&null!=I.getAttribute(m.substring(1))?I.geometry.width=parseFloat(I.getAttribute(m.substring(1))):I.geometry.width=
|
||||
"auto"==m?ba.width+K:parseFloat(m),"@"==k.charAt(0)&&null!=I.getAttribute(k.substring(1))?I.geometry.height=parseFloat(I.getAttribute(k.substring(1))):I.geometry.height="auto"==k?ba.height+K:parseFloat(k),L+=I.geometry.height+y);e.push(z.addCell(I))}}for(var U=e.slice(),aa=e.slice(),T=0;T<M.length;T++)for(var Y=M[T],R=0;R<e.length;R++){var I=e[R],ia=I.getAttribute(Y.from);if(null!=ia){z.setAttributeForCell(I,Y.from,null);for(var ja=ia.split(","),P=0;P<ja.length;P++){var ca=d[Y.to][ja[P]];null!=ca&&
|
||||
(E=Y.label,null!=Y.fromlabel&&(E=(I.getAttribute(Y.fromlabel)||"")+(E||"")),null!=Y.tolabel&&(E=(E||"")+(ca.getAttribute(Y.tolabel)||"")),aa.push(z.insertEdge(null,null,E||"",Y.invert?ca:I,Y.invert?I:ca,Y.style||z.createCurrentEdgeStyle())),mxUtils.remove(Y.invert?I:ca,U))}}}if(null!=Z)for(R=0;R<e.length;R++)for(I=e[R],P=0;P<Z.length;P++)z.setAttributeForCell(I,mxUtils.trim(Z[P]),null);var fa=new mxParallelEdgeLayout(z);fa.spacing=C;var ka=function(){fa.execute(z.getDefaultParent());for(var b=0;b<
|
||||
e.length;b++){var a=z.getCellGeometry(e[b]);a.x=Math.round(z.snap(a.x));a.y=Math.round(z.snap(a.y));"auto"==m&&(a.width=Math.round(z.snap(a.width)));"auto"==k&&(a.height=Math.round(z.snap(a.height)))}};if("circle"==J){var da=new mxCircleLayout(z);da.resetEdges=!1;var la=da.isVertexIgnored;da.isVertexIgnored=function(b){return la.apply(this,arguments)||0>mxUtils.indexOf(e,b)};this.executeLayout(function(){da.execute(z.getDefaultParent());ka()},!0,D);D=null}else if("horizontaltree"==J||"verticaltree"==
|
||||
J||"auto"==J&&aa.length==2*e.length-1&&1==U.length){z.view.validate();var ga=new mxCompactTreeLayout(z,"horizontaltree"==J);ga.levelDistance=y;ga.edgeRouting=!1;ga.resetEdges=!1;this.executeLayout(function(){ga.execute(z.getDefaultParent(),0<U.length?U[0]:null)},!0,D);D=null}else if("horizontalflow"==J||"verticalflow"==J||"auto"==J&&1==U.length){z.view.validate();var ha=new mxHierarchicalLayout(z,"horizontalflow"==J?mxConstants.DIRECTION_WEST:mxConstants.DIRECTION_NORTH);ha.intraCellSpacing=y;ha.disableEdgeStyle=
|
||||
!1;this.executeLayout(function(){ha.execute(z.getDefaultParent(),aa);z.moveCells(aa,B,H)},!0,D);D=null}else if("organic"==J||"auto"==J&&aa.length>e.length){z.view.validate();var ea=new mxFastOrganicLayout(z);ea.forceConstant=3*y;ea.resetEdges=!1;var na=ea.isVertexIgnored;ea.isVertexIgnored=function(b){return na.apply(this,arguments)||0>mxUtils.indexOf(e,b)};fa=new mxParallelEdgeLayout(z);fa.spacing=C;this.executeLayout(function(){ea.execute(z.getDefaultParent());ka()},!0,D);D=null}this.hideDialog()}finally{z.model.endUpdate()}null!=
|
||||
D&&D()}}catch(ma){this.handleError(ma)}};EditorUi.prototype.getSearch=function(b){var a="";if("1"!=urlParams.offline&&"1"!=urlParams.demo&&null!=b&&0<window.location.search.length){var c="?",d;for(d in urlParams)0>mxUtils.indexOf(b,d)&&null!=urlParams[d]&&(a+=c+d+"="+urlParams[d],c="&")}else a=window.location.search;return a};EditorUi.prototype.getUrl=function(b){b=null!=b?b:window.location.pathname;var a=0<b.indexOf("?")?1:0;if("1"==urlParams.offline)b+=window.location.search;else{var c="tmp libs clibs state fileId code share notitle data url embed client create title splash".split(" "),
|
||||
d;for(d in urlParams)0>mxUtils.indexOf(c,d)&&(b=0==a?b+"?":b+"&",null!=urlParams[d]&&(b+=d+"="+urlParams[d],a++))}return b};EditorUi.prototype.showLinkDialog=function(b,a,c){b=new LinkDialog(this,b,a,c,!0);this.showDialog(b.container,480,130,!0,!0);b.init()};var m=EditorUi.prototype.createOutline;EditorUi.prototype.createOutline=function(b){var a=m.apply(this,arguments),c=this.editor.graph,d=a.getSourceGraphBounds;a.getSourceGraphBounds=function(){if(mxUtils.hasScrollbars(c.container)&&c.pageVisible&&
|
||||
null!=this.source.minimumGraphSize){var b=this.source.getPagePadding(),a=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width-2*b.x/a),Math.ceil(this.source.minimumGraphSize.height-2*b.y/a))}return d.apply(this,arguments)};var f=a.getSourceContainerSize;a.getSourceContainerSize=function(){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var b=this.source.getPagePadding(),a=this.source.view.scale;return new mxRectangle(0,0,Math.ceil(this.source.minimumGraphSize.width*
|
||||
a-2*b.x),Math.ceil(this.source.minimumGraphSize.height*a-2*b.y))}return f.apply(this,arguments)};a.getOutlineOffset=function(b){if(mxUtils.hasScrollbars(c.container)&&null!=this.source.minimumGraphSize){var e=this.source.getPagePadding();return new mxPoint(Math.round(Math.max(0,(a.outline.container.clientWidth/b-(this.source.minimumGraphSize.width-2*e.x))/2)-e.x),Math.round(Math.max(0,(a.outline.container.clientHeight/b-(this.source.minimumGraphSize.height-2*e.y))/2)-e.y-5/b))}return new mxPoint(8/
|
||||
b,8/b)};var g=a.init;a.init=function(){g.apply(this,arguments);a.outline.view.getBackgroundPageBounds=function(){var b=c.getPageLayout(),a=c.getPageSize();return new mxRectangle(this.scale*(this.translate.x+b.x*a.width),this.scale*(this.translate.y+b.y*a.height),this.scale*b.width*a.width,this.scale*b.height*a.height)};a.outline.view.validateBackgroundPage()};this.editor.addListener("pageSelected",function(b,c){var e=c.getProperty("change"),d=a.source,f=a.outline;f.pageScale=d.pageScale;f.pageFormat=
|
||||
d.pageFormat;f.background=d.background;f.pageVisible=d.pageVisible;f.background=d.background;var g=mxUtils.getCurrentStyle(d.container);f.container.style.backgroundColor=g.backgroundColor;null!=d.view.backgroundPageShape&&null!=f.view.backgroundPageShape&&(f.view.backgroundPageShape.fill=d.view.backgroundPageShape.fill);a.outline.view.clear(e.previousPage.root,!0);a.outline.view.validate()});return a};EditorUi.prototype.getServiceCount=function(b,a){var c=0;null==this.drive&&"function"!==typeof window.DriveClient||
|
||||
c++;a||null==this.dropbox&&"function"!==typeof window.DropboxClient||c++;null==this.oneDrive&&"function"!==typeof window.OneDriveClient||c++;a||null==this.gitHub||c++;a||null==this.trello&&"function"!==typeof window.TrelloClient||c++;b&&isLocalStorage&&("1"==urlParams.browser||mxClient.IS_IOS)&&c++;mxClient.IS_IOS||c++;return c};EditorUi.prototype.updateUi=function(){this.updateButtonContainer();this.updateActionStates();var b=this.getCurrentFile(),a=null!=b||"1"==urlParams.embed&&this.editor.graph.isEnabled();
|
||||
this.menus.get("viewPanels").setEnabled(a);this.menus.get("viewZoom").setEnabled(a);var c=("1"!=urlParams.embed||!this.editor.graph.isEnabled())&&(null==b||b.isRestricted());this.actions.get("makeCopy").setEnabled(!c);this.actions.get("print").setEnabled(!c);this.menus.get("exportAs").setEnabled(!c);this.menus.get("embed").setEnabled(!c);c="1"!=urlParams.embed||this.editor.graph.isEnabled();this.menus.get("extras").setEnabled(c);Editor.enableCustomLibraries&&(this.menus.get("openLibraryFrom").setEnabled(c),
|
||||
|
@ -7512,7 +7513,7 @@ this.actions.get("editData").setEnabled(a);this.actions.get("shadowVisible").set
|
|||
this.actions.get("moveToFolder").setEnabled(null!=c);this.actions.get("makeCopy").setEnabled(null!=c&&!c.isRestricted());this.actions.get("editDiagram").setEnabled(a&&(null==c||!c.isRestricted()));this.actions.get("publishLink").setEnabled(null!=c&&!c.isRestricted());this.actions.get("tags").setEnabled(a&&(null==c||!c.isRestricted()));this.actions.get("find").setEnabled("hidden"!=this.diagramContainer.style.visibility);this.actions.get("layers").setEnabled("hidden"!=this.diagramContainer.style.visibility);
|
||||
this.actions.get("outline").setEnabled("hidden"!=this.diagramContainer.style.visibility);this.actions.get("rename").setEnabled(null!=c&&c.isRenamable()||"1"==urlParams.embed);this.actions.get("close").setEnabled(null!=c);this.menus.get("publish").setEnabled(null!=c&&!c.isRestricted());b=b.view.getState(b.getSelectionCell());this.actions.get("editShape").setEnabled(a&&null!=b&&null!=b.shape&&null!=b.shape.stencil)};var p=EditorUi.prototype.destroy;EditorUi.prototype.destroy=function(){null!=this.exportDialog&&
|
||||
(this.exportDialog.parentNode.removeChild(this.exportDialog),this.exportDialog=null);p.apply(this,arguments)};null!=window.ExportDialog&&(ExportDialog.showXmlOption=!1,ExportDialog.showGifOption=!1,ExportDialog.exportFile=function(b,a,c,d,f,g){var e=b.editor.graph;if("xml"==c)b.hideDialog(),b.saveData(a,"xml",mxUtils.getXml(b.editor.getGraphXml()),"text/xml");else if("svg"==c)b.hideDialog(),b.saveData(a,"svg",mxUtils.getXml(e.getSvg(d,f,g)),"image/svg+xml");else{var h=b.getFileData(!0,null,null,null,
|
||||
null,!0),l=e.getGraphBounds(),k=Math.floor(l.width*f/e.view.scale),m=Math.floor(l.height*f/e.view.scale);h.length<=MAX_REQUEST_SIZE&&k*m<MAX_AREA?(b.hideDialog(),b.saveRequest(a,c,function(b,a){return new mxXmlRequest(EXPORT_URL,"format="+c+"&base64="+(a||"0")+(null!=b?"&filename="+encodeURIComponent(b):"")+"&bg="+(null!=d?d:"none")+"&w="+k+"&h="+m+"&border="+g+"&xml="+encodeURIComponent(h))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();var mxSettings={currentVersion:16,defaultFormatWidth:600>screen.width?"0":"240",key:".drawio-config",getLanguage:function(){return mxSettings.settings.language},setLanguage:function(a){mxSettings.settings.language=a},getUi:function(){return mxSettings.settings.ui},setUi:function(a){mxSettings.settings.ui=a},getShowStartScreen:function(){return mxSettings.settings.showStartScreen},setShowStartScreen:function(a){mxSettings.settings.showStartScreen=a},getGridColor:function(){return mxSettings.settings.gridColor},
|
||||
null,!0),m=e.getGraphBounds(),k=Math.floor(m.width*f/e.view.scale),l=Math.floor(m.height*f/e.view.scale);h.length<=MAX_REQUEST_SIZE&&k*l<MAX_AREA?(b.hideDialog(),b.saveRequest(a,c,function(b,a){return new mxXmlRequest(EXPORT_URL,"format="+c+"&base64="+(a||"0")+(null!=b?"&filename="+encodeURIComponent(b):"")+"&bg="+(null!=d?d:"none")+"&w="+k+"&h="+l+"&border="+g+"&xml="+encodeURIComponent(h))})):mxUtils.alert(mxResources.get("drawingTooLarge"))}})})();var mxSettings={currentVersion:16,defaultFormatWidth:600>screen.width?"0":"240",key:".drawio-config",getLanguage:function(){return mxSettings.settings.language},setLanguage:function(a){mxSettings.settings.language=a},getUi:function(){return mxSettings.settings.ui},setUi:function(a){mxSettings.settings.ui=a},getShowStartScreen:function(){return mxSettings.settings.showStartScreen},setShowStartScreen:function(a){mxSettings.settings.showStartScreen=a},getGridColor:function(){return mxSettings.settings.gridColor},
|
||||
setGridColor:function(a){mxSettings.settings.gridColor=a},getAutosave:function(){return mxSettings.settings.autosave},setAutosave:function(a){mxSettings.settings.autosave=a},getResizeImages:function(){return mxSettings.settings.resizeImages},setResizeImages:function(a){mxSettings.settings.resizeImages=a},getOpenCounter:function(){return mxSettings.settings.openCounter},setOpenCounter:function(a){mxSettings.settings.openCounter=a},getLibraries:function(){return mxSettings.settings.libraries},setLibraries:function(a){mxSettings.settings.libraries=
|
||||
a},addCustomLibrary:function(a){mxSettings.load();0>mxUtils.indexOf(mxSettings.settings.customLibraries,a)&&("L.scratchpad"===a?mxSettings.settings.customLibraries.splice(0,0,a):mxSettings.settings.customLibraries.push(a));mxSettings.save()},removeCustomLibrary:function(a){mxSettings.load();mxUtils.remove(a,mxSettings.settings.customLibraries);mxSettings.save()},getCustomLibraries:function(){return mxSettings.settings.customLibraries},getPlugins:function(){return mxSettings.settings.plugins},setPlugins:function(a){mxSettings.settings.plugins=
|
||||
a},getRecentColors:function(){return mxSettings.settings.recentColors},setRecentColors:function(a){mxSettings.settings.recentColors=a},getFormatWidth:function(){return parseInt(mxSettings.settings.formatWidth)},setFormatWidth:function(a){mxSettings.settings.formatWidth=a},getCurrentEdgeStyle:function(){return mxSettings.settings.currentEdgeStyle},setCurrentEdgeStyle:function(a){mxSettings.settings.currentEdgeStyle=a},getCurrentVertexStyle:function(){return mxSettings.settings.currentVertexStyle},
|
||||
|
@ -7591,14 +7592,14 @@ mxResources.get("close"));a.innerHTML=mxResources.get("close");d.appendChild(a);
|
|||
App.prototype.start=function(){this.bg.parentNode.removeChild(this.bg);this.restoreLibraries();this.spinner.stop();try{if("1"!=urlParams.client&&"1"!=urlParams.embed&&mxEvent.addListener(window,"hashchange",mxUtils.bind(this,function(a){try{var c=this.getDiagramId(),d=this.getCurrentFile();null!=d&&d.getHash()==c||this.loadFile(c,!0)}catch(n){null!=document.body&&this.handleError(n,mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){var a=this.getCurrentFile();window.location.hash=null!=
|
||||
a?a.getHash():""}))}})),(null==window.location.hash||1>=window.location.hash.length)&&null!=urlParams.url)this.loadFile("U"+urlParams.url,!0);else if(null==this.getCurrentFile()){var a=mxUtils.bind(this,function(){if("1"==urlParams.client&&(null==window.location.hash||0==window.location.hash.length||"#P"==window.location.hash.substring(0,2))){var a=mxUtils.bind(this,function(b){"data:image/png;base64,"==b.substring(0,22)&&(b=this.extractGraphModelFromPng(b));var a=urlParams.title,a=null!=a?decodeURIComponent(a):
|
||||
this.defaultFilename;b=new LocalFile(this,b,a,!0);null!=window.location.hash&&"#P"==window.location.hash.substring(0,2)&&(b.getHash=function(){return window.location.hash.substring(1)});this.fileLoaded(b);this.getCurrentFile().setModified(!this.editor.chromeless)}),c=window.opener||window.parent;if(c!=window){var d=urlParams.create;null!=d?a(c[decodeURIComponent(d)]):(d=urlParams.data,null!=d?a(decodeURIComponent(d)):this.installMessageHandler(mxUtils.bind(this,function(b,d){d.source==c&&a(b)})))}}else if(null==
|
||||
this.dialog)if("1"==urlParams.demo)d=Editor.useLocalStorage,this.createFile(this.defaultFilename,null,null,null,null,null,null,!0),Editor.useLocalStorage=d;else{d=!1;try{d=null!=window.opener&&null!=window.opener.openFile}catch(b){}if(d)this.spinner.spin(document.body,mxResources.get("loading"));else if(d=this.getDiagramId(),"0"!=urlParams.splash||null!=d&&0!=d.length)this.loadFile(this.getDiagramId());else{var f=this.getDraft(),p=null!=f?f.data:this.getFileData(),d=Editor.useLocalStorage;this.createFile(this.defaultFilename,
|
||||
p,null,null,null,null,null,!0);Editor.useLocalStorage=d;null!=f&&(d=this.getCurrentFile(),null!=d&&d.addUnsavedStatus())}}});null!=this.drive&&this.defineCustomObjects();var d=decodeURIComponent(urlParams.create||"");if((null==window.location.hash||1>=window.location.hash.length)&&null!=d&&0<d.length&&this.spinner.spin(document.body,mxResources.get("loading"))){var f=mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("reconnecting"))&&(window.location.search=this.getSearch(["create",
|
||||
"title"]))}),c=mxUtils.bind(this,function(a){this.spinner.stop();if("0"!=urlParams.splash){this.fileLoaded(new LocalFile(this,a,null));this.editor.graph.setEnabled(!1);this.mode=urlParams.mode;var c=urlParams.title,c=null!=c?decodeURIComponent(c):this.defaultFilename;a=this.getServiceCount(!0);var d=4>=a?4:3,c=new CreateDialog(this,c,mxUtils.bind(this,function(a,c){if(null==c){this.hideDialog();var b=Editor.useLocalStorage;this.createFile(0<a.length?a:this.defaultFilename,this.getFileData(),null,
|
||||
null,null,null,null,!0);Editor.useLocalStorage=b}else this.createFile(a,this.getFileData(!0),null,c)}),null,null,null,null,"1"==urlParams.browser,null,null,!0,d);this.showDialog(c.container,380,a>d?390:270,!0,!1,mxUtils.bind(this,function(a){a&&null==this.getCurrentFile()&&this.showSplash()}));c.init()}}),d=decodeURIComponent(d);if("http://"!=d.substring(0,7)&&"https://"!=d.substring(0,8))try{null!=window.opener&&null!=window.opener[d]?c(window.opener[d]):this.handleError(null,mxResources.get("errorLoadingFile"))}catch(g){this.handleError(g,
|
||||
mxResources.get("errorLoadingFile"))}else this.loadTemplate(d,function(a){c(a)},mxUtils.bind(this,function(){this.handleError(null,mxResources.get("errorLoadingFile"),f)}))}else(null==window.location.hash||1>=window.location.hash.length)&&null!=urlParams.state&&null!=this.stateArg&&"open"==this.stateArg.action&&null!=this.stateArg.ids&&(window.location.hash="G"+this.stateArg.ids[0]),(null==window.location.hash||1>=window.location.hash.length)&&null!=this.drive&&null!=this.stateArg&&"create"==this.stateArg.action?
|
||||
(this.setMode(App.MODE_GOOGLE),this.actions.get("new").funct()):a()}}catch(g){this.handleError(g)}};
|
||||
this.dialog)if("1"==urlParams.demo)d=Editor.useLocalStorage,this.createFile(this.defaultFilename,null,null,null,null,null,null,!0),Editor.useLocalStorage=d;else{d=!1;try{d=null!=window.opener&&null!=window.opener.openFile}catch(b){}if(d)this.spinner.spin(document.body,mxResources.get("loading"));else if(d=this.getDiagramId(),"0"!=urlParams.splash||null!=d&&0!=d.length)this.loadFile(d);else if(!mxClient.IS_CHROMEAPP){var f=this.getDraft(),p=null!=f?f.data:this.getFileData(),d=Editor.useLocalStorage;
|
||||
this.createFile(this.defaultFilename,p,null,null,null,null,null,!0);Editor.useLocalStorage=d;null!=f&&(d=this.getCurrentFile(),null!=d&&d.addUnsavedStatus())}}});null!=this.drive&&this.defineCustomObjects();var d=decodeURIComponent(urlParams.create||"");if((null==window.location.hash||1>=window.location.hash.length)&&null!=d&&0<d.length&&this.spinner.spin(document.body,mxResources.get("loading"))){var f=mxUtils.bind(this,function(){this.spinner.spin(document.body,mxResources.get("reconnecting"))&&
|
||||
(window.location.search=this.getSearch(["create","title"]))}),c=mxUtils.bind(this,function(a){this.spinner.stop();if("0"!=urlParams.splash){this.fileLoaded(new LocalFile(this,a,null));this.editor.graph.setEnabled(!1);this.mode=urlParams.mode;var c=urlParams.title,c=null!=c?decodeURIComponent(c):this.defaultFilename;a=this.getServiceCount(!0);var d=4>=a?4:3,c=new CreateDialog(this,c,mxUtils.bind(this,function(a,c){if(null==c){this.hideDialog();var b=Editor.useLocalStorage;this.createFile(0<a.length?
|
||||
a:this.defaultFilename,this.getFileData(),null,null,null,null,null,!0);Editor.useLocalStorage=b}else this.createFile(a,this.getFileData(!0),null,c)}),null,null,null,null,"1"==urlParams.browser,null,null,!0,d);this.showDialog(c.container,380,a>d?390:270,!0,!1,mxUtils.bind(this,function(a){a&&null==this.getCurrentFile()&&this.showSplash()}));c.init()}}),d=decodeURIComponent(d);if("http://"!=d.substring(0,7)&&"https://"!=d.substring(0,8))try{null!=window.opener&&null!=window.opener[d]?c(window.opener[d]):
|
||||
this.handleError(null,mxResources.get("errorLoadingFile"))}catch(g){this.handleError(g,mxResources.get("errorLoadingFile"))}else this.loadTemplate(d,function(a){c(a)},mxUtils.bind(this,function(){this.handleError(null,mxResources.get("errorLoadingFile"),f)}))}else(null==window.location.hash||1>=window.location.hash.length)&&null!=urlParams.state&&null!=this.stateArg&&"open"==this.stateArg.action&&null!=this.stateArg.ids&&(window.location.hash="G"+this.stateArg.ids[0]),(null==window.location.hash||
|
||||
1>=window.location.hash.length)&&null!=this.drive&&null!=this.stateArg&&"create"==this.stateArg.action?(this.setMode(App.MODE_GOOGLE),this.actions.get("new").funct()):a()}}catch(g){this.handleError(g)}};
|
||||
App.prototype.showSplash=function(a){var d=this.getServiceCount(!0,!0),f=mxUtils.bind(this,function(){var a=new SplashDialog(this);this.showDialog(a.container,340,2>d||mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?200:260,!0,!0,mxUtils.bind(this,function(a){a&&!mxClient.IS_CHROMEAPP&&(a=Editor.useLocalStorage,this.createFile(this.defaultFilename,null,null,null,null,null,null,"1"!=urlParams.local),Editor.useLocalStorage=a)}),!0)});if(this.editor.isChromelessView())this.handleError({message:mxResources.get("noFileSelected")},
|
||||
mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){this.showSplash()}));else if(null==this.mode||a){a=4==d?2:3;var c=new StorageDialog(this,mxUtils.bind(this,function(){this.hideDialog();f()}),a);this.showDialog(c.container,3>a?260:300,4<=d?420:300,!0,!1);c.init()}else null==urlParams.create&&f()};
|
||||
mxResources.get("errorLoadingFile"),mxUtils.bind(this,function(){this.showSplash()}));else if(mxClient.IS_CHROMEAPP||null!=this.mode&&!a)null==urlParams.create&&f();else{a=4==d?2:3;var c=new StorageDialog(this,mxUtils.bind(this,function(){this.hideDialog();f()}),a);this.showDialog(c.container,3>a?260:300,4<=d?420:300,!0,!1);c.init()}};
|
||||
App.prototype.addLanguageMenu=function(a,d){var f=null;if((!this.isOfflineApp()||mxClient.IS_CHROMEAPP)&&null!=this.menus.get("language")){f=document.createElement("div");f.setAttribute("title",mxResources.get("language"));f.className="geIcon geSprite geSprite-globe";f.style.position="absolute";f.style.cursor="pointer";f.style.bottom="20px";f.style.right="20px";if(d){f.style.direction="rtl";f.style.textAlign="right";f.style.right="24px";var c=document.createElement("span");c.style.display="inline-block";
|
||||
c.style.fontSize="12px";c.style.margin="5px 24px 0 0";c.style.color="gray";mxUtils.write(c,mxResources.get("language"));f.appendChild(c)}mxEvent.addListener(f,"click",mxUtils.bind(this,function(a){this.editor.graph.popupMenuHandler.hideMenu();var c=new mxPopupMenu(this.menus.get("language").funct);c.div.className+=" geMenubarMenu";c.smartSeparators=!0;c.showDisabled=!0;c.autoExpand=!0;c.hideMenu=mxUtils.bind(this,function(){mxPopupMenu.prototype.hideMenu.apply(c,arguments);c.destroy()});var d=mxUtils.getOffset(f);
|
||||
c.popup(d.x,d.y+f.offsetHeight,null,a);this.setCurrentMenu(c)}));a.appendChild(f)}return f};
|
||||
|
@ -7711,84 +7712,84 @@ DriveFile&&b.constructor!=DropboxFile||null==a.drive&&b.constructor==DriveFile||
|
|||
fileSize:c.size,getXml:function(d,e){a.dropbox.readFile({path:b.stat.path_lower,rev:c.rev},d,e)},getUrl:function(){return a.getUrl(window.location.pathname+"?rev="+c.rev+"&chrome=0&edit=_blank")+window.location.hash}})})(c.entries[e]);var f=new RevisionDialog(a,d);a.showDialog(f.container,640,480,!0,!0);f.init()}catch(z){a.handleError(z)}}));c["catch"](function(b){a.spinner.stop();a.handleError(b)})}else a.drive.executeRequest(gapi.client.drive.revisions.list({fileId:b.getId()}),function(c){a.spinner.stop();
|
||||
for(var d=0;d<c.items.length;d++)(function(d){d.getXml=function(e,f){a.drive.executeRequest(gapi.client.drive.revisions.get({fileId:b.getId(),revisionId:c.items[c.items.length-1]===d?b.desc.headRevisionId:d.id}),function(b){a.drive.getXmlFile(b,null,function(a){e(a.getData())},function(a){f(a)})},function(a){f(a)})};d.getUrl=function(){return a.getUrl(window.location.pathname+"?rev="+d.id+"&chrome=0&edit=_blank")+window.location.hash}})(c.items[d]);d=new RevisionDialog(a,c.items);a.showDialog(d.container,
|
||||
640,480,!0,!0);d.init()},function(b){a.spinner.stop();a.handleError(b)})});a.actions.addAction("createRevision",function(){a.actions.get("save").funct()},null,null,Editor.ctrlKey+"+S");a.actions.addAction("upload...",function(){var b=a.getCurrentFile();null!=b&&(window.drawdata=a.getFileData(),b=null!=b.getTitle()?b.getTitle():a.defaultFilename,a.openLink(window.location.protocol+"//"+window.location.host+"/?create=drawdata&"+(a.mode==App.MODE_DROPBOX?"mode=dropbox&":"")+"title="+encodeURIComponent(b)))});
|
||||
if("undefined"!==typeof MathJax){var e=a.actions.addAction("mathematicalTypesetting",function(){var b=new ChangePageSetup(a);b.ignoreColor=!0;b.ignoreImage=!0;b.mathEnabled=!a.isMathEnabled();f.model.execute(b)});e.setToggleAction(!0);e.setSelectedCallback(function(){return a.isMathEnabled()});e.isEnabled=h}isLocalStorage&&(e=a.actions.addAction("showStartScreen",function(){mxSettings.setShowStartScreen(!mxSettings.getShowStartScreen());mxSettings.save()}),e.setToggleAction(!0),e.setSelectedCallback(function(){return mxSettings.getShowStartScreen()}));
|
||||
var l=a.actions.addAction("autosave",function(){a.editor.setAutosave(!a.editor.autosave)});l.setToggleAction(!0);l.setSelectedCallback(function(){return l.isEnabled()&&a.editor.autosave});a.actions.addAction("editGeometry...",function(){for(var b=f.getSelectionCells(),c=[],d=0;d<b.length;d++)f.getModel().isVertex(b[d])&&c.push(b[d]);0<c.length&&(b=new EditGeometryDialog(a,c),a.showDialog(b.container,180,180,!0,!0),b.init())},null,null,Editor.ctrlKey+"+Shift+M");var q="rounded shadow dashed dashPattern fontFamily fontSize fontColor fontStyle align verticalAlign strokeColor strokeWidth fillColor gradientColor swimlaneFillColor textOpacity gradientDirection glass labelBackgroundColor labelBorderColor opacity spacing spacingTop spacingLeft spacingBottom spacingRight endFill endArrow endSize startStill startArrow startSize arcSize".split(" ");
|
||||
a.actions.addAction("copyStyle",function(){var b=f.view.getState(f.getSelectionCell());if(f.isEnabled()&&null!=b){a.copiedStyle=mxUtils.clone(b.style);for(var b=f.getModel().getStyle(b.cell),b=null!=b?b.split(";"):[],c=0;c<b.length;c++){var d=b[c],e=d.indexOf("=");if(0<=e){var g=d.substring(0,e),d=d.substring(e+1);null==a.copiedStyle[g]&&"none"==d&&(a.copiedStyle[g]="none")}}}},null,null,Editor.ctrlKey+"+Shift+C");a.actions.addAction("pasteStyle",function(){if(f.isEnabled()&&!f.isSelectionEmpty()&&
|
||||
null!=a.copiedStyle){f.getModel().beginUpdate();try{for(var b=f.getSelectionCells(),c=0;c<b.length;c++)for(var d=f.view.getState(b[c]),e=0;e<q.length;e++){var g=q[e],h=a.copiedStyle[g];d.style[g]!=h&&f.setCellStyles(g,h,[b[c]])}}finally{f.getModel().endUpdate()}}},null,null,Editor.ctrlKey+"+Shift+V");a.actions.put("pageBackgroundImage",new Action(mxResources.get("backgroundImage")+"...",function(){if(!a.isOffline()){var b=new BackgroundImageDialog(a,function(b){a.setBackgroundImage(b)});a.showDialog(b.container,
|
||||
320,170,!0,!0);b.init()}}));a.actions.put("exportPng",new Action(mxResources.get("formatPng")+"...",function(){a.isExportToCanvas()?a.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://support.draw.io/display/DO/Exporting+Files",mxUtils.bind(this,function(b,c,d,e,f,g,h,l,m){b=parseInt(b);!isNaN(b)&&0<b&&a.exportImage(b/100,c,d,e,f,h,!l,m)}),!0,!1,"png"):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||a.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,
|
||||
function(b,c,d){a.downloadFile(c?"xmlpng":"png",null,null,b,null,null,d)}))}));a.actions.put("exportJpg",new Action(mxResources.get("formatJpg")+"...",function(){a.isExportToCanvas()?a.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://support.draw.io/display/DO/Exporting+Files",mxUtils.bind(this,function(b,c,d,e,f,g,h,l,m){b=parseInt(b);!isNaN(b)&&0<b&&a.exportImage(b/100,!1,d,e,!1,h,!l,!1,"jpeg")}),!0,!1,"jpeg"):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||
|
||||
a.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,function(b,c){a.downloadFile("jpeg",null,null,b)}),!0)}));e=a.actions.put("shadowVisible",new Action(mxResources.get("shadow"),function(){f.setShadowVisible(!f.shadowVisible)}));e.setToggleAction(!0);e.setSelectedCallback(function(){return f.shadowVisible});var u=!1;a.actions.put("about",new Action(mxResources.get("aboutDrawio")+"...",function(){u||(a.showDialog((new AboutDialog(a)).container,220,300,!0,!0,function(){u=!1}),
|
||||
u=!0)},null,null,"F1"));a.actions.addAction("userManual...",function(){a.openLink("https://support.draw.io/display/DO/Draw.io+Online+User+Manual")});a.actions.addAction("support...",function(){a.openLink("https://about.draw.io/support/")});a.actions.addAction("exportOptionsDisabled...",function(){a.handleError({message:mxResources.get("exportOptionsDisabledDetails")},mxResources.get("exportOptionsDisabled"))});a.actions.addAction("keyboardShortcuts...",function(){mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?
|
||||
a.openLink("https://www.draw.io/shortcuts.svg"):mxClient.IS_SVG?a.openLink("shortcuts.svg"):a.openLink("https://www.draw.io/?lightbox=1#Uhttps%3A%2F%2Fwww.draw.io%2Fshortcuts.svg")});a.actions.addAction("feedback...",function(){var b=new FeedbackDialog(a);a.showDialog(b.container,610,360,!0,!0);b.init()});a.actions.addAction("quickStart...",function(){a.openLink("https://www.youtube.com/watch?v=Z0D96ZikMkc")});e=a.actions.addAction("tags...",mxUtils.bind(this,function(){null==this.tagsWindow?(this.tagsWindow=
|
||||
new TagsWindow(a,document.body.offsetWidth-380,230,300,120),this.tagsWindow.window.addListener("show",function(){a.fireEvent(new mxEventObject("tags"))}),this.tagsWindow.window.addListener("hide",function(){a.fireEvent(new mxEventObject("tags"))}),this.tagsWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("tags"))):this.tagsWindow.window.setVisible(!this.tagsWindow.window.isVisible())}));e.setToggleAction(!0);e.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.tagsWindow&&
|
||||
this.tagsWindow.window.isVisible()}));e=a.actions.addAction("find...",mxUtils.bind(this,function(){null==this.findWindow?(this.findWindow=new FindWindow(a,document.body.offsetWidth-300,110,240,140),this.findWindow.window.addListener("show",function(){a.fireEvent(new mxEventObject("find"))}),this.findWindow.window.addListener("hide",function(){a.fireEvent(new mxEventObject("find"))}),this.findWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("find"))):this.findWindow.window.setVisible(!this.findWindow.window.isVisible())}));
|
||||
e.setToggleAction(!0);e.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.findWindow&&this.findWindow.window.isVisible()}));a.actions.put("exportVsdx",new Action(mxResources.get("formatVsdx")+" (beta)...",function(){a.exportVisio()}));if(mxClient.IS_CHROMEAPP||isLocalStorage&&"1"!=urlParams.offline)if(this.put("language",new Menu(mxUtils.bind(this,function(b,c){var d=mxUtils.bind(this,function(d){var e=""==d?mxResources.get("automatic"):mxLanguageMap[d],f=null;""!=e&&(f=b.addItem(e,
|
||||
null,mxUtils.bind(this,function(){mxSettings.setLanguage(d);mxSettings.save();mxClient.language=d;mxResources.loadDefaultBundle=!1;mxResources.add(RESOURCE_BASE);a.alert(mxResources.get("restartForChangeRequired"))}),c),(d==mxLanguage||""==d&&null==mxLanguage)&&b.addCheckmark(f,Editor.checkmarkImage));return f});d("");b.addSeparator(c);for(var e in mxLanguageMap)d(e)}))),"atlas"!=uiTheme){var t=Menus.prototype.createMenubar;Menus.prototype.createMenubar=function(a){var b=t.apply(this,arguments);if(null!=
|
||||
b){var c=this.get("language");null!=c&&(c=b.addMenu("",c.funct),c.setAttribute("title",mxResources.get("language")),c.style.width="16px",c.style.paddingTop="2px",c.style.paddingLeft="4px",c.innerHTML='<div class="geIcon geSprite geSprite-globe"/>',c.style.zIndex="1",c.style.position="absolute",c.style.top="2px",c.style.right="17px",c.style.display="block",mxClient.IS_VML||mxUtils.setOpacity(c,60),document.body.appendChild(c))}return b}}this.put("help",new Menu(mxUtils.bind(this,function(b,c){if(!mxClient.IS_CHROMEAPP&&
|
||||
a.isOffline())this.addMenuItems(b,["about"],c);else{var d=b.addItem("Search:",null,null,c,null,null,!1);d.style.backgroundColor="dark"==uiTheme?"#505759":"whiteSmoke";d.style.cursor="default";var e=document.createElement("input");e.setAttribute("type","text");e.setAttribute("size","25");e.style.marginLeft="8px";mxEvent.addListener(e,"keydown",mxUtils.bind(this,function(a){var b=mxUtils.trim(e.value);13==a.keyCode&&0<b.length?(this.editorUi.openLink("https://desk.draw.io/support/search/solutions?term="+
|
||||
encodeURIComponent(b)),e.value="",this.editorUi.logEvent({category:"Help",action:"search",label:b}),null!=this.editorUi.menubar&&window.setTimeout(mxUtils.bind(this,function(){this.editorUi.menubar.hideMenu()}),0)):27==a.keyCode&&(e.value="")}));d.firstChild.nextSibling.appendChild(e);mxEvent.addGestureListeners(e,function(a){document.activeElement!=e&&e.focus();mxEvent.consume(a)},function(a){mxEvent.consume(a)},function(a){mxEvent.consume(a)});window.setTimeout(function(){e.focus()},0);this.addMenuItems(b,
|
||||
["-","quickStart","userManual","keyboardShortcuts","-"],c);mxClient.IS_CHROMEAPP||this.addMenuItems(b,["feedback"],c);this.addMenuItems(b,["support","-"],c);a.isOffline()||EditorUi.isElectronApp||navigator.standalone||"1"==urlParams.embed||this.addMenuItems(b,["download"],c);navigator.standalone||"1"==urlParams.embed||this.addMenuItems(b,["offline"],c);this.addMenuItems(b,["-","about"],c)}"1"==urlParams.ruler&&(mxResources.parse("rulerInch=Ruler unit: Inches"),this.editorUi.actions.addAction("rulerInch",
|
||||
mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.INCHES);this.editorUi.hRuler.setUnit(mxRuler.prototype.INCHES);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),mxResources.parse("rulerCM=Ruler unit: CMs"),this.editorUi.actions.addAction("rulerCM",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.CENTIMETER);this.editorUi.hRuler.setUnit(mxRuler.prototype.CENTIMETER);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),
|
||||
mxResources.parse("rulerPixel=Ruler unit: Pixels"),this.editorUi.actions.addAction("rulerPixel",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.PIXELS);this.editorUi.hRuler.setUnit(mxRuler.prototype.PIXELS);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),this.addMenuItems(b,["-","rulerInch","rulerCM","rulerPixel"],c));"1"==urlParams.test&&(mxResources.parse("showBoundingBox=Show bounding box"),this.editorUi.actions.addAction("showBoundingBox",mxUtils.bind(this,
|
||||
function(){var a=f.getGraphBounds(),b=f.view.translate,d=f.view.scale;f.insertVertex(c,null,"",a.x/d-b.x,a.y/d-b.y,a.width/d,a.height/d,"fillColor=none;strokeColor=red;")})),mxResources.parse("createSidebarEntry=Create sidebar entry"),this.editorUi.actions.addAction("createSidebarEntry",mxUtils.bind(this,function(){f.isSelectionEmpty()||(mxLog.show(),mxLog.debug("sb.createVertexTemplateFromData('"+f.compress(mxUtils.getXml(f.encodeCells(f.getSelectionCells())))+"', width, height, 'Title');"))})),
|
||||
this.addMenuItems(b,["-","createSidebarEntry","showBoundingBox"],c),mxResources.parse("testXmlImageExport=XML Image Export"),this.editorUi.actions.addAction("testXmlImageExport",mxUtils.bind(this,function(){var a=new mxImageExport,b=f.getGraphBounds(),c=f.view.scale,d=mxUtils.createXmlDocument(),e=d.createElement("output");d.appendChild(e);d=new mxXmlCanvas2D(e);d.translate(Math.floor((1-b.x)/c),Math.floor((1-b.y)/c));d.scale(1/c);var k=0,g=d.save;d.save=function(){k++;g.apply(this,arguments)};var h=
|
||||
d.restore;d.restore=function(){k--;h.apply(this,arguments)};var l=a.drawShape;a.drawShape=function(a){mxLog.debug("entering shape",a,k);l.apply(this,arguments);mxLog.debug("leaving shape",a,k)};a.drawState(f.getView().getState(f.model.root),d);mxLog.show();mxLog.debug(mxUtils.getXml(e));mxLog.debug("stateCounter",k)})),this.addMenuItems(b,["testXmlImageExport"],c),mxResources.parse("testShowRtModel=Show RT model"),mxResources.parse("testDebugRtModel=Debug RT model"),mxResources.parse("testDownloadRtModel=Download RT model"),
|
||||
this.editorUi.actions.addAction("testShowRtModel",mxUtils.bind(this,function(){null!=this.editorUi.getCurrentFile()&&null!=this.editorUi.getCurrentFile().realtime&&(console.log("bytesUsed",this.editorUi.getCurrentFile().realtime.rtModel.bytesUsed),console.log("root",this.editorUi.getCurrentFile().realtime.dumpRoot()),this.editorUi.getCurrentFile().realtime.check())})),this.editorUi.actions.addAction("testDebugRtModel",mxUtils.bind(this,function(){gapi.drive.realtime.debug()})),this.editorUi.actions.addAction("testDownloadRtModel",
|
||||
mxUtils.bind(this,function(){var b=this.editorUi.getCurrentFile();null!=b&&null!=b.realtime&&a.spinner.spin(document.body,mxResources.get("export"))&&(b=new mxXmlRequest("https://www.googleapis.com/drive/v2/files/"+b.getHash().substring(1)+"/realtime",null,"GET"),b.setRequestHeaders=function(a){mxXmlRequest.prototype.setRequestHeaders.apply(this,arguments);var b=gapi.auth.getToken().access_token;a.setRequestHeader("authorization","Bearer "+b)},b.send(function(b){a.spinner.stop();200<=b.getStatus()&&
|
||||
299>=b.getStatus()&&a.saveLocalFile(b.getText(),"realtime.txt","text/plain")}))})),null!=this.editorUi.getCurrentFile()&&null!=this.editorUi.getCurrentFile().realtime&&this.addMenuItems(b,["-","testShowRtModel","testDebugRtModel","testDownloadRtModel"],c),mxResources.parse("testShowConsole=Show Console"),this.editorUi.actions.addAction("testShowConsole",function(){mxLog.isVisible()?mxLog.window.fit():mxLog.show();mxLog.window.div.style.zIndex=mxPopupMenu.prototype.zIndex-1}),this.addMenuItems(b,["-",
|
||||
"testShowConsole"]))})));a.actions.addAction("shapes...",function(){mxClient.IS_CHROMEAPP||!a.isOffline()?a.showDialog((new MoreShapesDialog(a,!0)).container,640,isLocalStorage?mxClient.IS_IOS?480:460:440,!0,!0):a.showDialog((new MoreShapesDialog(a,!1)).container,360,isLocalStorage?mxClient.IS_IOS?300:280:260,!0,!0)});a.actions.addAction("createShape...",function(){a.getCurrentFile();if(f.isEnabled()){var b=new mxCell("",new mxGeometry(0,0,120,120),a.defaultCustomShapeStyle);b.vertex=!0;b=new EditShapeDialog(a,
|
||||
b,mxResources.get("editShape")+":",630,400);a.showDialog(b.container,640,480,!0,!1);b.init()}});a.actions.put("embedHtml",new Action(mxResources.get("html")+"...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();a.showHtmlDialog(mxResources.get("create"),"https://desk.draw.io/support/solutions/articles/16000042542",b,function(b,c,d,e,f,k,g,h,l,m){a.createHtml(b,c,d,e,f,k,g,h,l,m,mxUtils.bind(this,function(b,c){var d=
|
||||
new EmbedDialog(a,b+"\n"+c,null,null,function(){var a=window.open(),d=a.document;"CSS1Compat"===document.compatMode&&d.writeln("<!DOCTYPE html>");d.writeln("<html>");d.writeln("<head><title>"+encodeURIComponent(mxResources.get("preview"))+'</title><meta charset="utf-8"></head>');d.writeln("<body>");d.writeln(b);var e=mxClient.IS_IE||mxClient.IS_EDGE||null!=document.documentMode;e&&d.writeln(c);d.writeln("</body>");d.writeln("</html>");d.close();if(!e){var f=a.document.createElement("div");f.marginLeft=
|
||||
"26px";f.marginTop="26px";mxUtils.write(f,mxResources.get("updatingDocument"));e=a.document.createElement("img");e.setAttribute("src",window.location.protocol+"//"+window.location.hostname+"/"+IMAGE_PATH+"/spin.gif");e.style.marginLeft="6px";f.appendChild(e);a.document.body.insertBefore(f,a.document.body.firstChild);window.setTimeout(function(){var a=document.createElement("script");a.type="text/javascript";a.src=/<script.*?src="(.*?)"/.exec(c)[1];d.body.appendChild(a);f.parentNode.removeChild(f)},
|
||||
20)}});a.showDialog(d.container,440,240,!0,!0);d.init()}))})})}));a.actions.put("liveImage",new Action("Live image...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();null!=b?(b=encodeURIComponent(b),b=new EmbedDialog(a,EXPORT_URL+"?format=png&url="+b,0),a.showDialog(b.container,440,240,!0,!0),b.init()):a.handleError({message:mxResources.get("invalidPublicUrl")})})}));a.actions.put("embedImage",new Action(mxResources.get("image")+
|
||||
"...",function(){a.showEmbedImageDialog(function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.createEmbedImage(b,c,d,e,f,g,function(b){a.spinner.stop();b=new EmbedDialog(a,b);a.showDialog(b.container,440,240,!0,!0);b.init()},function(b){a.spinner.stop();a.handleError(b)})},mxResources.get("image"),mxResources.get("retina"),a.isExportToCanvas())}));a.actions.put("embedSvg",new Action(mxResources.get("formatSvg")+"...",function(){a.showEmbedImageDialog(function(b,c,d,e,f,
|
||||
g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.createEmbedSvg(b,c,d,e,f,g,function(b){a.spinner.stop();b=new EmbedDialog(a,b);a.showDialog(b.container,440,240,!0,!0);b.init()},function(b){a.spinner.stop();a.handleError(b)})},mxResources.get("formatSvg"),mxResources.get("image"),!0,"https://desk.draw.io/support/solutions/articles/16000042548")}));a.actions.put("embedIframe",new Action(mxResources.get("iframe")+"...",function(){var b=f.getGraphBounds();a.showPublishLinkDialog(mxResources.get("iframe"),
|
||||
null,"100%",Math.ceil((b.y+b.height-f.view.translate.y)/f.view.scale)+2,function(b,c,d,e,f,k,g,h){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(l){a.spinner.stop();l=new EmbedDialog(a,'<iframe frameborder="0" style="width:'+g+";height:"+h+';" src="'+a.createLink(b,c,d,e,f,k,l)+'"></iframe>');a.showDialog(l.container,440,240,!0,!0);l.init()})},!0)}));a.actions.put("publishLink",new Action(mxResources.get("link")+"...",function(){a.showPublishLinkDialog(null,
|
||||
null,null,null,function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(k){a.spinner.stop();k=new EmbedDialog(a,a.createLink(b,c,d,e,f,g,k));a.showDialog(k.container,440,240,!0,!0);k.init()})})}));a.actions.addAction("googleDocs...",function(){a.openLink("http://docsaddon.draw.io")});a.actions.addAction("googleSites...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();
|
||||
b=new GoogleSitesDialog(a,b);a.showDialog(b.container,420,256,!0,!0);b.init()})});if(isLocalStorage||mxClient.IS_CHROMEAPP)e=a.actions.addAction("scratchpad",function(){a.toggleScratchpad()}),e.setToggleAction(!0),e.setSelectedCallback(function(){return null!=a.scratchpad}),a.actions.addAction("plugins...",function(){a.showDialog((new PluginsDialog(a)).container,360,170,!0,!1)});e=a.actions.addAction("search",function(){var b=a.sidebar.isEntryVisible("search");a.sidebar.showPalette("search",!b);isLocalStorage&&
|
||||
(mxSettings.settings.search=!b,mxSettings.save())});e.setToggleAction(!0);e.setSelectedCallback(function(){return a.sidebar.isEntryVisible("search")});"1"==urlParams.embed&&(a.actions.get("save").funct=function(b){f.isEditing()&&f.stopEditing();var c="0"!=urlParams.pages||null!=a.pages&&1<a.pages.length?a.getFileData(!0):mxUtils.getXml(a.editor.getGraphXml());if("json"==urlParams.proto){var d=a.createLoadMessage("save");d.xml=c;b&&(d.exit=!0);c=JSON.stringify(d)}(window.opener||window.parent).postMessage(c,
|
||||
"*");"0"!=urlParams.modified&&"1"!=urlParams.keepmodified&&(a.editor.modified=!1,a.editor.setStatus(""));null!=a.getCurrentFile()&&a.saveFile()},a.actions.addAction("saveAndExit",function(){a.actions.get("save").funct(!0)}),a.actions.addAction("exit",function(){var b=function(){a.editor.modified=!1;var b="json"==urlParams.proto?JSON.stringify({event:"exit",modified:a.editor.modified}):"";(window.opener||window.parent).postMessage(b,"*")};a.editor.modified?a.confirm(mxResources.get("allChangesLost"),
|
||||
null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b()}));this.put("exportAs",new Menu(mxUtils.bind(this,function(b,c){a.isExportToCanvas()?(this.addMenuItems(b,["exportPng"],c),a.jpgSupported&&this.addMenuItems(b,["exportJpg"],c)):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["exportPng","exportJpg"],c);this.addMenuItems(b,["exportSvg","-"],c);a.isOffline()||a.printPdfExport?this.addMenuItems(b,["exportPdf"],c):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||
|
||||
this.addMenuItems(b,["exportPdf"],c);mxClient.IS_IE11||mxClient.IS_IE||"undefined"===typeof VsdxExport&&a.isOffline()||this.addMenuItems(b,["exportVsdx"],c);this.addMenuItems(b,["-","exportHtml","exportXml","exportUrl"],c);a.isOffline()||(b.addSeparator(c),this.addMenuItem(b,"export",c).firstChild.nextSibling.innerHTML=mxResources.get("advanced")+"...")})));this.editorUi.actions.addAction("chatWindowTitle...",mxUtils.bind(this.editorUi,this.editorUi.toggleChat));this.put("importFrom",new Menu(function(c,
|
||||
d){function e(b){b.pickFile(function(c){a.spinner.spin(document.body,mxResources.get("loading"))&&b.getFile(c,function(b){var c=g(b.getTitle());/\.svg$/i.test(b.getTitle())&&!a.editor.isDataSvg(b.getData())&&(b.setData(a.createSvgDataUri(b.getData())),c="image/svg+xml");k(b.getData(),c,b.getTitle())},function(b){a.handleError(b,null!=b?mxResources.get("errorLoadingFile"):null)},b==a.drive)},!0)}var k=mxUtils.bind(this,function(b,c,d){var e=f.view,k=f.getGraphBounds(),g=f.snap(Math.ceil(Math.max(0,
|
||||
k.x/e.scale-e.translate.x)+4*f.gridSize)),h=f.snap(Math.ceil(Math.max(0,(k.y+k.height)/e.scale-e.translate.y)+4*f.gridSize));"data:image/"==b.substring(0,11)?a.loadImage(b,mxUtils.bind(this,function(e){var k=!0,l=mxUtils.bind(this,function(){a.resizeImage(e,b,mxUtils.bind(this,function(e,l,m){e=k?Math.min(1,Math.min(a.maxImageSize/l,a.maxImageSize/m)):1;a.importFile(b,c,g,h,Math.round(l*e),Math.round(m*e),d,function(b){a.spinner.stop();f.setSelectionCells(b);f.scrollCellToVisible(f.getSelectionCell())})}),
|
||||
k)});b.length>a.resampleThreshold?a.confirmImageResize(function(a){k=a;l()}):l()}),mxUtils.bind(this,function(){a.handleError({message:mxResources.get("cannotOpenFile")})})):a.importFile(b,c,g,h,0,0,d,function(b){a.spinner.stop();f.setSelectionCells(b);f.scrollCellToVisible(f.getSelectionCell())})}),g=mxUtils.bind(this,function(a){var b="text/xml";/\.png$/i.test(a)?b="image/png":/\.jpe?g$/i.test(a)?b="image/jpg":/\.gif$/i.test(a)&&(b="image/gif");return b});"undefined"!=typeof google&&"undefined"!=
|
||||
typeof google.picker&&(null!=a.drive?c.addItem(mxResources.get("googleDrive")+"...",null,function(){e(a.drive)},d):m&&c.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1));null!=a.gitHub&&c.addItem(mxResources.get("github")+"...",null,function(){e(a.gitHub)},d);null!=a.dropbox?c.addItem(mxResources.get("dropbox")+"...",null,function(){e(a.dropbox)},d):n&&c.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},
|
||||
d,null,!1);null!=a.oneDrive?c.addItem(mxResources.get("oneDrive")+"...",null,function(){e(a.oneDrive)},d):p&&c.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?c.addItem(mxResources.get("trello")+"...",null,function(){e(a.trello)},d):b&&c.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);c.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&c.addItem(mxResources.get("browser")+
|
||||
"...",null,function(){a.importLocalFile(!1)},d);mxClient.IS_IOS||c.addItem(mxResources.get("device")+"...",null,function(){a.importLocalFile(!0)},d);a.isOffline()||(c.addSeparator(d),c.addItem(mxResources.get("url")+"...",null,function(){var b=new FilenameDialog(a,"",mxResources.get("import"),function(b){if(null!=b&&0<b.length&&a.spinner.spin(document.body,mxResources.get("loading"))){var c=/(\.png)($|\?)/i.test(b)?"image/png":"text/xml";a.loadUrl(PROXY_URL+"?url="+encodeURIComponent(b),function(a){k(a,
|
||||
c,b)},function(){a.spinner.stop();a.handleError(null,mxResources.get("errorLoadingFile"))},"image/png"==c)}},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},d))})).isEnabled=h;this.put("theme",new Menu(mxUtils.bind(this,function(b,c){var d=b.addItem(mxResources.get("kennedy"),null,function(){mxSettings.setUi("");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"atlas"!=uiTheme&&"dark"!=uiTheme&&"min"!=uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);
|
||||
d=b.addItem(mxResources.get("minimal"),null,function(){mxSettings.setUi("min");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"min"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);d=b.addItem(mxResources.get("atlas"),null,function(){mxSettings.setUi("atlas");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"atlas"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);d=b.addItem(mxResources.get("dark"),null,function(){mxSettings.setUi("dark");mxSettings.save();
|
||||
a.alert(mxResources.get("restartForChangeRequired"))},c);"dark"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage)})));e=this.editorUi.actions.addAction("rename...",mxUtils.bind(this,function(){var b=this.editorUi.getCurrentFile();if(null!=b){var c=null!=b.getTitle()?b.getTitle():this.editorUi.defaultFilename,c=new FilenameDialog(this.editorUi,c,mxResources.get("rename"),mxUtils.bind(this,function(a){null!=a&&0<a.length&&null!=b&&this.editorUi.spinner.spin(document.body,mxResources.get("renaming"))&&
|
||||
b.rename(a,mxUtils.bind(this,function(a){this.editorUi.spinner.stop()}),mxUtils.bind(this,function(a){this.editorUi.handleError(a,null!=a?mxResources.get("errorRenamingFile"):null)}))}),b.constructor==DriveFile||b.constructor==StorageFile?mxResources.get("diagramName"):null,function(b){if(null!=b&&0<b.length)return!0;a.showError(mxResources.get("error"),mxResources.get("invalidName"),mxResources.get("ok"));return!1});this.editorUi.showDialog(c.container,300,80,!0,!0);c.init()}}));e.isEnabled=function(){return this.enabled&&
|
||||
h.apply(this,arguments)};e.visible="1"!=urlParams.embed;a.actions.addAction("makeCopy...",mxUtils.bind(this,function(){var b=a.getCurrentFile();if(null!=b){var c=null!=b.getTitle()?b.getTitle():a.defaultFilename,d="",e=c.lastIndexOf(".");0<=e&&(d=c.substring(e),c=c.substring(0,e));c=mxResources.get("copyOf",[c])+d;b.constructor==DriveFile?(c=new CreateDialog(a,c,mxUtils.bind(this,function(c,d){"download"==d&&(d=App.MODE_GOOGLE);null!=c&&0<c.length&&(d==App.MODE_GOOGLE?a.spinner.spin(document.body,
|
||||
mxResources.get("saving"))&&b.save(!1,mxUtils.bind(this,function(){b.saveAs(c,mxUtils.bind(this,function(b){a.spinner.stop();var c=a.getUrl();window.openWindow(c+"#G"+b.id,null,mxUtils.bind(this,function(){window.location.hash="G"+b.id}))}),mxUtils.bind(this,function(b){a.handleError(b)}))}),mxUtils.bind(this,function(b){a.handleError(b)})):this.editorUi.createFile(c,this.editorUi.getFileData(!0),null,d))}),mxUtils.bind(this,function(){a.hideDialog()}),mxResources.get("makeCopy"),mxResources.get("create"),
|
||||
null,null,null,null,!0),a.showDialog(c.container,420,380,!0,!0),c.init()):a.editor.editAsNew(this.editorUi.getFileData(!0),c)}}));a.actions.addAction("moveToFolder...",mxUtils.bind(this,function(){var b=a.getCurrentFile();b.getMode()!=App.MODE_GOOGLE&&b.getMode()!=App.MODE_ONEDRIVE||a.pickFolder(b.getMode(),mxUtils.bind(this,function(c){a.spinner.spin(document.body,mxResources.get("moving"))&&b.move(c,mxUtils.bind(this,function(b){a.spinner.stop()}),mxUtils.bind(this,function(b){a.handleError(b)}))}))}));
|
||||
this.put("publish",new Menu(mxUtils.bind(this,function(a,b){this.addMenuItems(a,["publishLink"],b)})));a.actions.put("offline",new Action(mxResources.get("offline")+"...",function(){a.openLink("https://app.draw.io/")}));a.actions.put("download",new Action(mxResources.get("download")+"...",function(){a.openLink("https://get.draw.io/")}));this.editorUi.actions.addAction("share...",mxUtils.bind(this,function(){var a=this.editorUi.getCurrentFile();null!=a&&this.editorUi.drive.showPermissions(a.getId())}));
|
||||
this.put("embed",new Menu(mxUtils.bind(this,function(b,c){"1"==urlParams.test&&this.addMenuItems(b,["liveImage","-"],c);this.addMenuItems(b,["embedImage","embedSvg","-","embedHtml"],c);navigator.standalone||a.isOffline()||this.addMenuItems(b,["embedIframe"],c);a.isOffline()||this.addMenuItems(b,["-","googleSites","googleDocs"],c)})));var w=function(b,c,d,e){("plantUml"!=e||EditorUi.enablePlantUml)&&b.addItem(d,null,mxUtils.bind(this,function(){if("fromText"==e||"formatSql"==e||"plantUml"==e){var b=
|
||||
new ParseDialog(a,d,e);a.showDialog(b.container,620,420,!0,!1);a.dialog.container.style.overflow="auto"}else b=new CreateGraphDialog(a,d,e),a.showDialog(b.container,620,420,!0,!1);b.init()}),c)},x=function(a,b,c,d){var e=f.isMouseInsertPoint()?f.getInsertPoint():f.getFreeInsertPoint();a=new mxCell(a,new mxGeometry(e.x,e.y,b,c),d);a.vertex=!0;f.getModel().beginUpdate();try{a=f.addCell(a),f.fireEvent(new mxEventObject("cellsInserted","cells",[a]))}finally{f.getModel().endUpdate()}f.scrollCellToVisible(a);
|
||||
f.setSelectionCell(a);f.container.focus();f.editAfterInsert&&f.startEditing(a);return a};a.actions.addAction("insertText",function(){f.isEnabled()&&!f.isCellLocked(f.getDefaultParent())&&f.startEditingAtCell(x("Text",40,20,"text;html=1;resizable=0;autosize=1;align=center;verticalAlign=middle;points=[];fillColor=none;strokeColor=none;rounded=0;"))},null,null,Editor.ctrlKey+"+Shift+X").isEnabled=h;a.actions.addAction("insertRectangle",function(){f.isEnabled()&&!f.isCellLocked(f.getDefaultParent())&&
|
||||
x("",120,60,"whiteSpace=wrap;html=1;")},null,null,Editor.ctrlKey+"+K").isEnabled=h;a.actions.addAction("insertEllipse",function(){f.isEnabled()&&!f.isCellLocked(f.getDefaultParent())&&x("",80,80,"ellipse;whiteSpace=wrap;html=1;")},null,null,Editor.ctrlKey+"+Shift+K").isEnabled=h;a.actions.addAction("insertRhombus",function(){f.isEnabled()&&!f.isCellLocked(f.getDefaultParent())&&x("",80,80,"rhombus;whiteSpace=wrap;html=1;")}).isEnabled=h;var A=mxUtils.bind(this,function(a,b,c){for(var d=0;d<c.length;d++)"-"==
|
||||
c[d]?a.addSeparator(b):w(a,b,mxResources.get(c[d])+"...",c[d])});this.put("insert",new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,"insertText insertRectangle - insertEllipse insertRhombus - insertLink insertImage".split(" "),c);b.addSeparator(c);this.addSubmenu("insertLayout",b,c,mxResources.get("layout"));b.addSeparator(c);A(b,c,["fromText","plantUml","-","formatSql"]);b.addItem(mxResources.get("csv")+"...",null,function(){a.showImportCsvDialog()},c)})));this.put("insertLayout",new Menu(mxUtils.bind(this,
|
||||
function(a,b){A(a,b,"horizontalFlow verticalFlow - horizontalTree verticalTree radialTree - organic circle".split(" "))})));this.put("openRecent",new Menu(function(b,c){var d=a.getRecent();if(null!=d){for(var e=0;e<d.length;e++)(function(d){var e=d.mode;e==App.MODE_GOOGLE?e="googleDrive":e==App.MODE_ONEDRIVE&&(e="oneDrive");b.addItem(d.title+" ("+mxResources.get(e)+")",null,function(){a.loadFile(d.id)},c)})(d[e]);b.addSeparator(c)}b.addItem(mxResources.get("reset"),null,function(){a.resetRecent()},
|
||||
c)}));this.put("openFrom",new Menu(function(c,d){null!=a.drive?c.addItem(mxResources.get("googleDrive")+"...",null,function(){a.pickFile(App.MODE_GOOGLE)},d):m&&c.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.gitHub&&c.addItem(mxResources.get("github")+"...",null,function(){a.pickFile(App.MODE_GITHUB)},d);null!=a.dropbox?c.addItem(mxResources.get("dropbox")+"...",null,function(){a.pickFile(App.MODE_DROPBOX)},d):n&&c.addItem(mxResources.get("dropbox")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.oneDrive?c.addItem(mxResources.get("oneDrive")+"...",null,function(){a.pickFile(App.MODE_ONEDRIVE)},d):p&&c.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?c.addItem(mxResources.get("trello")+"...",null,function(){a.pickFile(App.MODE_TRELLO)},d):b&&c.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);c.addSeparator(d);
|
||||
isLocalStorage&&"0"!=urlParams.browser&&c.addItem(mxResources.get("browser")+"...",null,function(){a.pickFile(App.MODE_BROWSER)},d);mxClient.IS_IOS||c.addItem(mxResources.get("device")+"...",null,function(){a.pickFile(App.MODE_DEVICE)},d);a.isOffline()||(c.addSeparator(d),c.addItem(mxResources.get("url")+"...",null,function(){var b=new FilenameDialog(a,"",mxResources.get("open"),function(b){null!=b&&0<b.length&&(null==a.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(b):window.openWindow((mxClient.IS_CHROMEAPP?
|
||||
"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(b)))},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},d))}));Editor.enableCustomLibraries&&(this.put("newLibrary",new Menu(function(c,d){"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?c.addItem(mxResources.get("googleDrive")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_GOOGLE)},d):m&&c.addItem(mxResources.get("googleDrive")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1));null!=a.gitHub&&c.addItem(mxResources.get("github")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_GITHUB)},d);null!=a.dropbox?c.addItem(mxResources.get("dropbox")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_DROPBOX)},d):n&&c.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.oneDrive?c.addItem(mxResources.get("oneDrive")+
|
||||
"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_ONEDRIVE)},d):p&&c.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?c.addItem(mxResources.get("trello")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_TRELLO)},d):b&&c.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);c.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&c.addItem(mxResources.get("browser")+
|
||||
"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_BROWSER)},d);mxClient.IS_IOS||c.addItem(mxResources.get("device")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_DEVICE)},d)})),this.put("openLibraryFrom",new Menu(function(c,d){"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?c.addItem(mxResources.get("googleDrive")+"...",null,function(){a.pickLibrary(App.MODE_GOOGLE)},d):m&&c.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+
|
||||
"...)",null,function(){},d,null,!1));null!=a.gitHub&&c.addItem(mxResources.get("github")+"...",null,function(){a.pickLibrary(App.MODE_GITHUB)},d);null!=a.dropbox?c.addItem(mxResources.get("dropbox")+"...",null,function(){a.pickLibrary(App.MODE_DROPBOX)},d):n&&c.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.oneDrive?c.addItem(mxResources.get("oneDrive")+"...",null,function(){a.pickLibrary(App.MODE_ONEDRIVE)},d):p&&c.addItem(mxResources.get("oneDrive")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?c.addItem(mxResources.get("trello")+"...",null,function(){a.pickLibrary(App.MODE_TRELLO)},d):b&&c.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);c.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&c.addItem(mxResources.get("browser")+"...",null,function(){a.pickLibrary(App.MODE_BROWSER)},d);mxClient.IS_IOS||c.addItem(mxResources.get("device")+"...",null,function(){a.pickLibrary(App.MODE_DEVICE)},
|
||||
d);a.isOffline()||(c.addSeparator(d),c.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.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(z){a.handleError(z,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()},d))})));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 - edit - editLink openLink - selectVertices selectEdges selectAll selectNone - lockUnlock".split(" "))})));this.put("view",
|
||||
new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,(null!=this.editorUi.format?["formatPanel"]:[]).concat(["outline","layers","-"]));this.addMenuItems(b,["-","search"],c);if(isLocalStorage||mxClient.IS_CHROMEAPP){var d=this.addMenuItem(b,"scratchpad",c);a.isOffline()&&!mxClient.IS_CHROMEAPP||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);this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000032875")}"1"!=
|
||||
urlParams.embed&&this.addMenuItems(b,["autosave"],c);this.addMenuItems(b,["-","createShape","editDiagram"],c);b.addSeparator(c);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&this.addMenuItems(b,["showStartScreen"],c);!a.isOfflineApp()&&"1"!=urlParams.embed&&isLocalStorage&&(d=this.addMenuItem(b,"plugins",c),a.isOffline()||this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000056430"));b.addSeparator(c);d=this.addMenuItem(b,"tags",c);a.isOffline()&&!mxClient.IS_CHROMEAPP||
|
||||
this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000046966")})));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)),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();null!=d&&d.constructor==DriveFile?(d.isRestricted()&&this.addMenuItems(b,["exportOptionsDisabled"],c),null==d.realtime?this.addMenuItems(b,["save","share","-"],c):(d.isAutosave()||this.addMenuItems(b,["save"],c),this.addMenuItems(b,["share","chatWindowTitle","-"],c))):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):(this.addMenuItems(b,["-","save","saveAs","-","rename"],c),a.isOfflineApp()?a.isOffline()||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);null==d||d.constructor!=DriveFile&&d.constructor!=DropboxFile||this.addMenuItems(b,["-","revisionHistory"],c);null!=d&&d.constructor==DriveFile&&this.addMenuItems(b,["createRevision"],c);this.addMenuItems(b,["-","pageSetup"],c);mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["print"],c);this.addMenuItems(b,["-","close"])}})))};var f=Menus.prototype.menuCreated;Menus.prototype.menuCreated=function(a,d){if(480>=screen.width&&a==this.get("help")){d.style.paddingRight=
|
||||
"0px";d.style.paddingLeft="0px";d.innerHTML="";var c=document.createElement("img");c.setAttribute("border","0");c.setAttribute("valign","bottom");c.setAttribute("src",Editor.helpImage);d.appendChild(c)}f.apply(this,arguments)}})();function DiagramPage(a){this.node=a;(null==this.node.hasAttribute&&null==this.node.getAttribute("id")||null!=this.node.hasAttribute&&!this.node.hasAttribute("id"))&&this.node.setAttribute("id",function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}())}DiagramPage.prototype.node=null;DiagramPage.prototype.root=null;DiagramPage.prototype.viewState=null;DiagramPage.prototype.getId=function(){return this.node.getAttribute("id")};
|
||||
if("undefined"!==typeof MathJax){var e=a.actions.addAction("mathematicalTypesetting",function(){var b=new ChangePageSetup(a);b.ignoreColor=!0;b.ignoreImage=!0;b.mathEnabled=!a.isMathEnabled();f.model.execute(b)});e.setToggleAction(!0);e.setSelectedCallback(function(){return a.isMathEnabled()});e.isEnabled=h}if(isLocalStorage||mxClient.IS_CHROMEAPP)e=a.actions.addAction("showStartScreen",function(){mxSettings.setShowStartScreen(!mxSettings.getShowStartScreen());mxSettings.save()}),e.setToggleAction(!0),
|
||||
e.setSelectedCallback(function(){return mxSettings.getShowStartScreen()});var l=a.actions.addAction("autosave",function(){a.editor.setAutosave(!a.editor.autosave)});l.setToggleAction(!0);l.setSelectedCallback(function(){return l.isEnabled()&&a.editor.autosave});a.actions.addAction("editGeometry...",function(){for(var b=f.getSelectionCells(),c=[],d=0;d<b.length;d++)f.getModel().isVertex(b[d])&&c.push(b[d]);0<c.length&&(b=new EditGeometryDialog(a,c),a.showDialog(b.container,180,180,!0,!0),b.init())},
|
||||
null,null,Editor.ctrlKey+"+Shift+M");var q="rounded shadow dashed dashPattern fontFamily fontSize fontColor fontStyle align verticalAlign strokeColor strokeWidth fillColor gradientColor swimlaneFillColor textOpacity gradientDirection glass labelBackgroundColor labelBorderColor opacity spacing spacingTop spacingLeft spacingBottom spacingRight endFill endArrow endSize startStill startArrow startSize arcSize".split(" ");a.actions.addAction("copyStyle",function(){var b=f.view.getState(f.getSelectionCell());
|
||||
if(f.isEnabled()&&null!=b){a.copiedStyle=mxUtils.clone(b.style);for(var b=f.getModel().getStyle(b.cell),b=null!=b?b.split(";"):[],c=0;c<b.length;c++){var d=b[c],e=d.indexOf("=");if(0<=e){var g=d.substring(0,e),d=d.substring(e+1);null==a.copiedStyle[g]&&"none"==d&&(a.copiedStyle[g]="none")}}}},null,null,Editor.ctrlKey+"+Shift+C");a.actions.addAction("pasteStyle",function(){if(f.isEnabled()&&!f.isSelectionEmpty()&&null!=a.copiedStyle){f.getModel().beginUpdate();try{for(var b=f.getSelectionCells(),c=
|
||||
0;c<b.length;c++)for(var d=f.view.getState(b[c]),e=0;e<q.length;e++){var g=q[e],h=a.copiedStyle[g];d.style[g]!=h&&f.setCellStyles(g,h,[b[c]])}}finally{f.getModel().endUpdate()}}},null,null,Editor.ctrlKey+"+Shift+V");a.actions.put("pageBackgroundImage",new Action(mxResources.get("backgroundImage")+"...",function(){if(!a.isOffline()){var b=new BackgroundImageDialog(a,function(b){a.setBackgroundImage(b)});a.showDialog(b.container,320,170,!0,!0);b.init()}}));a.actions.put("exportPng",new Action(mxResources.get("formatPng")+
|
||||
"...",function(){a.isExportToCanvas()?a.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://support.draw.io/display/DO/Exporting+Files",mxUtils.bind(this,function(b,c,d,e,f,g,h,l,m){b=parseInt(b);!isNaN(b)&&0<b&&a.exportImage(b/100,c,d,e,f,h,!l,m)}),!0,!1,"png"):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||a.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,function(b,c,d){a.downloadFile(c?"xmlpng":"png",null,null,b,null,null,d)}))}));a.actions.put("exportJpg",
|
||||
new Action(mxResources.get("formatJpg")+"...",function(){a.isExportToCanvas()?a.showExportDialog(mxResources.get("image"),!1,mxResources.get("export"),"https://support.draw.io/display/DO/Exporting+Files",mxUtils.bind(this,function(b,c,d,e,f,g,h,l,m){b=parseInt(b);!isNaN(b)&&0<b&&a.exportImage(b/100,!1,d,e,!1,h,!l,!1,"jpeg")}),!0,!1,"jpeg"):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||a.showRemoteExportDialog(mxResources.get("export"),null,mxUtils.bind(this,function(b,c){a.downloadFile("jpeg",
|
||||
null,null,b)}),!0)}));e=a.actions.put("shadowVisible",new Action(mxResources.get("shadow"),function(){f.setShadowVisible(!f.shadowVisible)}));e.setToggleAction(!0);e.setSelectedCallback(function(){return f.shadowVisible});var u=!1;a.actions.put("about",new Action(mxResources.get("aboutDrawio")+"...",function(){u||(a.showDialog((new AboutDialog(a)).container,220,300,!0,!0,function(){u=!1}),u=!0)},null,null,"F1"));a.actions.addAction("userManual...",function(){a.openLink("https://support.draw.io/display/DO/Draw.io+Online+User+Manual")});
|
||||
a.actions.addAction("support...",function(){a.openLink("https://about.draw.io/support/")});a.actions.addAction("exportOptionsDisabled...",function(){a.handleError({message:mxResources.get("exportOptionsDisabledDetails")},mxResources.get("exportOptionsDisabled"))});a.actions.addAction("keyboardShortcuts...",function(){mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?a.openLink("https://www.draw.io/shortcuts.svg"):mxClient.IS_SVG?a.openLink("shortcuts.svg"):a.openLink("https://www.draw.io/?lightbox=1#Uhttps%3A%2F%2Fwww.draw.io%2Fshortcuts.svg")});
|
||||
a.actions.addAction("feedback...",function(){var b=new FeedbackDialog(a);a.showDialog(b.container,610,360,!0,!0);b.init()});a.actions.addAction("quickStart...",function(){a.openLink("https://www.youtube.com/watch?v=Z0D96ZikMkc")});e=a.actions.addAction("tags...",mxUtils.bind(this,function(){null==this.tagsWindow?(this.tagsWindow=new TagsWindow(a,document.body.offsetWidth-380,230,300,120),this.tagsWindow.window.addListener("show",function(){a.fireEvent(new mxEventObject("tags"))}),this.tagsWindow.window.addListener("hide",
|
||||
function(){a.fireEvent(new mxEventObject("tags"))}),this.tagsWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("tags"))):this.tagsWindow.window.setVisible(!this.tagsWindow.window.isVisible())}));e.setToggleAction(!0);e.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.tagsWindow&&this.tagsWindow.window.isVisible()}));e=a.actions.addAction("find...",mxUtils.bind(this,function(){null==this.findWindow?(this.findWindow=new FindWindow(a,document.body.offsetWidth-300,110,240,140),
|
||||
this.findWindow.window.addListener("show",function(){a.fireEvent(new mxEventObject("find"))}),this.findWindow.window.addListener("hide",function(){a.fireEvent(new mxEventObject("find"))}),this.findWindow.window.setVisible(!0),a.fireEvent(new mxEventObject("find"))):this.findWindow.window.setVisible(!this.findWindow.window.isVisible())}));e.setToggleAction(!0);e.setSelectedCallback(mxUtils.bind(this,function(){return null!=this.findWindow&&this.findWindow.window.isVisible()}));a.actions.put("exportVsdx",
|
||||
new Action(mxResources.get("formatVsdx")+" (beta)...",function(){a.exportVisio()}));if(mxClient.IS_CHROMEAPP||isLocalStorage&&"1"!=urlParams.offline)if(this.put("language",new Menu(mxUtils.bind(this,function(b,c){var d=mxUtils.bind(this,function(d){var e=""==d?mxResources.get("automatic"):mxLanguageMap[d],f=null;""!=e&&(f=b.addItem(e,null,mxUtils.bind(this,function(){mxSettings.setLanguage(d);mxSettings.save();mxClient.language=d;mxResources.loadDefaultBundle=!1;mxResources.add(RESOURCE_BASE);a.alert(mxResources.get("restartForChangeRequired"))}),
|
||||
c),(d==mxLanguage||""==d&&null==mxLanguage)&&b.addCheckmark(f,Editor.checkmarkImage));return f});d("");b.addSeparator(c);for(var e in mxLanguageMap)d(e)}))),"atlas"!=uiTheme){var t=Menus.prototype.createMenubar;Menus.prototype.createMenubar=function(a){var b=t.apply(this,arguments);if(null!=b){var c=this.get("language");null!=c&&(c=b.addMenu("",c.funct),c.setAttribute("title",mxResources.get("language")),c.style.width="16px",c.style.paddingTop="2px",c.style.paddingLeft="4px",c.innerHTML='<div class="geIcon geSprite geSprite-globe"/>',
|
||||
c.style.zIndex="1",c.style.position="absolute",c.style.top="2px",c.style.right="17px",c.style.display="block",mxClient.IS_VML||mxUtils.setOpacity(c,60),document.body.appendChild(c))}return b}}this.put("help",new Menu(mxUtils.bind(this,function(b,c){if(!mxClient.IS_CHROMEAPP&&a.isOffline())this.addMenuItems(b,["about"],c);else{var d=b.addItem("Search:",null,null,c,null,null,!1);d.style.backgroundColor="dark"==uiTheme?"#505759":"whiteSmoke";d.style.cursor="default";var e=document.createElement("input");
|
||||
e.setAttribute("type","text");e.setAttribute("size","25");e.style.marginLeft="8px";mxEvent.addListener(e,"keydown",mxUtils.bind(this,function(a){var b=mxUtils.trim(e.value);13==a.keyCode&&0<b.length?(this.editorUi.openLink("https://desk.draw.io/support/search/solutions?term="+encodeURIComponent(b)),e.value="",this.editorUi.logEvent({category:"Help",action:"search",label:b}),null!=this.editorUi.menubar&&window.setTimeout(mxUtils.bind(this,function(){this.editorUi.menubar.hideMenu()}),0)):27==a.keyCode&&
|
||||
(e.value="")}));d.firstChild.nextSibling.appendChild(e);mxEvent.addGestureListeners(e,function(a){document.activeElement!=e&&e.focus();mxEvent.consume(a)},function(a){mxEvent.consume(a)},function(a){mxEvent.consume(a)});window.setTimeout(function(){e.focus()},0);this.addMenuItems(b,["-","quickStart","userManual","keyboardShortcuts","-"],c);mxClient.IS_CHROMEAPP||this.addMenuItems(b,["feedback"],c);this.addMenuItems(b,["support","-"],c);a.isOffline()||EditorUi.isElectronApp||navigator.standalone||
|
||||
"1"==urlParams.embed||this.addMenuItems(b,["download"],c);navigator.standalone||"1"==urlParams.embed||this.addMenuItems(b,["offline"],c);this.addMenuItems(b,["-","about"],c)}"1"==urlParams.ruler&&(mxResources.parse("rulerInch=Ruler unit: Inches"),this.editorUi.actions.addAction("rulerInch",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.INCHES);this.editorUi.hRuler.setUnit(mxRuler.prototype.INCHES);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),
|
||||
mxResources.parse("rulerCM=Ruler unit: CMs"),this.editorUi.actions.addAction("rulerCM",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.CENTIMETER);this.editorUi.hRuler.setUnit(mxRuler.prototype.CENTIMETER);this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),mxResources.parse("rulerPixel=Ruler unit: Pixels"),this.editorUi.actions.addAction("rulerPixel",mxUtils.bind(this,function(){this.editorUi.vRuler.setUnit(mxRuler.prototype.PIXELS);this.editorUi.hRuler.setUnit(mxRuler.prototype.PIXELS);
|
||||
this.editorUi.vRuler.drawRuler(!0);this.editorUi.hRuler.drawRuler(!0)})),this.addMenuItems(b,["-","rulerInch","rulerCM","rulerPixel"],c));"1"==urlParams.test&&(mxResources.parse("showBoundingBox=Show bounding box"),this.editorUi.actions.addAction("showBoundingBox",mxUtils.bind(this,function(){var a=f.getGraphBounds(),b=f.view.translate,d=f.view.scale;f.insertVertex(c,null,"",a.x/d-b.x,a.y/d-b.y,a.width/d,a.height/d,"fillColor=none;strokeColor=red;")})),mxResources.parse("createSidebarEntry=Create sidebar entry"),
|
||||
this.editorUi.actions.addAction("createSidebarEntry",mxUtils.bind(this,function(){f.isSelectionEmpty()||(mxLog.show(),mxLog.debug("sb.createVertexTemplateFromData('"+f.compress(mxUtils.getXml(f.encodeCells(f.getSelectionCells())))+"', width, height, 'Title');"))})),this.addMenuItems(b,["-","createSidebarEntry","showBoundingBox"],c),mxResources.parse("testXmlImageExport=XML Image Export"),this.editorUi.actions.addAction("testXmlImageExport",mxUtils.bind(this,function(){var a=new mxImageExport,b=f.getGraphBounds(),
|
||||
c=f.view.scale,d=mxUtils.createXmlDocument(),e=d.createElement("output");d.appendChild(e);d=new mxXmlCanvas2D(e);d.translate(Math.floor((1-b.x)/c),Math.floor((1-b.y)/c));d.scale(1/c);var k=0,g=d.save;d.save=function(){k++;g.apply(this,arguments)};var h=d.restore;d.restore=function(){k--;h.apply(this,arguments)};var l=a.drawShape;a.drawShape=function(a){mxLog.debug("entering shape",a,k);l.apply(this,arguments);mxLog.debug("leaving shape",a,k)};a.drawState(f.getView().getState(f.model.root),d);mxLog.show();
|
||||
mxLog.debug(mxUtils.getXml(e));mxLog.debug("stateCounter",k)})),this.addMenuItems(b,["testXmlImageExport"],c),mxResources.parse("testShowRtModel=Show RT model"),mxResources.parse("testDebugRtModel=Debug RT model"),mxResources.parse("testDownloadRtModel=Download RT model"),this.editorUi.actions.addAction("testShowRtModel",mxUtils.bind(this,function(){null!=this.editorUi.getCurrentFile()&&null!=this.editorUi.getCurrentFile().realtime&&(console.log("bytesUsed",this.editorUi.getCurrentFile().realtime.rtModel.bytesUsed),
|
||||
console.log("root",this.editorUi.getCurrentFile().realtime.dumpRoot()),this.editorUi.getCurrentFile().realtime.check())})),this.editorUi.actions.addAction("testDebugRtModel",mxUtils.bind(this,function(){gapi.drive.realtime.debug()})),this.editorUi.actions.addAction("testDownloadRtModel",mxUtils.bind(this,function(){var b=this.editorUi.getCurrentFile();null!=b&&null!=b.realtime&&a.spinner.spin(document.body,mxResources.get("export"))&&(b=new mxXmlRequest("https://www.googleapis.com/drive/v2/files/"+
|
||||
b.getHash().substring(1)+"/realtime",null,"GET"),b.setRequestHeaders=function(a){mxXmlRequest.prototype.setRequestHeaders.apply(this,arguments);var b=gapi.auth.getToken().access_token;a.setRequestHeader("authorization","Bearer "+b)},b.send(function(b){a.spinner.stop();200<=b.getStatus()&&299>=b.getStatus()&&a.saveLocalFile(b.getText(),"realtime.txt","text/plain")}))})),null!=this.editorUi.getCurrentFile()&&null!=this.editorUi.getCurrentFile().realtime&&this.addMenuItems(b,["-","testShowRtModel","testDebugRtModel",
|
||||
"testDownloadRtModel"],c),mxResources.parse("testShowConsole=Show Console"),this.editorUi.actions.addAction("testShowConsole",function(){mxLog.isVisible()?mxLog.window.fit():mxLog.show();mxLog.window.div.style.zIndex=mxPopupMenu.prototype.zIndex-1}),this.addMenuItems(b,["-","testShowConsole"]))})));a.actions.addAction("shapes...",function(){mxClient.IS_CHROMEAPP||!a.isOffline()?a.showDialog((new MoreShapesDialog(a,!0)).container,640,isLocalStorage?mxClient.IS_IOS?480:460:440,!0,!0):a.showDialog((new MoreShapesDialog(a,
|
||||
!1)).container,360,isLocalStorage?mxClient.IS_IOS?300:280:260,!0,!0)});a.actions.addAction("createShape...",function(){a.getCurrentFile();if(f.isEnabled()){var b=new mxCell("",new mxGeometry(0,0,120,120),a.defaultCustomShapeStyle);b.vertex=!0;b=new EditShapeDialog(a,b,mxResources.get("editShape")+":",630,400);a.showDialog(b.container,640,480,!0,!1);b.init()}});a.actions.put("embedHtml",new Action(mxResources.get("html")+"...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),
|
||||
function(b){a.spinner.stop();a.showHtmlDialog(mxResources.get("create"),"https://desk.draw.io/support/solutions/articles/16000042542",b,function(b,c,d,e,f,k,g,h,l,m){a.createHtml(b,c,d,e,f,k,g,h,l,m,mxUtils.bind(this,function(b,c){var d=new EmbedDialog(a,b+"\n"+c,null,null,function(){var a=window.open(),d=a.document;"CSS1Compat"===document.compatMode&&d.writeln("<!DOCTYPE html>");d.writeln("<html>");d.writeln("<head><title>"+encodeURIComponent(mxResources.get("preview"))+'</title><meta charset="utf-8"></head>');
|
||||
d.writeln("<body>");d.writeln(b);var e=mxClient.IS_IE||mxClient.IS_EDGE||null!=document.documentMode;e&&d.writeln(c);d.writeln("</body>");d.writeln("</html>");d.close();if(!e){var f=a.document.createElement("div");f.marginLeft="26px";f.marginTop="26px";mxUtils.write(f,mxResources.get("updatingDocument"));e=a.document.createElement("img");e.setAttribute("src",window.location.protocol+"//"+window.location.hostname+"/"+IMAGE_PATH+"/spin.gif");e.style.marginLeft="6px";f.appendChild(e);a.document.body.insertBefore(f,
|
||||
a.document.body.firstChild);window.setTimeout(function(){var a=document.createElement("script");a.type="text/javascript";a.src=/<script.*?src="(.*?)"/.exec(c)[1];d.body.appendChild(a);f.parentNode.removeChild(f)},20)}});a.showDialog(d.container,440,240,!0,!0);d.init()}))})})}));a.actions.put("liveImage",new Action("Live image...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();null!=b?(b=encodeURIComponent(b),b=new EmbedDialog(a,
|
||||
EXPORT_URL+"?format=png&url="+b,0),a.showDialog(b.container,440,240,!0,!0),b.init()):a.handleError({message:mxResources.get("invalidPublicUrl")})})}));a.actions.put("embedImage",new Action(mxResources.get("image")+"...",function(){a.showEmbedImageDialog(function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.createEmbedImage(b,c,d,e,f,g,function(b){a.spinner.stop();b=new EmbedDialog(a,b);a.showDialog(b.container,440,240,!0,!0);b.init()},function(b){a.spinner.stop();a.handleError(b)})},
|
||||
mxResources.get("image"),mxResources.get("retina"),a.isExportToCanvas())}));a.actions.put("embedSvg",new Action(mxResources.get("formatSvg")+"...",function(){a.showEmbedImageDialog(function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.createEmbedSvg(b,c,d,e,f,g,function(b){a.spinner.stop();b=new EmbedDialog(a,b);a.showDialog(b.container,440,240,!0,!0);b.init()},function(b){a.spinner.stop();a.handleError(b)})},mxResources.get("formatSvg"),mxResources.get("image"),!0,"https://desk.draw.io/support/solutions/articles/16000042548")}));
|
||||
a.actions.put("embedIframe",new Action(mxResources.get("iframe")+"...",function(){var b=f.getGraphBounds();a.showPublishLinkDialog(mxResources.get("iframe"),null,"100%",Math.ceil((b.y+b.height-f.view.translate.y)/f.view.scale)+2,function(b,c,d,e,f,k,g,h){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(l){a.spinner.stop();l=new EmbedDialog(a,'<iframe frameborder="0" style="width:'+g+";height:"+h+';" src="'+a.createLink(b,c,d,e,f,k,l)+'"></iframe>');
|
||||
a.showDialog(l.container,440,240,!0,!0);l.init()})},!0)}));a.actions.put("publishLink",new Action(mxResources.get("link")+"...",function(){a.showPublishLinkDialog(null,null,null,null,function(b,c,d,e,f,g){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(k){a.spinner.stop();k=new EmbedDialog(a,a.createLink(b,c,d,e,f,g,k));a.showDialog(k.container,440,240,!0,!0);k.init()})})}));a.actions.addAction("googleDocs...",function(){a.openLink("http://docsaddon.draw.io")});
|
||||
a.actions.addAction("googleSites...",function(){a.spinner.spin(document.body,mxResources.get("loading"))&&a.getPublicUrl(a.getCurrentFile(),function(b){a.spinner.stop();b=new GoogleSitesDialog(a,b);a.showDialog(b.container,420,256,!0,!0);b.init()})});if(isLocalStorage||mxClient.IS_CHROMEAPP)e=a.actions.addAction("scratchpad",function(){a.toggleScratchpad()}),e.setToggleAction(!0),e.setSelectedCallback(function(){return null!=a.scratchpad}),a.actions.addAction("plugins...",function(){a.showDialog((new PluginsDialog(a)).container,
|
||||
360,170,!0,!1)});e=a.actions.addAction("search",function(){var b=a.sidebar.isEntryVisible("search");a.sidebar.showPalette("search",!b);isLocalStorage&&(mxSettings.settings.search=!b,mxSettings.save())});e.setToggleAction(!0);e.setSelectedCallback(function(){return a.sidebar.isEntryVisible("search")});"1"==urlParams.embed&&(a.actions.get("save").funct=function(b){f.isEditing()&&f.stopEditing();var c="0"!=urlParams.pages||null!=a.pages&&1<a.pages.length?a.getFileData(!0):mxUtils.getXml(a.editor.getGraphXml());
|
||||
if("json"==urlParams.proto){var d=a.createLoadMessage("save");d.xml=c;b&&(d.exit=!0);c=JSON.stringify(d)}(window.opener||window.parent).postMessage(c,"*");"0"!=urlParams.modified&&"1"!=urlParams.keepmodified&&(a.editor.modified=!1,a.editor.setStatus(""));null!=a.getCurrentFile()&&a.saveFile()},a.actions.addAction("saveAndExit",function(){a.actions.get("save").funct(!0)}),a.actions.addAction("exit",function(){var b=function(){a.editor.modified=!1;var b="json"==urlParams.proto?JSON.stringify({event:"exit",
|
||||
modified:a.editor.modified}):"";(window.opener||window.parent).postMessage(b,"*")};a.editor.modified?a.confirm(mxResources.get("allChangesLost"),null,b,mxResources.get("cancel"),mxResources.get("discardChanges")):b()}));this.put("exportAs",new Menu(mxUtils.bind(this,function(b,c){a.isExportToCanvas()?(this.addMenuItems(b,["exportPng"],c),a.jpgSupported&&this.addMenuItems(b,["exportJpg"],c)):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["exportPng","exportJpg"],c);this.addMenuItems(b,
|
||||
["exportSvg","-"],c);a.isOffline()||a.printPdfExport?this.addMenuItems(b,["exportPdf"],c):a.isOffline()||mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["exportPdf"],c);mxClient.IS_IE11||mxClient.IS_IE||"undefined"===typeof VsdxExport&&a.isOffline()||this.addMenuItems(b,["exportVsdx"],c);this.addMenuItems(b,["-","exportHtml","exportXml","exportUrl"],c);a.isOffline()||(b.addSeparator(c),this.addMenuItem(b,"export",c).firstChild.nextSibling.innerHTML=mxResources.get("advanced")+"...")})));
|
||||
this.editorUi.actions.addAction("chatWindowTitle...",mxUtils.bind(this.editorUi,this.editorUi.toggleChat));this.put("importFrom",new Menu(function(c,d){function e(b){b.pickFile(function(c){a.spinner.spin(document.body,mxResources.get("loading"))&&b.getFile(c,function(b){var c=g(b.getTitle());/\.svg$/i.test(b.getTitle())&&!a.editor.isDataSvg(b.getData())&&(b.setData(a.createSvgDataUri(b.getData())),c="image/svg+xml");k(b.getData(),c,b.getTitle())},function(b){a.handleError(b,null!=b?mxResources.get("errorLoadingFile"):
|
||||
null)},b==a.drive)},!0)}var k=mxUtils.bind(this,function(b,c,d){var e=f.view,k=f.getGraphBounds(),g=f.snap(Math.ceil(Math.max(0,k.x/e.scale-e.translate.x)+4*f.gridSize)),h=f.snap(Math.ceil(Math.max(0,(k.y+k.height)/e.scale-e.translate.y)+4*f.gridSize));"data:image/"==b.substring(0,11)?a.loadImage(b,mxUtils.bind(this,function(e){var k=!0,l=mxUtils.bind(this,function(){a.resizeImage(e,b,mxUtils.bind(this,function(e,l,m){e=k?Math.min(1,Math.min(a.maxImageSize/l,a.maxImageSize/m)):1;a.importFile(b,c,
|
||||
g,h,Math.round(l*e),Math.round(m*e),d,function(b){a.spinner.stop();f.setSelectionCells(b);f.scrollCellToVisible(f.getSelectionCell())})}),k)});b.length>a.resampleThreshold?a.confirmImageResize(function(a){k=a;l()}):l()}),mxUtils.bind(this,function(){a.handleError({message:mxResources.get("cannotOpenFile")})})):a.importFile(b,c,g,h,0,0,d,function(b){a.spinner.stop();f.setSelectionCells(b);f.scrollCellToVisible(f.getSelectionCell())})}),g=mxUtils.bind(this,function(a){var b="text/xml";/\.png$/i.test(a)?
|
||||
b="image/png":/\.jpe?g$/i.test(a)?b="image/jpg":/\.gif$/i.test(a)&&(b="image/gif");return b});"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?c.addItem(mxResources.get("googleDrive")+"...",null,function(){e(a.drive)},d):m&&c.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1));null!=a.gitHub&&c.addItem(mxResources.get("github")+"...",null,function(){e(a.gitHub)},d);null!=a.dropbox?c.addItem(mxResources.get("dropbox")+
|
||||
"...",null,function(){e(a.dropbox)},d):n&&c.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.oneDrive?c.addItem(mxResources.get("oneDrive")+"...",null,function(){e(a.oneDrive)},d):p&&c.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?c.addItem(mxResources.get("trello")+"...",null,function(){e(a.trello)},d):b&&c.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+
|
||||
"...)",null,function(){},d,null,!1);c.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&c.addItem(mxResources.get("browser")+"...",null,function(){a.importLocalFile(!1)},d);mxClient.IS_IOS||c.addItem(mxResources.get("device")+"...",null,function(){a.importLocalFile(!0)},d);a.isOffline()||(c.addSeparator(d),c.addItem(mxResources.get("url")+"...",null,function(){var b=new FilenameDialog(a,"",mxResources.get("import"),function(b){if(null!=b&&0<b.length&&a.spinner.spin(document.body,mxResources.get("loading"))){var c=
|
||||
/(\.png)($|\?)/i.test(b)?"image/png":"text/xml";a.loadUrl(PROXY_URL+"?url="+encodeURIComponent(b),function(a){k(a,c,b)},function(){a.spinner.stop();a.handleError(null,mxResources.get("errorLoadingFile"))},"image/png"==c)}},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},d))})).isEnabled=h;this.put("theme",new Menu(mxUtils.bind(this,function(b,c){var d=b.addItem(mxResources.get("kennedy"),null,function(){mxSettings.setUi("");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},
|
||||
c);"atlas"!=uiTheme&&"dark"!=uiTheme&&"min"!=uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);d=b.addItem(mxResources.get("minimal"),null,function(){mxSettings.setUi("min");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"min"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);d=b.addItem(mxResources.get("atlas"),null,function(){mxSettings.setUi("atlas");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"atlas"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage);
|
||||
d=b.addItem(mxResources.get("dark"),null,function(){mxSettings.setUi("dark");mxSettings.save();a.alert(mxResources.get("restartForChangeRequired"))},c);"dark"==uiTheme&&b.addCheckmark(d,Editor.checkmarkImage)})));e=this.editorUi.actions.addAction("rename...",mxUtils.bind(this,function(){var b=this.editorUi.getCurrentFile();if(null!=b){var c=null!=b.getTitle()?b.getTitle():this.editorUi.defaultFilename,c=new FilenameDialog(this.editorUi,c,mxResources.get("rename"),mxUtils.bind(this,function(a){null!=
|
||||
a&&0<a.length&&null!=b&&this.editorUi.spinner.spin(document.body,mxResources.get("renaming"))&&b.rename(a,mxUtils.bind(this,function(a){this.editorUi.spinner.stop()}),mxUtils.bind(this,function(a){this.editorUi.handleError(a,null!=a?mxResources.get("errorRenamingFile"):null)}))}),b.constructor==DriveFile||b.constructor==StorageFile?mxResources.get("diagramName"):null,function(b){if(null!=b&&0<b.length)return!0;a.showError(mxResources.get("error"),mxResources.get("invalidName"),mxResources.get("ok"));
|
||||
return!1});this.editorUi.showDialog(c.container,300,80,!0,!0);c.init()}}));e.isEnabled=function(){return this.enabled&&h.apply(this,arguments)};e.visible="1"!=urlParams.embed;a.actions.addAction("makeCopy...",mxUtils.bind(this,function(){var b=a.getCurrentFile();if(null!=b){var c=null!=b.getTitle()?b.getTitle():a.defaultFilename,d="",e=c.lastIndexOf(".");0<=e&&(d=c.substring(e),c=c.substring(0,e));c=mxResources.get("copyOf",[c])+d;b.constructor==DriveFile?(c=new CreateDialog(a,c,mxUtils.bind(this,
|
||||
function(c,d){"download"==d&&(d=App.MODE_GOOGLE);null!=c&&0<c.length&&(d==App.MODE_GOOGLE?a.spinner.spin(document.body,mxResources.get("saving"))&&b.save(!1,mxUtils.bind(this,function(){b.saveAs(c,mxUtils.bind(this,function(b){a.spinner.stop();var c=a.getUrl();window.openWindow(c+"#G"+b.id,null,mxUtils.bind(this,function(){window.location.hash="G"+b.id}))}),mxUtils.bind(this,function(b){a.handleError(b)}))}),mxUtils.bind(this,function(b){a.handleError(b)})):this.editorUi.createFile(c,this.editorUi.getFileData(!0),
|
||||
null,d))}),mxUtils.bind(this,function(){a.hideDialog()}),mxResources.get("makeCopy"),mxResources.get("create"),null,null,null,null,!0),a.showDialog(c.container,420,380,!0,!0),c.init()):a.editor.editAsNew(this.editorUi.getFileData(!0),c)}}));a.actions.addAction("moveToFolder...",mxUtils.bind(this,function(){var b=a.getCurrentFile();b.getMode()!=App.MODE_GOOGLE&&b.getMode()!=App.MODE_ONEDRIVE||a.pickFolder(b.getMode(),mxUtils.bind(this,function(c){a.spinner.spin(document.body,mxResources.get("moving"))&&
|
||||
b.move(c,mxUtils.bind(this,function(b){a.spinner.stop()}),mxUtils.bind(this,function(b){a.handleError(b)}))}))}));this.put("publish",new Menu(mxUtils.bind(this,function(a,b){this.addMenuItems(a,["publishLink"],b)})));a.actions.put("offline",new Action(mxResources.get("offline")+"...",function(){a.openLink("https://app.draw.io/")}));a.actions.put("download",new Action(mxResources.get("download")+"...",function(){a.openLink("https://get.draw.io/")}));this.editorUi.actions.addAction("share...",mxUtils.bind(this,
|
||||
function(){var a=this.editorUi.getCurrentFile();null!=a&&this.editorUi.drive.showPermissions(a.getId())}));this.put("embed",new Menu(mxUtils.bind(this,function(b,c){"1"==urlParams.test&&this.addMenuItems(b,["liveImage","-"],c);this.addMenuItems(b,["embedImage","embedSvg","-","embedHtml"],c);navigator.standalone||a.isOffline()||this.addMenuItems(b,["embedIframe"],c);a.isOffline()||this.addMenuItems(b,["-","googleSites","googleDocs"],c)})));var w=function(b,c,d,e){("plantUml"!=e||EditorUi.enablePlantUml&&
|
||||
!a.isOffline())&&b.addItem(d,null,mxUtils.bind(this,function(){if("fromText"==e||"formatSql"==e||"plantUml"==e){var b=new ParseDialog(a,d,e);a.showDialog(b.container,620,420,!0,!1);a.dialog.container.style.overflow="auto"}else b=new CreateGraphDialog(a,d,e),a.showDialog(b.container,620,420,!0,!1);b.init()}),c)},x=function(a,b,c,d){var e=f.isMouseInsertPoint()?f.getInsertPoint():f.getFreeInsertPoint();a=new mxCell(a,new mxGeometry(e.x,e.y,b,c),d);a.vertex=!0;f.getModel().beginUpdate();try{a=f.addCell(a),
|
||||
f.fireEvent(new mxEventObject("cellsInserted","cells",[a]))}finally{f.getModel().endUpdate()}f.scrollCellToVisible(a);f.setSelectionCell(a);f.container.focus();f.editAfterInsert&&f.startEditing(a);return a};a.actions.addAction("insertText",function(){f.isEnabled()&&!f.isCellLocked(f.getDefaultParent())&&f.startEditingAtCell(x("Text",40,20,"text;html=1;resizable=0;autosize=1;align=center;verticalAlign=middle;points=[];fillColor=none;strokeColor=none;rounded=0;"))},null,null,Editor.ctrlKey+"+Shift+X").isEnabled=
|
||||
h;a.actions.addAction("insertRectangle",function(){f.isEnabled()&&!f.isCellLocked(f.getDefaultParent())&&x("",120,60,"whiteSpace=wrap;html=1;")},null,null,Editor.ctrlKey+"+K").isEnabled=h;a.actions.addAction("insertEllipse",function(){f.isEnabled()&&!f.isCellLocked(f.getDefaultParent())&&x("",80,80,"ellipse;whiteSpace=wrap;html=1;")},null,null,Editor.ctrlKey+"+Shift+K").isEnabled=h;a.actions.addAction("insertRhombus",function(){f.isEnabled()&&!f.isCellLocked(f.getDefaultParent())&&x("",80,80,"rhombus;whiteSpace=wrap;html=1;")}).isEnabled=
|
||||
h;var A=mxUtils.bind(this,function(a,b,c){for(var d=0;d<c.length;d++)"-"==c[d]?a.addSeparator(b):w(a,b,mxResources.get(c[d])+"...",c[d])});this.put("insert",new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,"insertText insertRectangle - insertEllipse insertRhombus - insertLink insertImage".split(" "),c);b.addSeparator(c);this.addSubmenu("insertLayout",b,c,mxResources.get("layout"));b.addSeparator(c);A(b,c,["fromText","plantUml","-","formatSql"]);b.addItem(mxResources.get("csv")+"...",null,
|
||||
function(){a.showImportCsvDialog()},c)})));this.put("insertLayout",new Menu(mxUtils.bind(this,function(a,b){A(a,b,"horizontalFlow verticalFlow - horizontalTree verticalTree radialTree - organic circle".split(" "))})));this.put("openRecent",new Menu(function(b,c){var d=a.getRecent();if(null!=d){for(var e=0;e<d.length;e++)(function(d){var e=d.mode;e==App.MODE_GOOGLE?e="googleDrive":e==App.MODE_ONEDRIVE&&(e="oneDrive");b.addItem(d.title+" ("+mxResources.get(e)+")",null,function(){a.loadFile(d.id)},c)})(d[e]);
|
||||
b.addSeparator(c)}b.addItem(mxResources.get("reset"),null,function(){a.resetRecent()},c)}));this.put("openFrom",new Menu(function(c,d){null!=a.drive?c.addItem(mxResources.get("googleDrive")+"...",null,function(){a.pickFile(App.MODE_GOOGLE)},d):m&&c.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.gitHub&&c.addItem(mxResources.get("github")+"...",null,function(){a.pickFile(App.MODE_GITHUB)},d);null!=a.dropbox?c.addItem(mxResources.get("dropbox")+
|
||||
"...",null,function(){a.pickFile(App.MODE_DROPBOX)},d):n&&c.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.oneDrive?c.addItem(mxResources.get("oneDrive")+"...",null,function(){a.pickFile(App.MODE_ONEDRIVE)},d):p&&c.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?c.addItem(mxResources.get("trello")+"...",null,function(){a.pickFile(App.MODE_TRELLO)},d):b&&c.addItem(mxResources.get("trello")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);c.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&c.addItem(mxResources.get("browser")+"...",null,function(){a.pickFile(App.MODE_BROWSER)},d);mxClient.IS_IOS||c.addItem(mxResources.get("device")+"...",null,function(){a.pickFile(App.MODE_DEVICE)},d);a.isOffline()||(c.addSeparator(d),c.addItem(mxResources.get("url")+"...",null,function(){var b=new FilenameDialog(a,"",mxResources.get("open"),function(b){null!=b&&0<b.length&&
|
||||
(null==a.getCurrentFile()?window.location.hash="#U"+encodeURIComponent(b):window.openWindow((mxClient.IS_CHROMEAPP?"https://www.draw.io/":"https://"+location.host+"/")+window.location.search+"#U"+encodeURIComponent(b)))},mxResources.get("url"));a.showDialog(b.container,300,80,!0,!0);b.init()},d))}));Editor.enableCustomLibraries&&(this.put("newLibrary",new Menu(function(c,d){"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?c.addItem(mxResources.get("googleDrive")+"...",
|
||||
null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_GOOGLE)},d):m&&c.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1));null!=a.gitHub&&c.addItem(mxResources.get("github")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_GITHUB)},d);null!=a.dropbox?c.addItem(mxResources.get("dropbox")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_DROPBOX)},d):n&&c.addItem(mxResources.get("dropbox")+
|
||||
" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.oneDrive?c.addItem(mxResources.get("oneDrive")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_ONEDRIVE)},d):p&&c.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?c.addItem(mxResources.get("trello")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_TRELLO)},d):b&&c.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+
|
||||
"...)",null,function(){},d,null,!1);c.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&c.addItem(mxResources.get("browser")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_BROWSER)},d);mxClient.IS_IOS||c.addItem(mxResources.get("device")+"...",null,function(){a.showLibraryDialog(null,null,null,null,App.MODE_DEVICE)},d)})),this.put("openLibraryFrom",new Menu(function(c,d){"undefined"!=typeof google&&"undefined"!=typeof google.picker&&(null!=a.drive?c.addItem(mxResources.get("googleDrive")+
|
||||
"...",null,function(){a.pickLibrary(App.MODE_GOOGLE)},d):m&&c.addItem(mxResources.get("googleDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1));null!=a.gitHub&&c.addItem(mxResources.get("github")+"...",null,function(){a.pickLibrary(App.MODE_GITHUB)},d);null!=a.dropbox?c.addItem(mxResources.get("dropbox")+"...",null,function(){a.pickLibrary(App.MODE_DROPBOX)},d):n&&c.addItem(mxResources.get("dropbox")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=
|
||||
a.oneDrive?c.addItem(mxResources.get("oneDrive")+"...",null,function(){a.pickLibrary(App.MODE_ONEDRIVE)},d):p&&c.addItem(mxResources.get("oneDrive")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);null!=a.trello?c.addItem(mxResources.get("trello")+"...",null,function(){a.pickLibrary(App.MODE_TRELLO)},d):b&&c.addItem(mxResources.get("trello")+" ("+mxResources.get("loading")+"...)",null,function(){},d,null,!1);c.addSeparator(d);isLocalStorage&&"0"!=urlParams.browser&&c.addItem(mxResources.get("browser")+
|
||||
"...",null,function(){a.pickLibrary(App.MODE_BROWSER)},d);mxClient.IS_IOS||c.addItem(mxResources.get("device")+"...",null,function(){a.pickLibrary(App.MODE_DEVICE)},d);a.isOffline()||(c.addSeparator(d),c.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.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(z){a.handleError(z,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()},d))})));this.put("edit",new Menu(mxUtils.bind(this,function(b,a){this.addMenuItems(b,"undo redo - cut copy paste delete - duplicate - find - editData editTooltip editStyle - edit - editLink openLink - selectVertices selectEdges selectAll selectNone - lockUnlock".split(" "))})));
|
||||
this.put("view",new Menu(mxUtils.bind(this,function(b,c){this.addMenuItems(b,(null!=this.editorUi.format?["formatPanel"]:[]).concat(["outline","layers","-"]));this.addMenuItems(b,["-","search"],c);if(isLocalStorage||mxClient.IS_CHROMEAPP){var d=this.addMenuItem(b,"scratchpad",c);a.isOffline()&&!mxClient.IS_CHROMEAPP||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);this.addLinkToItem(d,
|
||||
"https://desk.draw.io/support/solutions/articles/16000032875")}"1"!=urlParams.embed&&this.addMenuItems(b,["autosave"],c);this.addMenuItems(b,["-","createShape","editDiagram"],c);b.addSeparator(c);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&this.addMenuItems(b,["showStartScreen"],c);!a.isOfflineApp()&&"1"!=urlParams.embed&&isLocalStorage&&(d=this.addMenuItem(b,"plugins",c),a.isOffline()||this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000056430"));b.addSeparator(c);
|
||||
d=this.addMenuItem(b,"tags",c);a.isOffline()&&!mxClient.IS_CHROMEAPP||this.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000046966")})));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)),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();null!=d&&d.constructor==DriveFile?(d.isRestricted()&&this.addMenuItems(b,["exportOptionsDisabled"],c),null==d.realtime?this.addMenuItems(b,["save","share","-"],c):(d.isAutosave()||this.addMenuItems(b,["save"],c),this.addMenuItems(b,["share","chatWindowTitle","-"],c))):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):(this.addMenuItems(b,["-","save","saveAs","-","rename"],c),a.isOfflineApp()?a.isOffline()||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);null==d||d.constructor!=DriveFile&&d.constructor!=DropboxFile||this.addMenuItems(b,["-","revisionHistory"],c);null!=d&&d.constructor==DriveFile&&this.addMenuItems(b,["createRevision"],c);this.addMenuItems(b,["-","pageSetup"],c);mxClient.IS_IOS&&navigator.standalone||this.addMenuItems(b,["print"],c);this.addMenuItems(b,["-","close"])}})))};var f=Menus.prototype.menuCreated;Menus.prototype.menuCreated=function(a,
|
||||
d){if(480>=screen.width&&a==this.get("help")){d.style.paddingRight="0px";d.style.paddingLeft="0px";d.innerHTML="";var c=document.createElement("img");c.setAttribute("border","0");c.setAttribute("valign","bottom");c.setAttribute("src",Editor.helpImage);d.appendChild(c)}f.apply(this,arguments)}})();function DiagramPage(a){this.node=a;(null==this.node.hasAttribute&&null==this.node.getAttribute("id")||null!=this.node.hasAttribute&&!this.node.hasAttribute("id"))&&this.node.setAttribute("id",function(){function a(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)}return a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()}())}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,d,f){this.ui=a;this.page=d;this.previous=this.name=f}RenamePage.prototype.execute=function(){var a=this.page.getName();this.page.setName(this.previous);this.previous=a;this.ui.editor.graph.updatePlaceholders();this.ui.editor.fireEvent(new mxEventObject("pageRenamed"))};
|
||||
function MovePage(a,d,f){this.ui=a;this.oldIndex=d;this.newIndex=f}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,d){this.ui=a;this.previousPage=this.page=d;this.neverShown=!0;null!=d&&(this.neverShown=null==d.viewState,this.ui.updatePageRoot(d))}
|
||||
|
@ -7909,12 +7910,12 @@ EditorUi.prototype.setGraphEnabled;EditorUi.prototype.setGraphEnabled=function(a
|
|||
mxResources.get("text");b.actions.get("editDiagram").label=mxResources.get("formatXml")+"...";b.actions.get("insertRectangle").label=mxResources.get("rectangle");b.actions.get("insertEllipse").label=mxResources.get("ellipse");b.actions.get("insertRhombus").label=mxResources.get("rhombus");b.actions.get("insertImage").label=mxResources.get("image")+"...";b.actions.get("insertLink").label=mxResources.get("link")+"...";b.actions.get("createShape").label=mxResources.get("shape")+"...";b.actions.get("outline").label=
|
||||
mxResources.get("outline")+"...";b.actions.get("layers").label=mxResources.get("layers")+"...";b.actions.put("importFile",new Action("File...",function(){c.popupMenuHandler.hideMenu();var a=document.createElement("input");a.setAttribute("type","file");mxEvent.addListener(a,"change",function(){null!=a.files&&b.importFiles(a.files,null,null,b.maxImageSize)});a.click()}));b.actions.put("importCsv",new Action(mxResources.get("csv")+"...",function(){c.popupMenuHandler.hideMenu();b.showImportCsvDialog()}));
|
||||
b.actions.put("importText",new Action(mxResources.get("text")+"...",function(){var a=new ParseDialog(b,"Insert from Text");b.showDialog(a.container,620,420,!0,!1);a.init()}));b.actions.put("formatSql",new Action(mxResources.get("formatSql")+"...",function(){var a=new ParseDialog(b,"Insert from Text","formatSql");b.showDialog(a.container,620,420,!0,!1);a.init()}));b.actions.put("toggleShapes",new Action(mxResources.get("shapes")+"...",function(){d(b)}));b.actions.put("toggleFormat",new Action(mxResources.get("format")+
|
||||
"...",function(){a(b)}));EditorUi.enablePlantUml&&b.actions.put("plantUml",new Action(mxResources.get("plantUml")+"...",function(){var a=new ParseDialog(b,"Insert from Text","plantUml");b.showDialog(a.container,620,420,!0,!1);a.init()}));this.put("diagram",new Menu(mxUtils.bind(this,function(a,c){b.menus.addSubmenu("extras",a,c,mxResources.get("preferences"));a.addSeparator(c);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?b.menus.addMenuItems(a,"new open - save saveAs -".split(" "),c):"1"==urlParams.embed?
|
||||
(b.menus.addMenuItems(a,["-","save"],c),"1"==urlParams.saveAndExit&&b.menus.addMenuItems(a,["saveAndExit"],c),a.addSeparator(c)):(b.menus.addMenuItems(a,["new"],c),b.menus.addSubmenu("openFrom",a,c),a.addSeparator(c),b.menus.addSubmenu("save",a,c));b.menus.addSubmenu("exportAs",a,c);var d=b.getCurrentFile();null!=d&&d.constructor==DriveFile&&(b.menus.addMenuItems(a,["-","share"],c),null!=d.realtime&&b.menus.addMenuItems(a,["chatWindowTitle"],c),a.addSeparator(c));b.menus.addMenuItems(a,["-","outline",
|
||||
"layers","-","find"],c);d=this.addMenuItem(a,"tags",c);b.isOffline()&&!mxClient.IS_CHROMEAPP||b.menus.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000046966");a.addSeparator(c);mxClient.IS_IOS&&navigator.standalone||b.menus.addMenuItems(a,["-","print","-"],c);b.menus.addSubmenu("help",a,c);"1"==urlParams.embed?b.menus.addMenuItems(a,["-","exit"],c):b.menus.addMenuItems(a,["-","close"])})));if(isLocalStorage){var e=this.get("openFrom"),f=e.funct;e.funct=function(a,c){f.apply(this,
|
||||
arguments);a.addSeparator(c);b.menus.addSubmenu("openRecent",a,c)}}this.put("save",new Menu(mxUtils.bind(this,function(a,c){var d=b.getCurrentFile();null!=d&&d.constructor==DriveFile?b.menus.addMenuItems(a,["createRevision","makeCopy","-","rename","moveToFolder"],c):b.menus.addMenuItems(a,["save","saveAs","-","rename","makeCopy"],c);null==d||d.constructor!=DriveFile&&d.constructor!=DropboxFile||b.menus.addMenuItems(a,["-","revisionHistory"],c);b.menus.addMenuItems(a,["-","autosave"],c)})));var g=
|
||||
this.get("exportAs");this.put("exportAs",new Menu(mxUtils.bind(this,function(a,c){g.funct(a,c);a.addSeparator(c);b.menus.addSubmenu("embed",a,c);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||b.menus.addMenuItems(a,["publishLink"],c)})));var h=this.get("language");this.put("extras",new Menu(mxUtils.bind(this,function(a,c){"1"!=urlParams.embed&&b.menus.addSubmenu("theme",a,c);null!=h&&b.menus.addSubmenu("language",a,c);a.addSeparator(c);b.menus.addMenuItems(a,["scrollbars","tooltips","pageScale"],
|
||||
c);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&b.menus.addMenuItems(a,["-","search","scratchpad","-","showStartScreen"],c);if(!b.isOfflineApp()&&"1"!=urlParams.embed&&isLocalStorage){a.addSeparator(c);var d=b.menus.addMenuItem(a,"plugins",c);b.isOffline()||b.menus.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000056430")}})));this.put("insertAdvanced",new Menu(mxUtils.bind(this,function(a,c){b.menus.addMenuItems(a,"importText createShape plantUml - importCsv formatSql editDiagram".split(" "),
|
||||
"...",function(){a(b)}));EditorUi.enablePlantUml&&!b.isOffline()&&b.actions.put("plantUml",new Action(mxResources.get("plantUml")+"...",function(){var a=new ParseDialog(b,"Insert from Text","plantUml");b.showDialog(a.container,620,420,!0,!1);a.init()}));this.put("diagram",new Menu(mxUtils.bind(this,function(a,c){b.menus.addSubmenu("extras",a,c,mxResources.get("preferences"));a.addSeparator(c);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp?b.menus.addMenuItems(a,"new open - save saveAs -".split(" "),
|
||||
c):"1"==urlParams.embed?(b.menus.addMenuItems(a,["-","save"],c),"1"==urlParams.saveAndExit&&b.menus.addMenuItems(a,["saveAndExit"],c),a.addSeparator(c)):(b.menus.addMenuItems(a,["new"],c),b.menus.addSubmenu("openFrom",a,c),a.addSeparator(c),b.menus.addSubmenu("save",a,c));b.menus.addSubmenu("exportAs",a,c);var d=b.getCurrentFile();null!=d&&d.constructor==DriveFile&&(b.menus.addMenuItems(a,["-","share"],c),null!=d.realtime&&b.menus.addMenuItems(a,["chatWindowTitle"],c),a.addSeparator(c));b.menus.addMenuItems(a,
|
||||
["-","outline","layers","-","find"],c);d=this.addMenuItem(a,"tags",c);b.isOffline()&&!mxClient.IS_CHROMEAPP||b.menus.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000046966");a.addSeparator(c);mxClient.IS_IOS&&navigator.standalone||b.menus.addMenuItems(a,["-","print","-"],c);b.menus.addSubmenu("help",a,c);"1"==urlParams.embed?b.menus.addMenuItems(a,["-","exit"],c):b.menus.addMenuItems(a,["-","close"])})));if(isLocalStorage){var e=this.get("openFrom"),f=e.funct;e.funct=function(a,
|
||||
c){f.apply(this,arguments);a.addSeparator(c);b.menus.addSubmenu("openRecent",a,c)}}this.put("save",new Menu(mxUtils.bind(this,function(a,c){var d=b.getCurrentFile();null!=d&&d.constructor==DriveFile?b.menus.addMenuItems(a,["createRevision","makeCopy","-","rename","moveToFolder"],c):b.menus.addMenuItems(a,["save","saveAs","-","rename","makeCopy"],c);null==d||d.constructor!=DriveFile&&d.constructor!=DropboxFile||b.menus.addMenuItems(a,["-","revisionHistory"],c);b.menus.addMenuItems(a,["-","autosave"],
|
||||
c)})));var g=this.get("exportAs");this.put("exportAs",new Menu(mxUtils.bind(this,function(a,c){g.funct(a,c);a.addSeparator(c);b.menus.addSubmenu("embed",a,c);mxClient.IS_CHROMEAPP||EditorUi.isElectronApp||b.menus.addMenuItems(a,["publishLink"],c)})));var h=this.get("language");this.put("extras",new Menu(mxUtils.bind(this,function(a,c){"1"!=urlParams.embed&&b.menus.addSubmenu("theme",a,c);null!=h&&b.menus.addSubmenu("language",a,c);a.addSeparator(c);b.menus.addMenuItems(a,["scrollbars","tooltips",
|
||||
"pageScale"],c);"1"!=urlParams.embed&&(isLocalStorage||mxClient.IS_CHROMEAPP)&&b.menus.addMenuItems(a,["-","search","scratchpad","-","showStartScreen"],c);if(!b.isOfflineApp()&&"1"!=urlParams.embed&&isLocalStorage){a.addSeparator(c);var d=b.menus.addMenuItem(a,"plugins",c);b.isOffline()||b.menus.addLinkToItem(d,"https://desk.draw.io/support/solutions/articles/16000056430")}})));this.put("insertAdvanced",new Menu(mxUtils.bind(this,function(a,c){b.menus.addMenuItems(a,"importText plantUml - formatSql importCsv - createShape editDiagram".split(" "),
|
||||
c)})));mxResources.parse("insertLayout="+mxResources.get("layout"));mxResources.parse("insertAdvanced="+mxResources.get("advanced"));this.put("insert",new Menu(mxUtils.bind(this,function(a,c){b.menus.addMenuItems(a,"insertRectangle insertEllipse insertRhombus - insertText insertLink - insertImage".split(" "),c);b.menus.addSubmenu("importFrom",a,c);a.addSeparator(c);b.menus.addSubmenu("insertLayout",a,c);b.menus.addSubmenu("insertAdvanced",a,c)})));var l="horizontalFlow verticalFlow - horizontalTree verticalTree radialTree - organic circle".split(" "),
|
||||
m=function(a,c,d,e){a.addItem(d,null,mxUtils.bind(this,function(){var a=new CreateGraphDialog(b,d,e);b.showDialog(a.container,620,420,!0,!1);a.init()}),c)};this.put("insertLayout",new Menu(mxUtils.bind(this,function(a,b){for(var c=0;c<l.length;c++)"-"==l[c]?a.addSeparator(b):m(a,b,mxResources.get(l[c])+"...",l[c])})));this.put("view",new Menu(mxUtils.bind(this,function(a,c){b.menus.addMenuItems(a,"grid guides - connectionArrows connectionPoints - copyConnect collapseExpand - mathematicalTypesetting".split(" "),
|
||||
c)})))};var t=EditorUi.prototype.init;EditorUi.prototype.init=function(){function a(a,b,c,d){var f=e.menus.get(a),g=l.addMenu(mxResources.get(a),mxUtils.bind(this,function(){f.funct.apply(this,arguments)}));g.className="geMenuItem";g.style.display="inline-block";g.style.boxSizing="border-box";g.style.top="6px";g.style.marginRight="6px";g.style.height="30px";g.style.paddingTop="6px";g.style.paddingBottom="6px";g.setAttribute("title",mxResources.get(a));e.menus.menuCreated(f,g,"geMenuItem");null!=c?
|
||||
|
|
|
@ -2164,26 +2164,29 @@ App.prototype.start = function()
|
|||
|
||||
if (urlParams['splash'] == '0' && (id == null || id.length == 0))
|
||||
{
|
||||
var draft = this.getDraft();
|
||||
var fileData = (draft != null) ? draft.data : this.getFileData();
|
||||
var prev = Editor.useLocalStorage;
|
||||
this.createFile(this.defaultFilename, fileData, null, null, null, null, null, true);
|
||||
Editor.useLocalStorage = prev;
|
||||
|
||||
// Draft was used so the user should save the file
|
||||
if (draft != null)
|
||||
if (!mxClient.IS_CHROMEAPP)
|
||||
{
|
||||
var file = this.getCurrentFile();
|
||||
var draft = this.getDraft();
|
||||
var fileData = (draft != null) ? draft.data : this.getFileData();
|
||||
var prev = Editor.useLocalStorage;
|
||||
this.createFile(this.defaultFilename, fileData, null, null, null, null, null, true);
|
||||
Editor.useLocalStorage = prev;
|
||||
|
||||
if (file != null)
|
||||
// Draft was used so the user should save the file
|
||||
if (draft != null)
|
||||
{
|
||||
file.addUnsavedStatus();
|
||||
var file = this.getCurrentFile();
|
||||
|
||||
if (file != null)
|
||||
{
|
||||
file.addUnsavedStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.loadFile(this.getDiagramId());
|
||||
this.loadFile(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2364,7 +2367,7 @@ App.prototype.showSplash = function(force)
|
|||
this.showSplash();
|
||||
}));
|
||||
}
|
||||
else if (this.mode == null || force)
|
||||
else if (!mxClient.IS_CHROMEAPP && (this.mode == null || force))
|
||||
{
|
||||
var rowLimit = (serviceCount == 4) ? 2 : 3;
|
||||
|
||||
|
|
|
@ -960,7 +960,7 @@ var ErrorDialog = function(editorUi, title, message, buttonText, fn, retry, butt
|
|||
/**
|
||||
* Constructs a new embed dialog
|
||||
*/
|
||||
var EmbedDialog = function(editorUi, result, timeout, ignoreSize, previewFn)
|
||||
var EmbedDialog = function(editorUi, result, timeout, ignoreSize, previewFn, title)
|
||||
{
|
||||
var div = document.createElement('div');
|
||||
var maxSize = 500000;
|
||||
|
@ -970,8 +970,15 @@ var EmbedDialog = function(editorUi, result, timeout, ignoreSize, previewFn)
|
|||
// Checks if result is a link
|
||||
var validUrl = /^https?:\/\//.test(result) || /^mailto:\/\//.test(result);
|
||||
|
||||
mxUtils.write(div, mxResources.get((result.length < maxSize) ?
|
||||
((validUrl) ? 'link' : 'mainEmbedNotice') : 'preview') + ':');
|
||||
if (title != null)
|
||||
{
|
||||
mxUtils.write(div, title);
|
||||
}
|
||||
else
|
||||
{
|
||||
mxUtils.write(div, mxResources.get((result.length < maxSize) ?
|
||||
((validUrl) ? 'link' : 'mainEmbedNotice') : 'preview') + ':');
|
||||
}
|
||||
mxUtils.br(div);
|
||||
|
||||
var size = document.createElement('div');
|
||||
|
|
|
@ -1486,12 +1486,14 @@
|
|||
cells = this.getCellsForAction(action.select);
|
||||
this.setSelectionCells(cells);
|
||||
}
|
||||
|
||||
if (action.scroll != null)
|
||||
|
||||
if (action.highlight != null)
|
||||
{
|
||||
cells = this.getCellsForAction(action.scroll);
|
||||
cells = this.getCellsForAction(action.highlight);
|
||||
this.highlightCells(cells, action.highlight.color,
|
||||
action.highlight.duration, action.highlight.opacity);
|
||||
}
|
||||
|
||||
|
||||
if (action.toggle != null)
|
||||
{
|
||||
this.toggleCells(this.getCellsForAction(action.toggle));
|
||||
|
@ -1507,13 +1509,11 @@
|
|||
this.setCellsVisible(this.getCellsForAction(action.hide), false);
|
||||
}
|
||||
|
||||
if (action.highlight != null)
|
||||
if (action.scroll != null)
|
||||
{
|
||||
cells = this.getCellsForAction(action.highlight);
|
||||
this.highlightCells(cells, action.highlight.color,
|
||||
action.highlight.duration, action.highlight.opacity);
|
||||
cells = this.getCellsForAction(action.scroll);
|
||||
}
|
||||
|
||||
|
||||
if (cells.length > 0)
|
||||
{
|
||||
this.scrollCellToVisible(cells[0]);
|
||||
|
|
|
@ -6190,25 +6190,31 @@
|
|||
{
|
||||
// Fires cellsInserted to apply the current style to the inserted text.
|
||||
// This requires the value to be empty when the event is fired.
|
||||
cell = graph.insertVertex(graph.getDefaultParent(), null, '',
|
||||
cell = graph.insertVertex(graph.getDefaultParent(), null, '',
|
||||
graph.snap(dx), graph.snap(dy), 1, 1, 'text;' + ((html) ? 'html=1;' : ''));
|
||||
graph.fireEvent(new mxEventObject('textInserted', 'cells', [cell]));
|
||||
graph.fireEvent(new mxEventObject('textInserted', 'cells', [cell]));
|
||||
|
||||
// Apply value and updates the cell size to fit the text block
|
||||
cell.value = text;
|
||||
graph.updateCellSize(cell);
|
||||
|
||||
// See http://stackoverflow.com/questions/6927719/url-regex-does-not-work-in-javascript
|
||||
var regexp = /\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;
|
||||
|
||||
if (regexp.test(cell.value))
|
||||
{
|
||||
graph.setLinkForCell(cell, cell.value);
|
||||
}
|
||||
|
||||
// Adds spacing
|
||||
cell.geometry.width += graph.gridSize;
|
||||
cell.geometry.height += graph.gridSize;
|
||||
// Single tag is converted
|
||||
if (text.charAt(0) == '<' && text.indexOf('>') == text.length - 1)
|
||||
{
|
||||
text = mxUtils.htmlEntities(text);
|
||||
}
|
||||
|
||||
// Apply value and updates the cell size to fit the text block
|
||||
cell.value = text;
|
||||
graph.updateCellSize(cell);
|
||||
|
||||
// See http://stackoverflow.com/questions/6927719/url-regex-does-not-work-in-javascript
|
||||
var regexp = /\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;
|
||||
|
||||
if (regexp.test(cell.value))
|
||||
{
|
||||
graph.setLinkForCell(cell, cell.value);
|
||||
}
|
||||
|
||||
// Adds spacing
|
||||
cell.geometry.width += graph.gridSize;
|
||||
cell.geometry.height += graph.gridSize;
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
|
|
@ -244,7 +244,6 @@ function setCurrentXml(data, filename)
|
|||
// Enables offline mode
|
||||
if (urlParams['offline'] == '1' || urlParams['demo'] == '1' || urlParams['stealth'] == '1' || urlParams['local'] == '1')
|
||||
{
|
||||
urlParams['analytics'] = '0';
|
||||
urlParams['picker'] = '0';
|
||||
urlParams['gapi'] = '0';
|
||||
urlParams['db'] = '0';
|
||||
|
|
|
@ -420,7 +420,7 @@
|
|||
action.isEnabled = isGraphEnabled;
|
||||
}
|
||||
|
||||
if (isLocalStorage)
|
||||
if (isLocalStorage || mxClient.IS_CHROMEAPP)
|
||||
{
|
||||
var action = editorUi.actions.addAction('showStartScreen', function()
|
||||
{
|
||||
|
@ -1957,7 +1957,7 @@
|
|||
|
||||
var addInsertItem = function(menu, parent, title, method)
|
||||
{
|
||||
if (method != 'plantUml' || EditorUi.enablePlantUml)
|
||||
if (method != 'plantUml' || (EditorUi.enablePlantUml && !editorUi.isOffline()))
|
||||
{
|
||||
menu.addItem(title, null, mxUtils.bind(this, function()
|
||||
{
|
||||
|
|
|
@ -696,7 +696,7 @@ EditorUi.initMinimalTheme = function()
|
|||
toggleFormat(ui);
|
||||
}));
|
||||
|
||||
if (EditorUi.enablePlantUml)
|
||||
if (EditorUi.enablePlantUml && !ui.isOffline())
|
||||
{
|
||||
ui.actions.put('plantUml', new Action(mxResources.get('plantUml') + '...', function()
|
||||
{
|
||||
|
@ -868,7 +868,7 @@ EditorUi.initMinimalTheme = function()
|
|||
|
||||
this.put('insertAdvanced', new Menu(mxUtils.bind(this, function(menu, parent)
|
||||
{
|
||||
ui.menus.addMenuItems(menu, ['importText', 'createShape', 'plantUml', '-', 'importCsv', 'formatSql', 'editDiagram'], parent);
|
||||
ui.menus.addMenuItems(menu, ['importText', 'plantUml', '-', 'formatSql', 'importCsv', '-', 'createShape', 'editDiagram'], parent);
|
||||
})));
|
||||
|
||||
mxResources.parse('insertLayout=' + mxResources.get('layout'));
|
||||
|
|
|
@ -468,7 +468,7 @@
|
|||
this.createVertexTemplateEntry(s + 'drawio2;fillColor=#1A5BA3',
|
||||
w * 261, h * 354, '', 'Draw.io', null, null, this.getTagsForStencil(gn, 'drawio draw io draw.io', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'drawio3;fillColor=#1A5BA3;fontSize=15;fontColor=#1A5BA3;fontStyle=1',
|
||||
w * 261, h * 261, 'draw<font color="#f08707">.io</font>', 'Draw.io', null, null, this.getTagsForStencil(gn, 'drawio draw io draw.io', dt).join(' ')),
|
||||
w * 261, h * 261, 'draw.<font color="#f08707">io</font>', 'Draw.io', null, null, this.getTagsForStencil(gn, 'drawio draw io draw.io', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'dribbble;fillColor=#EB548D',
|
||||
w * 337, h * 336, '', 'Dribbble', null, null, this.getTagsForStencil(gn, 'dribbble', dt).join(' ')),
|
||||
this.createVertexTemplateEntry(s + 'dropbox;fillColor=#0287EA',
|
||||
|
|
2
src/main/webapp/js/embed-static.min.js
vendored
2
src/main/webapp/js/embed-static.min.js
vendored
|
@ -184,7 +184,7 @@ f)+"\n"+t+"}":"{"+z.join(",")+"}";f=t;return l}}"function"!==typeof Date.prototy
|
|||
e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;e<d;e+=1)g+=" ";else"string"===typeof d&&(g=d);if((k=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
|
||||
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,d){var e,f,g=a[d];if(g&&"object"===typeof g)for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&(f=c(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,d,g)}var e;a=""+a;d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
||||
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?c({"":e},""):e;throw new SyntaxError("JSON.parse");})})();"undefined"===typeof window.mxBasePath&&(window.mxBasePath="https://www.draw.io/mxgraph/");window.mxLoadStylesheets=window.mxLoadStylesheets||!1;window.mxLoadResources=window.mxLoadResources||!1;window.mxLanguage=window.mxLanguage||"en";window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"8.8.6",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"8.8.7",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&
|
||||
0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&&
|
||||
0>navigator.userAgent.indexOf("Iceweasel/1.")&&0>navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/")&&0>navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/")&&0>navigator.userAgent.indexOf("Iceape/1."),IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||
|
||||
|
|
|
@ -975,11 +975,6 @@ EditorUi.prototype.footerHeight = 28;
|
|||
*/
|
||||
EditorUi.prototype.sidebarFooterHeight = 34;
|
||||
|
||||
/**
|
||||
* Specifies the link for the edit button in chromeless mode.
|
||||
*/
|
||||
EditorUi.prototype.editButtonLink = null;
|
||||
|
||||
/**
|
||||
* Specifies the position of the horizontal split bar. Default is 208 or 118 for
|
||||
* screen widths <= 640px.
|
||||
|
@ -1001,6 +996,11 @@ EditorUi.prototype.lightboxMaxFitScale = 2;
|
|||
*/
|
||||
EditorUi.prototype.lightboxVerticalDivider = 4;
|
||||
|
||||
/**
|
||||
* Specifies if single click on horizontal split should collapse sidebar. Default is false.
|
||||
*/
|
||||
EditorUi.prototype.hsplitClickEnabled = false;
|
||||
|
||||
/**
|
||||
* Installs the listeners to update the action states.
|
||||
*/
|
||||
|
@ -3247,16 +3247,16 @@ EditorUi.prototype.addSplitHandler = function(elt, horizontal, dx, onChange)
|
|||
mxEvent.consume(evt);
|
||||
});
|
||||
|
||||
mxEvent.addListener(elt, 'click', function(evt)
|
||||
mxEvent.addListener(elt, 'click', mxUtils.bind(this, function(evt)
|
||||
{
|
||||
if (!ignoreClick)
|
||||
if (!ignoreClick && this.hsplitClickEnabled)
|
||||
{
|
||||
var next = (last != null) ? last - dx : 0;
|
||||
last = getValue();
|
||||
onChange(next);
|
||||
mxEvent.consume(evt);
|
||||
}
|
||||
});
|
||||
}));
|
||||
|
||||
mxEvent.addGestureListeners(document, null, moveHandler, dropHandler);
|
||||
|
||||
|
|
2
src/main/webapp/js/reader.min.js
vendored
2
src/main/webapp/js/reader.min.js
vendored
|
@ -184,7 +184,7 @@ f)+"\n"+t+"}":"{"+z.join(",")+"}";f=t;return l}}"function"!==typeof Date.prototy
|
|||
e=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,f,g,h={"\b":"\\b","\t":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},k;"function"!==typeof JSON.stringify&&(JSON.stringify=function(a,b,d){var e;g=f="";if("number"===typeof d)for(e=0;e<d;e+=1)g+=" ";else"string"===typeof d&&(g=d);if((k=b)&&"function"!==typeof b&&("object"!==typeof b||"number"!==typeof b.length))throw Error("JSON.stringify");return c("",{"":a})});
|
||||
"function"!==typeof JSON.parse&&(JSON.parse=function(a,b){function c(a,d){var e,f,g=a[d];if(g&&"object"===typeof g)for(e in g)Object.prototype.hasOwnProperty.call(g,e)&&(f=c(g,e),void 0!==f?g[e]=f:delete g[e]);return b.call(a,d,g)}var e;a=""+a;d.lastIndex=0;d.test(a)&&(a=a.replace(d,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).slice(-4)}));if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,
|
||||
"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return e=eval("("+a+")"),"function"===typeof b?c({"":e},""):e;throw new SyntaxError("JSON.parse");})})();"undefined"===typeof window.mxBasePath&&(window.mxBasePath="https://www.draw.io/mxgraph/");window.mxLoadStylesheets=window.mxLoadStylesheets||!1;window.mxLoadResources=window.mxLoadResources||!1;window.mxLanguage=window.mxLanguage||"en";window.urlParams=window.urlParams||{};window.MAX_REQUEST_SIZE=window.MAX_REQUEST_SIZE||10485760;window.MAX_AREA=window.MAX_AREA||225E6;window.EXPORT_URL=window.EXPORT_URL||"/export";window.SAVE_URL=window.SAVE_URL||"/save";window.OPEN_URL=window.OPEN_URL||"/open";window.RESOURCES_PATH=window.RESOURCES_PATH||"resources";window.RESOURCE_BASE=window.RESOURCE_BASE||window.RESOURCES_PATH+"/grapheditor";window.STENCIL_PATH=window.STENCIL_PATH||"stencils";window.IMAGE_PATH=window.IMAGE_PATH||"images";
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"8.8.6",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
window.STYLE_PATH=window.STYLE_PATH||"styles";window.CSS_PATH=window.CSS_PATH||"styles";window.OPEN_FORM=window.OPEN_FORM||"open.html";window.mxBasePath=window.mxBasePath||"../../../src";window.mxLanguage=window.mxLanguage||urlParams.lang;window.mxLanguages=window.mxLanguages||["de"];var mxClient={VERSION:"8.8.7",IS_IE:0<=navigator.userAgent.indexOf("MSIE"),IS_IE6:0<=navigator.userAgent.indexOf("MSIE 6"),IS_IE11:!!navigator.userAgent.match(/Trident\/7\./),IS_EDGE:!!navigator.userAgent.match(/Edge\//),IS_QUIRKS:0<=navigator.userAgent.indexOf("MSIE")&&(null==document.documentMode||5==document.documentMode),IS_EM:"spellcheck"in document.createElement("textarea")&&8==document.documentMode,VML_PREFIX:"v",OFFICE_PREFIX:"o",IS_NS:0<=navigator.userAgent.indexOf("Mozilla/")&&0>navigator.userAgent.indexOf("MSIE")&&
|
||||
0>navigator.userAgent.indexOf("Edge/"),IS_OP:0<=navigator.userAgent.indexOf("Opera/")||0<=navigator.userAgent.indexOf("OPR/"),IS_OT:0<=navigator.userAgent.indexOf("Presto/")&&0>navigator.userAgent.indexOf("Presto/2.4.")&&0>navigator.userAgent.indexOf("Presto/2.3.")&&0>navigator.userAgent.indexOf("Presto/2.2.")&&0>navigator.userAgent.indexOf("Presto/2.1.")&&0>navigator.userAgent.indexOf("Presto/2.0.")&&0>navigator.userAgent.indexOf("Presto/1."),IS_SF:0<=navigator.userAgent.indexOf("AppleWebKit/")&&
|
||||
0>navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_IOS:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?!0:!1,IS_GC:0<=navigator.userAgent.indexOf("Chrome/")&&0>navigator.userAgent.indexOf("Edge/"),IS_CHROMEAPP:null!=window.chrome&&null!=chrome.app&&null!=chrome.app.runtime,IS_FF:0<=navigator.userAgent.indexOf("Firefox/"),IS_MT:0<=navigator.userAgent.indexOf("Firefox/")&&0>navigator.userAgent.indexOf("Firefox/1.")&&0>navigator.userAgent.indexOf("Firefox/2.")||0<=navigator.userAgent.indexOf("Iceweasel/")&&
|
||||
0>navigator.userAgent.indexOf("Iceweasel/1.")&&0>navigator.userAgent.indexOf("Iceweasel/2.")||0<=navigator.userAgent.indexOf("SeaMonkey/")&&0>navigator.userAgent.indexOf("SeaMonkey/1.")||0<=navigator.userAgent.indexOf("Iceape/")&&0>navigator.userAgent.indexOf("Iceape/1."),IS_SVG:0<=navigator.userAgent.indexOf("Firefox/")||0<=navigator.userAgent.indexOf("Iceweasel/")||0<=navigator.userAgent.indexOf("Seamonkey/")||0<=navigator.userAgent.indexOf("Iceape/")||0<=navigator.userAgent.indexOf("Galeon/")||
|
||||
|
|
1041
src/main/webapp/js/viewer.min.js
vendored
1041
src/main/webapp/js/viewer.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,10 @@ Draw.loadPlugin(function(ui)
|
|||
// Adds action
|
||||
ui.actions.addAction('extractText', function()
|
||||
{
|
||||
mxUtils.popup(ui.editor.graph.getIndexableText());
|
||||
var dlg = new EmbedDialog(ui, ui.editor.graph.getIndexableText(),
|
||||
null, null, null, 'Extracted Text:');
|
||||
ui.showDialog(dlg.container, 440, 240, true, true);
|
||||
dlg.init();
|
||||
});
|
||||
|
||||
var menu = ui.menus.get('extras');
|
||||
|
|
4
src/main/webapp/plugins/webcola/cola.min.js
vendored
Normal file
4
src/main/webapp/plugins/webcola/cola.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
763
src/main/webapp/plugins/webcola/mxWebColaAdaptor.js
Normal file
763
src/main/webapp/plugins/webcola/mxWebColaAdaptor.js
Normal file
|
@ -0,0 +1,763 @@
|
|||
/**
|
||||
* Copyright (c) 2006-2018, JGraph Ltd
|
||||
* Copyright (c) 2006-2018, Gaudenz Alder
|
||||
*/
|
||||
/**
|
||||
* Class: mxWebColaAdaptor
|
||||
*
|
||||
* Extends WebCola's cola object to act as both adaptor and layout in WebCola for mxGraph.
|
||||
*
|
||||
* Constructor: mxWebColaAdaptor
|
||||
*
|
||||
* Constructs a new WebCola-based adaptor for given mxGraph.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* graph - <mxGraph> that contains the cells.
|
||||
* dimension - <[]> array containing [width, height] of canvas in points
|
||||
* movableVertices - <[]> IDs of vertices that are movable; if undefined all vertices are movable
|
||||
* options - <{}> WebCola options for layout/adapter
|
||||
*
|
||||
**/
|
||||
var doNothing = function()
|
||||
/**
|
||||
* Empty method for default event handlers
|
||||
*/
|
||||
{
|
||||
}
|
||||
|
||||
function mxWebColaAdaptor(graph, dimension, movableVertices, options)
|
||||
/**
|
||||
* Conatructs a WebCola adaptor for mxGraph
|
||||
* @param graph mxGraph instance
|
||||
* @param dimension array containing [width, height] of drawing canvas in points
|
||||
* @param movableVertices set containing IDs of vertices that are movable; if undefined all vertices are movable
|
||||
* @param options WebCola options for layout/adapter
|
||||
* @constructor
|
||||
*/
|
||||
{
|
||||
this.graph = graph;
|
||||
this.dimension = dimension;
|
||||
if (typeof dimension === 'undefined')
|
||||
{
|
||||
this.dimension = [600, 600];
|
||||
}
|
||||
var layoutResult = this.graphToLayout(graph, movableVertices);
|
||||
this.nodes = layoutResult.nodes;
|
||||
this.links = layoutResult.links;
|
||||
this.groups = layoutResult.groups;
|
||||
this.cellToNode = layoutResult.cellToNode;
|
||||
this.isStopped = false;
|
||||
this.options = {};
|
||||
// assign default values
|
||||
for (var key in this.defaultValues)
|
||||
{
|
||||
this.options[key] = this.defaultValues[key];
|
||||
}
|
||||
// if options were passed, override defaults for keys available in options
|
||||
if (options != null)
|
||||
{
|
||||
for (var key in options)
|
||||
{
|
||||
this.options[key] = options[key];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// default layout options
|
||||
mxWebColaAdaptor.prototype.defaultValues = {
|
||||
doAnimations: true, // whether to show the layout as it's running
|
||||
// doAnimations: false, // whether to show the layout as it's running
|
||||
skipFrames: 1, // number of ticks per frame; higher is faster but more jerky
|
||||
maxSimulationTime: 4000, // max length in ms to run the layout
|
||||
ungrabifyWhileSimulating: false, // so you can't drag nodes during layout
|
||||
fit: true, // on every layout reposition of nodes, fit the viewport
|
||||
padding: 30, // padding around the simulation
|
||||
boundingBox: undefined, // constrain layout bounds; { x1, y1, x2, y2 } or { x1, y1, w, h }
|
||||
nodeDimensionsIncludeLabels: false, // whether labels should be included in determining the space used by a node
|
||||
|
||||
// layout event callbacks
|
||||
ready: function ready() {}, // on layoutready
|
||||
stop: function stop() {}, // on layoutstop
|
||||
|
||||
// positioning options
|
||||
randomize: false, // use random node positions at beginning of layout
|
||||
avoidOverlap: true, // if true, prevents overlap of node bounding boxes
|
||||
handleDisconnected: true, // if true, avoids disconnected components from overlapping
|
||||
nodeSpacing: function nodeSpacing(node) {
|
||||
return 10;
|
||||
}, // extra spacing around nodes
|
||||
flow: undefined, // use DAG/tree flow layout if specified, e.g. { axis: 'y', minSeparation: 30 }
|
||||
alignment: undefined, // relative alignment constraints on nodes, e.g. function( node ){ return { x: 0, y: 1 } }
|
||||
gapInequalities: undefined, // list of inequality constraints for the gap between the nodes, e.g. [{"axis":"y", "left":node1, "right":node2, "gap":25}]
|
||||
|
||||
// different methods of specifying edge length
|
||||
// each can be a constant numerical value or a function like `function( edge ){ return 2; }`
|
||||
edgeLength: undefined, // sets edge length directly in simulation
|
||||
edgeSymDiffLength: undefined, // symmetric diff edge length in simulation
|
||||
edgeJaccardLength: undefined, // jaccard edge length in simulation
|
||||
|
||||
// iterations of cola algorithm; uses default values on undefined
|
||||
unconstrIter: undefined, // unconstrained initial layout iterations
|
||||
userConstIter: undefined, // initial layout iterations with user-specified constraints
|
||||
allConstIter: undefined, // initial layout iterations with all constraints including non-overlap
|
||||
|
||||
// infinite layout options
|
||||
keepRunning: false // overrides all other options for a forces-all-the-time mode
|
||||
};
|
||||
|
||||
mxWebColaAdaptor.prototype.updatePositions = function()
|
||||
/**
|
||||
* Default method for updating positions
|
||||
* Should be overridden by the caller/user of the adaptor
|
||||
*/
|
||||
{
|
||||
console.log("colaAdaptor: updatePositions");
|
||||
// TODO: do all the positions here
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.kick = function (colaAdaptor)
|
||||
/**
|
||||
* Starts WebCola computation on the given adaptor
|
||||
*/
|
||||
{
|
||||
console.log("colaAdaptor: step");
|
||||
|
||||
if ('doAnimations' in this.options && this.options.doAnimations)
|
||||
{
|
||||
doRendering(this.callback);
|
||||
}
|
||||
else
|
||||
{
|
||||
// run until the end
|
||||
while (!this.process(colaAdaptor))
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.step = function (colaAdaptor)
|
||||
/**
|
||||
* Notifies about a single layout computation step on WebCola adaptor
|
||||
*/
|
||||
{
|
||||
if ('doAnimations' in this.options && this.options.doAnimations)
|
||||
{
|
||||
this.updatePositions();
|
||||
}
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.frameSteps = function(colaAdaptor)
|
||||
/**
|
||||
* Runs multiple ticks on WebCola adaptor until finished
|
||||
*/
|
||||
{
|
||||
var result = void 0;
|
||||
|
||||
for (var i = 0; i < this.options.skipFrames && !result; i++) {
|
||||
result = result || this.process(colaAdaptor);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.process = function(colaAdaptor)
|
||||
/**
|
||||
* Executes the whole layout computation on WebCola adaptor
|
||||
*/
|
||||
{
|
||||
if (this.isStopped)
|
||||
{
|
||||
this.finish();
|
||||
return true;
|
||||
}
|
||||
var result = colaAdaptor.tick();
|
||||
if (result && this.options.keepRunning) {
|
||||
colaAdaptor.resume();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.renderingChain = function(colaAdaptor)
|
||||
/**
|
||||
* This keeps rendering new simulation frames until end is reached
|
||||
*/
|
||||
{
|
||||
if (this.process(colaAdaptor))
|
||||
{
|
||||
return;
|
||||
}
|
||||
doRendering(this.callback);
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.finish = function()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.run = function()
|
||||
/**
|
||||
* Runs the layout computation on given nodes/links/groups
|
||||
* @returns Nothing
|
||||
*/
|
||||
{
|
||||
var layout = this;
|
||||
var options = this.options;
|
||||
|
||||
var colaAdaptor = layout.adaptor = cola.adaptor
|
||||
({
|
||||
trigger: function (evt)
|
||||
{
|
||||
var START = cola.EventType ? cola.EventType.start : 'start';
|
||||
var TICK = cola.EventType ? cola.EventType.tick : 'tick';
|
||||
var END = cola.EventType ? cola.EventType.end : 'end';
|
||||
|
||||
switch (evt.type)
|
||||
{
|
||||
case START:
|
||||
{
|
||||
// colaAdaptor.start();
|
||||
}
|
||||
break;
|
||||
case TICK:
|
||||
{
|
||||
layout.step();
|
||||
}
|
||||
break;
|
||||
case END:
|
||||
{
|
||||
console.log("colaAdaptor: end");
|
||||
layout.updatePositions();
|
||||
if (!options.keepRunning)
|
||||
{
|
||||
layout.finish();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
kick: function ()
|
||||
{
|
||||
layout.kick(colaAdaptor);
|
||||
},
|
||||
|
||||
finish: function()
|
||||
{
|
||||
layout.finish();
|
||||
},
|
||||
|
||||
on: doNothing,
|
||||
|
||||
drag: doNothing
|
||||
});
|
||||
|
||||
colaAdaptor.nodes(this.nodes)
|
||||
.links(this.links)
|
||||
.groups(this.groups)
|
||||
.linkDistance(function (link)
|
||||
{
|
||||
return link.length;
|
||||
});
|
||||
|
||||
layout.callback = function()
|
||||
{
|
||||
layout.renderingChain(colaAdaptor);
|
||||
}
|
||||
|
||||
colaAdaptor.avoidOverlaps(options.avoidOverlap)
|
||||
.handleDisconnected(options.handleDisconnected)
|
||||
// .constraints(constraints)
|
||||
// .start(100, 100, 100);
|
||||
.start();
|
||||
return this.adaptor;
|
||||
}
|
||||
|
||||
// module.exports = defaultValues;
|
||||
|
||||
function getScreenConstraints(layout, width, height)
|
||||
/**
|
||||
* Returns a set of constraints covering limits of screen
|
||||
* @param layout
|
||||
* @param width
|
||||
* @param height
|
||||
* @returns {Array}
|
||||
*/
|
||||
{
|
||||
var gap = 20;
|
||||
var size = layout._nodes.length;
|
||||
var topLeft = {x: 0, y: 0, fixed: true, index: size};
|
||||
var bottomRight = {x: width, y: height, fixed: true, index: size + 1};
|
||||
layout._nodes.push(topLeft);
|
||||
layout._nodes.push(bottomRight);
|
||||
var constraints = [];
|
||||
for (var i = 0; i < size; i++) {
|
||||
var index = layout._nodes[i].index;
|
||||
constraints.push({ axis: 'x', type: 'separation', left: topLeft.index, right: index, gap: gap });
|
||||
constraints.push({ axis: 'y', type: 'separation', left: topLeft.index, right: index, gap: gap });
|
||||
constraints.push({ axis: 'x', type: 'separation', left: index, right: bottomRight.index, gap: gap });
|
||||
constraints.push({ axis: 'y', type: 'separation', left: index, right: bottomRight.index, gap: gap });
|
||||
}
|
||||
return constraints;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.graphToLayout = function(graph, movableVertices)
|
||||
/**
|
||||
* Returns a WebCola layout set up for the given Draw.io graph
|
||||
* In WebCola's TypeScript source: vertex cell -> InputNode
|
||||
* edge cell -> Link
|
||||
* parent/child -> Group
|
||||
* @param graph Draw.io graph object
|
||||
* @param fixedVertices Vertices that shouldn't be moved (dictionary with {id: True} pairs, id is vertex id)
|
||||
* optional, if undefined all vertices are considered movable
|
||||
* @returns list of WebCola nodes, list of WebCola links, and a dictionary from Draw.io cell ID to WebCola node ID
|
||||
* returned as a dictionary: {nodes: ..., links: ..., cellToNode: ...}
|
||||
*/
|
||||
{
|
||||
var activeMaps = this.findActiveVertices(graph); // list of all active vertices, i.e. with no collapsed parents
|
||||
var activeVertices = activeMaps.activeVertices; // inactive vertex to its nearest active parent map
|
||||
var inactiveToActiveMap = activeMaps.inactiveToActiveMap;
|
||||
var cells = graph.getModel().cells;
|
||||
var view = graph.getView();
|
||||
var nodeCells = {};
|
||||
var linkCells = {};
|
||||
var cellIds = {};
|
||||
var edgeIds = {};
|
||||
var colaId = 0;
|
||||
var nodes = [];
|
||||
var links = [];
|
||||
// process nodes first
|
||||
for (var id in cells)
|
||||
{
|
||||
var cell = cells[id];
|
||||
var state = view.getState(cell);
|
||||
var bounds = view.getBoundingBox(state, true);
|
||||
var isFirst = true;
|
||||
// if (cell.isVertex() && this.isLeafOrCollapsed(cell)) {
|
||||
// only active vertices should be considered (i.e. not hidden by a collapsed or layouted vertex)
|
||||
// if (cell.isVertex() && activeVertices[cell.id])
|
||||
if (cell.isVertex() && this.isLeafOrCollapsed(cell) && activeVertices[cell.id])
|
||||
{
|
||||
var node = {};
|
||||
// node.x = bounds.getCenterX();
|
||||
// node.y = bounds.getCenterY();
|
||||
node.width = bounds.width;
|
||||
node.height = bounds.height;
|
||||
node.index = colaId;
|
||||
node.name = cell.value;
|
||||
node.fixed = false;
|
||||
if (typeof movableVertices !== 'undefined' && !(id in movableVertices))
|
||||
{
|
||||
node.fixed = true;
|
||||
}
|
||||
nodes.push(node);
|
||||
cellIds[id] = colaId;
|
||||
nodeCells[colaId] = cell;
|
||||
colaId++;
|
||||
}
|
||||
}
|
||||
// now edges can be processed as well
|
||||
for (var id in cells)
|
||||
{
|
||||
var cell = cells[id];
|
||||
var state = view.getState(cell);
|
||||
if (cell.isEdge())
|
||||
{
|
||||
// attach edges to lowest active vertex corresponding to each of their terminals
|
||||
var terminal_id1 = inactiveToActiveMap[cell.source.id];
|
||||
var terminal_id2 = inactiveToActiveMap[cell.target.id];
|
||||
if (terminal_id1 == terminal_id2)
|
||||
{
|
||||
// both terminals are under the same active parent, no need to make an invisible edge
|
||||
continue;
|
||||
}
|
||||
// if either of terminals are groups, we need to insert complete graph between nodes within these groups
|
||||
var terminal1 = cells[terminal_id1];
|
||||
var terminal2 = cells[terminal_id2];
|
||||
var addedLinks = [];
|
||||
if (this.isGroup(terminal1) || this.isGroup(terminal2))
|
||||
{
|
||||
addedLinks = this.addGroupConstraintLinks(terminal1, terminal2, activeVertices, inactiveToActiveMap, cellIds);
|
||||
}
|
||||
else
|
||||
{
|
||||
// link = {}
|
||||
// link.source = cellIds[cell.source.id];
|
||||
// link.target = cellIds[cell.target.id];
|
||||
var link = this.createLink(terminal_id1, terminal_id2, cellIds);
|
||||
addedLinks.push(link);
|
||||
}
|
||||
for (var i = 0; i < addedLinks.length; i++)
|
||||
{
|
||||
var link = addedLinks[i];
|
||||
links.push(link);
|
||||
edgeIds[cell] = id;
|
||||
linkCells[link] = cell;
|
||||
}
|
||||
}
|
||||
}
|
||||
links = this.getUniqueLinks(links);
|
||||
// finally, groups need to be extracted
|
||||
// mxGraph.getCellsForGroup
|
||||
// mxGraphModel.getChildCount
|
||||
// mxGraph.getBoundsForGroup
|
||||
// first, get all possible parents and their children
|
||||
var groupParents = {};
|
||||
var directParentChildren = {};
|
||||
for (var id in cells)
|
||||
{
|
||||
var cell = cells[id];
|
||||
if (!cell.isVertex() || !this.isLeafOrCollapsed(cell))
|
||||
continue;
|
||||
var parent = cell.getParent();
|
||||
if (parent.isVertex())
|
||||
{
|
||||
groupParents[parent.id] = parent;
|
||||
if (!(parent.id in directParentChildren))
|
||||
{
|
||||
directParentChildren[parent.id] = {}
|
||||
}
|
||||
directParentChildren[parent.id][id] = cell;
|
||||
}
|
||||
}
|
||||
// now go through all parents/children and build a group hierarchy for WebCola
|
||||
var preliminaryGroups = [];
|
||||
var groupId = 0;
|
||||
var groupToParent = {}
|
||||
for (var parentId in groupParents)
|
||||
{
|
||||
var parentChildren = directParentChildren[parentId];
|
||||
var groupNodes = []
|
||||
for (var childId in parentChildren)
|
||||
{
|
||||
if (activeVertices[childId])
|
||||
{
|
||||
groupNodes.push(cellIds[childId]);
|
||||
}
|
||||
}
|
||||
preliminaryGroups.push({id: groupId, parentId: parentId, nodes: parentChildren, leaves: groupNodes, groups: []});
|
||||
groupToParent[groupId] = parentId;
|
||||
groupId++;
|
||||
}
|
||||
// here scan newly formed groups if their parent is a child of any of the nodes in any of the groups
|
||||
for (var i = 0; i < preliminaryGroups.length; i++)
|
||||
{
|
||||
var parentGroup = preliminaryGroups[i];
|
||||
var parentId = parentGroup.parentId;
|
||||
for (var j = 0; j < preliminaryGroups.length; j++)
|
||||
{
|
||||
if (i == j)
|
||||
continue;
|
||||
var groupParentId = cells[preliminaryGroups[j].parentId].getParent().id;
|
||||
if (parentId == groupParentId)
|
||||
parentGroup.groups.push(j);
|
||||
}
|
||||
}
|
||||
// finalize groups
|
||||
var groups = [];
|
||||
for (var i = 0; i < preliminaryGroups.length; i++)
|
||||
{
|
||||
var group = preliminaryGroups[i];
|
||||
var graphGroup = {};
|
||||
if (group.leaves.length > 0)
|
||||
{
|
||||
graphGroup["leaves"] = group.leaves;
|
||||
}
|
||||
if (group.groups.length > 0)
|
||||
{
|
||||
graphGroup["groups"] = group.groups;
|
||||
}
|
||||
if (graphGroup.hasOwnProperty("leaves") || graphGroup.hasOwnProperty("groups"))
|
||||
{
|
||||
groups.push(graphGroup);
|
||||
}
|
||||
}
|
||||
|
||||
return {nodes: nodes, links: links, groups: groups, cellToNode: cellIds};
|
||||
};
|
||||
|
||||
mxWebColaAdaptor.prototype.createLink = function(sourceId, targetId, cellIds)
|
||||
{
|
||||
var link = {};
|
||||
link.source = cellIds[sourceId];
|
||||
link.target = cellIds[targetId];
|
||||
link.weight = 0.9;
|
||||
link.length = 100; // TODO: replace with Graph.prototype.defaultEdgeLength; once integrated in draw.io
|
||||
return link;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.isLeafOrCollapsed = function(cell)
|
||||
/**
|
||||
* Returns true if a cell is either a leaf or a collapsed group
|
||||
* @param cell cell to investigate
|
||||
* @returns true if a cell is either a leaf or a collapsed group, false otherwise
|
||||
*/
|
||||
{
|
||||
if (cell.isCollapsed() ||
|
||||
cell.children == null || cell.children.length == 0 ||
|
||||
typeof this.graph.getCellStyle(cell)['childLayout'] != 'undefined')
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.findActiveVertices = function(graph)
|
||||
/**
|
||||
* Scans all groups and finds active vertices, as well as an inactive-vertex-to-active-parent map
|
||||
* @param graph input graph
|
||||
*/
|
||||
{
|
||||
var inactiveToActiveMap = {};
|
||||
var activeVertices = {};
|
||||
var root = graph.getModel().root;
|
||||
var cellsToExplore = [{vertex: root, isActive: true, activeParent: root}]
|
||||
while (cellsToExplore.length > 0)
|
||||
{
|
||||
var currentCellInfo = cellsToExplore.shift();
|
||||
var cell = currentCellInfo.vertex;
|
||||
if (cell.isEdge())
|
||||
{
|
||||
// cut at edge group, those are ignored
|
||||
continue;
|
||||
}
|
||||
var isActive = currentCellInfo.isActive;
|
||||
var activeParent = currentCellInfo.activeParent;
|
||||
if (cell.isVertex())
|
||||
{
|
||||
if (isActive)
|
||||
{
|
||||
activeVertices[cell.id] = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
activeVertices[cell.id] = false;
|
||||
}
|
||||
}
|
||||
// prepare children
|
||||
// child can be active only if any of its parents is not collapsed
|
||||
var isActive = isActive && !this.isLeafOrCollapsed(cell);
|
||||
var children = cell.children;
|
||||
if (children != null && children.length > 0)
|
||||
{
|
||||
for (var i = 0; i < children.length; i++)
|
||||
{
|
||||
var child = children[i];
|
||||
var childActiveParent = isActive? child: activeParent;
|
||||
cellsToExplore.push({vertex: child, isActive: isActive, activeParent: childActiveParent});
|
||||
if (child.isVertex())
|
||||
{
|
||||
inactiveToActiveMap[child.id] = childActiveParent.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {activeVertices: activeVertices, inactiveToActiveMap: inactiveToActiveMap};
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.getActiveVerticesInGroup = function(groupCell, activeVertices, includeCollapsedGroups)
|
||||
/**
|
||||
* Scans all children in group and returns all active vertices inside group
|
||||
* This method is for creating redundant edges between members of groups to simulate group edges in WebCola
|
||||
* See https://github.com/tgdwyer/WebCola/issues/38
|
||||
* @param groupCell group cell
|
||||
*/
|
||||
{
|
||||
var activeChildren = [];
|
||||
if (includeCollapsedGroups && this.isLeafOrCollapsed(groupCell))
|
||||
{
|
||||
activeChildren.push(groupCell);
|
||||
}
|
||||
var cellsToExplore = [groupCell];
|
||||
while (cellsToExplore.length > 0)
|
||||
{
|
||||
var cell = cellsToExplore.shift();
|
||||
if (!cell.isVertex() || !activeVertices[cell])
|
||||
{
|
||||
// cut at edge group, those are ignored
|
||||
continue;
|
||||
}
|
||||
if (this.isLeafOrCollapsed(cell))
|
||||
{
|
||||
activeChildren.push(cell);
|
||||
}
|
||||
else
|
||||
{
|
||||
var children = cell.children;
|
||||
if (children == null || children.length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
cellsToExplore = cellsToExplore.concat(children);
|
||||
}
|
||||
}
|
||||
return activeChildren;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.getAllVerticesInGroup = function(groupCell, includeCollapsedGroups)
|
||||
/**
|
||||
* Scans all children in group and returns all active vertices inside group
|
||||
* This method is for creating redundant edges between members of groups to simulate group edges in WebCola
|
||||
* See https://github.com/tgdwyer/WebCola/issues/38
|
||||
* @param groupCell group cell
|
||||
*/
|
||||
{
|
||||
var result = [];
|
||||
if (includeCollapsedGroups && this.isLeafOrCollapsed(groupCell))
|
||||
{
|
||||
result.push(groupCell);
|
||||
}
|
||||
var cellsToExplore = [groupCell];
|
||||
while (cellsToExplore.length > 0)
|
||||
{
|
||||
var cell = cellsToExplore.shift();
|
||||
if (!cell.isVertex())
|
||||
{
|
||||
// cut at edge group, those are ignored
|
||||
continue;
|
||||
}
|
||||
if (this.isLeafOrCollapsed(cell))
|
||||
{
|
||||
result.push(cell);
|
||||
}
|
||||
else
|
||||
{
|
||||
var children = cell.children;
|
||||
if (children == null || children.length == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
cellsToExplore = cellsToExplore.concat(children);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.hasVertexChildren = function(cell)
|
||||
/**
|
||||
* Returns true if a (group) cell has vertex children in its subtree
|
||||
* @param cell (group) cell
|
||||
* @returns true if if a (group) cell has vertex children in its subtree, false otherwise
|
||||
*/
|
||||
{
|
||||
if (cell.children == null || cell.children.length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var toBeExamined = []
|
||||
toBeExamined = toBeExamined.concat(cell.children);
|
||||
while (toBeExamined.length > 0)
|
||||
{
|
||||
var cell = toBeExamined.shift();
|
||||
if (cell.isVertex())
|
||||
return true;
|
||||
if (cell.children != null && cell.children.length > 0)
|
||||
{
|
||||
toBeExamined = toBeExamined.concat(cell.children);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.isInCollapsedTree = function(cell)
|
||||
{
|
||||
// scan the material path for collapsed group node
|
||||
while (cell != null)
|
||||
{
|
||||
cell = cell.getParent();
|
||||
if (cell != null && cell.isCollapsed())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.isGroup = function(cell)
|
||||
/**
|
||||
* Returns true if cell is a group (has children)
|
||||
* @param cell cell
|
||||
* @returns true if cell is a group (has children); false otherwise
|
||||
*/
|
||||
{
|
||||
return cell.children != null && cell.children.length > 0;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.addGroupConstraintLinks = function(groupA, groupB, activeVertices, inactiveToActiveMap, cellIds)
|
||||
/**
|
||||
* Adds edges between vertex and group or two groups. Each vertex child of a group must be connected to the vertex/
|
||||
* group, as this way WebCola simulates edges on the group level (as groups don't exist as vertices in WebCola)
|
||||
* @param rootCell root cell
|
||||
*/
|
||||
{
|
||||
var result = []
|
||||
// var childrenA = this.getActiveVerticesInGroup(groupA, activeVertices, false);
|
||||
// var childrenB = this.getActiveVerticesInGroup(groupB, activeVertices, false);
|
||||
var childrenA = [groupA];
|
||||
var childrenB = [groupB];
|
||||
if (!groupA.isCollapsed())
|
||||
{
|
||||
childrenA = this.getAllVerticesInGroup(groupA, activeVertices, false);
|
||||
}
|
||||
if (!groupB.isCollapsed())
|
||||
{
|
||||
childrenB = this.getAllVerticesInGroup(groupB, activeVertices, false);
|
||||
}
|
||||
if (childrenA == null || childrenA.length == 0 || childrenB == null || childrenB.length == 0)
|
||||
return result;
|
||||
for (var i = 0; i < childrenA.length; i++)
|
||||
{
|
||||
var childA_Id = inactiveToActiveMap[childrenA[i].id];
|
||||
for (var j = 0; j < childrenB.length; j++)
|
||||
{
|
||||
var childB_Id = inactiveToActiveMap[childrenB[j].id];
|
||||
var link = this.createLink(childA_Id, childB_Id, cellIds);
|
||||
result.push(link);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
mxWebColaAdaptor.prototype.getUniqueLinks = function(links)
|
||||
/**
|
||||
* Returns an array of unique links from an array of links
|
||||
* @param links array of links containing duplicate links
|
||||
* @returns array of unique links
|
||||
*/
|
||||
{
|
||||
var result = [];
|
||||
// TODO: this part is inefficient - O(n^2); Theta(n) should be possible with hashmap
|
||||
for (var i = 0; i < links.length; i++)
|
||||
{
|
||||
var link = links[i];
|
||||
var shouldBeAdded = true;
|
||||
for (var j = 0; j < result.length; j++)
|
||||
{
|
||||
var existingLink = result[j];
|
||||
if (link.source == existingLink.source && link.target == existingLink.target)
|
||||
{
|
||||
shouldBeAdded = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (shouldBeAdded)
|
||||
{
|
||||
result.push(link);
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
var doRendering = void 0;
|
||||
|
||||
if ((typeof window === "undefined" ? "undefined" : typeof(window)) !== ( true ? "undefined" : typeof(undefined)))
|
||||
{
|
||||
doRendering = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.msRequestAnimationFrame;
|
||||
}
|
||||
else
|
||||
{
|
||||
// if not available, all you get is immediate calls
|
||||
function doRendering(callback)
|
||||
{
|
||||
callback();
|
||||
};
|
||||
}
|
303
src/main/webapp/plugins/webcola/mxWebColaLayout.js
Normal file
303
src/main/webapp/plugins/webcola/mxWebColaLayout.js
Normal file
|
@ -0,0 +1,303 @@
|
|||
/**
|
||||
* Copyright (c) 2006-2018, JGraph Ltd
|
||||
* Copyright (c) 2006-2018, Gaudenz Alder
|
||||
*/
|
||||
/**
|
||||
* Class: mxWebColaLayout
|
||||
*
|
||||
* Extends <mxGraphLayout> to implement a WebCola-based layout.
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* (code)
|
||||
* var layout = new mxWebColaLayout(graph);
|
||||
* layout.execute(graph.getDefaultParent());
|
||||
* (end)
|
||||
*
|
||||
* Constructor: mxWebColaLayout
|
||||
*
|
||||
* Constructs a new WebCola-based layout for the graph.
|
||||
*
|
||||
* Arguments:
|
||||
*
|
||||
* graph - <mxGraph> that contains the cells.
|
||||
*
|
||||
**/
|
||||
function mxWebColaLayout(graph, layoutType)
|
||||
/**
|
||||
* Constructs a WebCola-based layout
|
||||
* @param graph <mxGraph> that contains the cells.
|
||||
* @param layoutType Type of WebCola layout
|
||||
*/
|
||||
{
|
||||
mxGraphLayout.call(this, graph);
|
||||
this.layoutType = layoutType;
|
||||
};
|
||||
|
||||
mxWebColaLayout.prototype = new mxGraphLayout();
|
||||
mxWebColaLayout.prototype.constructor = mxWebColaLayout;
|
||||
|
||||
mxWebColaLayout.prototype.layoutType = null;
|
||||
|
||||
mxWebColaLayout.prototype.execute = function(parent)
|
||||
/**
|
||||
* Runs re-layouting of the portion of a graph from a given starting cell
|
||||
* @param parent starting cell
|
||||
*/
|
||||
{
|
||||
var movableVertices = this.getReachableVertices(parent);
|
||||
this.layout = new mxWebColaAdaptor(this.graph, [600, 600], movableVertices);
|
||||
var self = this;
|
||||
var update = function () {
|
||||
console.log("mxColaLayout: update");
|
||||
self.updateGraph();
|
||||
};
|
||||
this.layout.updatePositions = update;
|
||||
this.resetGraph(this.graph);
|
||||
var finalLayout = this.computePositions(this.layout);
|
||||
};
|
||||
|
||||
mxWebColaLayout.prototype.getReachableVertices = function(parent)
|
||||
/***
|
||||
* Finds all vertices reachable from a given parent
|
||||
* @param parent starting cell of a search
|
||||
* @returns dictionary of vertice IDs that are reachable in the form of {id: True}
|
||||
* if undefined is returned, it means parent was not provided and it should be interpreted as all vertices
|
||||
* are reachable
|
||||
*/
|
||||
{
|
||||
if (parent == undefined)
|
||||
return undefined;
|
||||
// first, get all incidental edges in a sub-tree (or a connected component if with loops)
|
||||
var edges = this.graph.getEdges(parent, null, true, true, true, true);
|
||||
// now all vertices that are reachable are subject to change; unreachable should be fixed
|
||||
var reachableVertices = void(0);
|
||||
if (edges.length != 0)
|
||||
{
|
||||
var reachableVertices = {};
|
||||
for (var i = 0; i < edges.length; i++)
|
||||
{
|
||||
var edge = edges[i];
|
||||
reachableVertices[edge.source.id] = true;
|
||||
reachableVertices[edge.target.id] = true;
|
||||
}
|
||||
}
|
||||
// vertices connected by returned edges must be allowed to move, rest must be fixed in place
|
||||
return reachableVertices;
|
||||
}
|
||||
|
||||
mxWebColaLayout.prototype.computePositions = function()
|
||||
/**
|
||||
* Executes layout to compute positions
|
||||
*/
|
||||
{
|
||||
return this.layout.run();
|
||||
}
|
||||
|
||||
mxWebColaLayout.prototype.resetGraph = function(graph)
|
||||
/**
|
||||
* Resets initial vertex positions
|
||||
*/
|
||||
{
|
||||
var model = graph.getModel();
|
||||
var cells = model.cells;
|
||||
var view = graph.getView();
|
||||
for (var id in cells)
|
||||
{
|
||||
var cell = cells[id];
|
||||
var state = view.getState(cell);
|
||||
var bounds = view.getBoundingBox(state, true);
|
||||
var isFirst = true;
|
||||
if (cell.isVertex()) {
|
||||
var geometry = model.getGeometry(cell);
|
||||
if (geometry != null && typeof geometry != "undefined")
|
||||
{
|
||||
geometry = geometry.clone();
|
||||
geometry.offset = null;
|
||||
model.setGeometry(cell, geometry);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mxWebColaLayout.prototype.getGroupBounds = function(model, groupCell)
|
||||
/**
|
||||
* Computes bounds of a group as boundary encompassing all children of a group
|
||||
* @param model graph model
|
||||
* @param groupCell starting group
|
||||
* @returns boundaries of all children inside a group
|
||||
*/
|
||||
{
|
||||
var minX = 1000000;
|
||||
var minY = 1000000;
|
||||
var maxX = -1000000;
|
||||
var maxY = -1000000;
|
||||
if (groupCell.children == null || groupCell.children.length == 0)
|
||||
return null;
|
||||
var cellsToVisit = [];
|
||||
cellsToVisit = cellsToVisit.concat(groupCell.children);
|
||||
while (cellsToVisit.length > 0)
|
||||
{
|
||||
var child = cellsToVisit.shift();
|
||||
if (child.isVertex())
|
||||
{
|
||||
if (this.layout.isLeafOrCollapsed(child))
|
||||
{
|
||||
var geometry = model.getGeometry(child);
|
||||
if (geometry != null && typeof geometry != "undefined")
|
||||
{
|
||||
if (geometry.x < minX)
|
||||
{
|
||||
minX = geometry.x;
|
||||
}
|
||||
if (geometry.y < minY)
|
||||
{
|
||||
minY = geometry.y;
|
||||
}
|
||||
if (geometry.x + geometry.width > maxX)
|
||||
{
|
||||
maxX = geometry.x + geometry.width;
|
||||
}
|
||||
if (geometry.y + geometry.height > maxY)
|
||||
{
|
||||
maxY = geometry.y + geometry.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellsToVisit = cellsToVisit.concat(child.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
var bounds = model.getGeometry(groupCell).clone();
|
||||
bounds.x = minX;
|
||||
bounds.y = minY;
|
||||
bounds.width = maxX - minX;
|
||||
bounds.height = maxY - minY;
|
||||
return bounds;
|
||||
}
|
||||
|
||||
mxWebColaLayout.prototype.adjustChildOffsets = function(model, groupCell)
|
||||
/**
|
||||
* Adjusts offset of child vertices to be relative to parent groups
|
||||
* @param model graph model
|
||||
* @param groupCell starting group cell
|
||||
*/
|
||||
{
|
||||
if (groupCell.children == null || groupCell.children.length == 0)
|
||||
return;
|
||||
var groupBounds = model.getGeometry(groupCell);
|
||||
var offsetX = groupBounds.x;
|
||||
var offsetY = groupBounds.y;
|
||||
var cellsToVisit = [];
|
||||
cellsToVisit = cellsToVisit.concat(groupCell.children);
|
||||
while (cellsToVisit.length > 0)
|
||||
{
|
||||
var child = cellsToVisit.shift();
|
||||
if (child.isVertex())
|
||||
{
|
||||
if (this.layout.isLeafOrCollapsed(child))
|
||||
{
|
||||
var geometry = model.getGeometry(child);
|
||||
if (geometry != null && typeof geometry != "undefined")
|
||||
{
|
||||
geometry = geometry.clone();
|
||||
geometry.x = geometry.x - offsetX;
|
||||
geometry.y = geometry.y - offsetY;
|
||||
model.setGeometry(child, geometry);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cellsToVisit = cellsToVisit.concat(child.children);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
mxWebColaLayout.prototype.updateGraph = function()
|
||||
/**
|
||||
* Updates graph based on layout's vertex/group positions
|
||||
*/
|
||||
{
|
||||
console.log("updating graph");
|
||||
// find X, Y ranges first
|
||||
var minX = 1000000;
|
||||
var maxX = -1000000;
|
||||
var minY = 1000000;
|
||||
var maxY = -1000000;
|
||||
|
||||
for (var i = 0; i < this.layout.adaptor._nodes.length; i++)
|
||||
{
|
||||
var node = this.layout.adaptor._nodes[i];
|
||||
var x = node.x;
|
||||
var y = node.y;
|
||||
minX = Math.min(minX, x);
|
||||
minY = Math.min(minY, y);
|
||||
maxX = Math.max(maxX, x);
|
||||
maxY = Math.max(maxY, y);
|
||||
}
|
||||
|
||||
var spanX = maxX - minX;
|
||||
var spanY = maxY - minY;
|
||||
|
||||
var model = this.graph.getModel();
|
||||
model.beginUpdate();
|
||||
try
|
||||
{
|
||||
var cells = model.cells;
|
||||
var view = this.graph.getView();
|
||||
// scan leaves and edges
|
||||
for (var id in cells)
|
||||
{
|
||||
var cell = cells[id];
|
||||
var state = view.getState(cell);
|
||||
var bounds = view.getBoundingBox(state, true);
|
||||
if (cell.isVertex() && this.layout.isLeafOrCollapsed(cell))
|
||||
{
|
||||
var nodeId = this.layout.cellToNode[id];
|
||||
if (typeof nodeId == "undefined")
|
||||
continue;
|
||||
var node = this.layout.adaptor._nodes[nodeId];
|
||||
var geometry = model.getGeometry(cell);
|
||||
if (geometry != null && typeof geometry != "undefined")
|
||||
{
|
||||
geometry = geometry.clone();
|
||||
geometry.x = node.x - minX;
|
||||
geometry.y = node.y - minY;
|
||||
model.setGeometry(cell, geometry);
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("vertex cell id:" + id + " has no geometry!");
|
||||
}
|
||||
}
|
||||
else if (cell.isEdge())
|
||||
{
|
||||
this.graph.resetEdge(cell);
|
||||
}
|
||||
}
|
||||
// scan groups
|
||||
for (var id in cells)
|
||||
{
|
||||
var cell = cells[id];
|
||||
var state = view.getState(cell);
|
||||
var bounds = view.getBoundingBox(state, true);
|
||||
if (cell.isVertex() && !this.layout.isLeafOrCollapsed(cell))
|
||||
{
|
||||
var bounds = this.getGroupBounds(model, cell);
|
||||
if (bounds != null && typeof bounds != "undefined")
|
||||
{
|
||||
model.setGeometry(cell, bounds);
|
||||
this.adjustChildOffsets(model, cell);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
model.endUpdate();
|
||||
}
|
||||
|
||||
}
|
31
src/main/webapp/plugins/webcola/webcola.js
Normal file
31
src/main/webapp/plugins/webcola/webcola.js
Normal file
|
@ -0,0 +1,31 @@
|
|||
/**
|
||||
* WebCola layout plugin.
|
||||
*/
|
||||
Draw.loadPlugin(function(ui)
|
||||
{
|
||||
mxscript("js/diagramly/plugins/webcola/cola.min.js");
|
||||
mxscript("js/diagramly/plugins/webcola/mxWebColaAdaptor.js");
|
||||
mxscript("js/diagramly/plugins/webcola/mxWebColaLayout.js");
|
||||
|
||||
// Adds resource for action
|
||||
mxResources.parse('webColaLayout=WebCola Layout...');
|
||||
|
||||
// Adds action
|
||||
ui.actions.addAction('Apply WebCola layout', function()
|
||||
{
|
||||
var graph = ui.editor.graph;
|
||||
var layout = mxWebColaLayout(graph);
|
||||
var parent = graph.getDefaultParent();
|
||||
layout.execute(parent);
|
||||
});
|
||||
|
||||
var menu = ui.menus.get('extras');
|
||||
var oldFunct = menu.funct;
|
||||
|
||||
menu.funct = function(menu, parent)
|
||||
{
|
||||
oldFunct.apply(this, arguments);
|
||||
|
||||
ui.menus.addMenuItems(menu, ['-', 'webColaLayout'], parent);
|
||||
};
|
||||
});
|
Loading…
Reference in a new issue