diff --git a/ChangeLog b/ChangeLog index 6024126a..0c359874 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +09-JAN-2019: 12.5.1 + +- Fixes label offsets in viewer +- Uses mxGraph 4.1.0 pre 2 + 07-JAN-2019: 12.5.0 - Enables reflow in HTML output diff --git a/VERSION b/VERSION index ba247e62..921241d8 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -12.5.0 \ No newline at end of file +12.5.1 \ No newline at end of file diff --git a/etc/mxgraph/mxClient.js b/etc/mxgraph/mxClient.js index cd093ba4..8d7d07dd 100644 --- a/etc/mxgraph/mxClient.js +++ b/etc/mxgraph/mxClient.js @@ -214,7 +214,7 @@ mxUndoManager.prototype.undo=function(){for(;0this.indexOfNextAdd)for(var a=this.history.splice(this.indexOfNextAdd,this.history.length-this.indexOfNextAdd),b=0;b/g,"
").replace(/
/g,"
").replace(/(]+)>/gm,"$1 />")}return a}; mxSvgCanvas2D.prototype.createDiv=function(a){mxUtils.isNode(a)||(a="
"+this.convertHtml(a)+"
");if(mxClient.IS_IE||mxClient.IS_IE11||!document.createElementNS){mxUtils.isNode(a)&&(a="
"+mxUtils.getXml(a)+"
");a='
'+a+"
";if("ActiveXObject"in window){var b=mxUtils.createMsXmlDocument();b.loadXML(a);return b.documentElement}return mxUtils.parseXml(a).documentElement}b=document.createElementNS("http://www.w3.org/1999/xhtml", "div");if(mxUtils.isNode(a)){var c=document.createElement("div"),d=c.cloneNode(!1);this.root.ownerDocument!=document?c.appendChild(a.cloneNode(!0)):c.appendChild(a);d.appendChild(c);b.appendChild(d)}else b.innerHTML=a;return b};mxSvgCanvas2D.prototype.updateText=function(a,b,c,d,e,f,g,k,l,m,n){null!=n&&null!=n.firstChild&&null!=n.firstChild.firstChild&&this.updateTextNodes(a,b,c,d,e,f,g,k,l,m,n.firstChild)}; -mxSvgCanvas2D.prototype.addForeignObject=function(a,b,c,d,e,f,g,k,l,m,n,p,q,r,t){q=this.createElement("foreignObject");var u=this.createElement("g");r.ownerDocument!=document&&(r=mxUtils.importNodeImplementation(q.ownerDocument,r,!0));q.appendChild(r);u.appendChild(q);this.updateTextNodes(a,b,c,d,f,g,k,m,n,p,u);this.root.ownerDocument!=document&&(a=this.createAlternateContent(q,a,b,c,d,e,f,g,k,l,m,n,p),null!=a&&(q.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility"), -b=this.createElement("switch"),b.appendChild(q),b.appendChild(a),u.appendChild(b)));t.appendChild(u)}; -mxSvgCanvas2D.prototype.updateTextNodes=function(a,b,c,d,e,f,g,k,l,m,n){a+=this.state.dx;b+=this.state.dy;var p=this.state.scale,q=n.firstChild,r=q.firstChild,t=r.firstChild,u=t.firstChild,x=this.getTextCss();q.setAttribute("width",Math.ceil(1/Math.min(1,p)*100)+"%");q.setAttribute("height",Math.ceil(1/Math.min(1,p)*100)+"%");q.setAttribute("style","overflow: visible;");q.setAttribute("pointer-events","none");mxSvgCanvas2D.createCss(c,d,e,f,g,k,l,null!=this.state.fontBackgroundColor?this.state.fontBackgroundColor: -null,null!=this.state.fontBorderColor?this.state.fontBorderColor:null,"display: flex; align-items: unsafe "+(f==mxConstants.ALIGN_TOP?"flex-start":f==mxConstants.ALIGN_BOTTOM?"flex-end":"center")+"; justify-content: unsafe "+(e==mxConstants.ALIGN_LEFT?"flex-start":e==mxConstants.ALIGN_RIGHT?"flex-end":"center")+"; ",x,p,mxUtils.bind(this,function(c,d,e,f,g){r.setAttribute("style",e+"padding-left: "+Math.round(a+c)+"px; padding-top: "+Math.round(b+d)+"px;");t.setAttribute("style",f);u.setAttribute("style", -g);c=(this.rotateHtml?this.state.rotation:0)+(null!=m?m:0);c=(0!=this.foOffset?"translate("+this.foOffset+" "+this.foOffset+") ":"")+(1!=p?"scale("+p+") ":"")+(0!=c?"rotate("+c+" "+a+" "+b+")":"");""!=c?n.setAttribute("transform",c):n.removeAttribute("transform");1!=this.state.alpha?n.setAttribute("opacity",this.state.alpha):n.removeAttribute("opacity")}))}; +mxSvgCanvas2D.prototype.addForeignObject=function(a,b,c,d,e,f,g,k,l,m,n,p,q,r,t){q=this.createElement("g");var u=this.createElement("foreignObject");u.setAttribute("style","overflow: visible; text-align: left;");u.setAttribute("pointer-events","none");r.ownerDocument!=document&&(r=mxUtils.importNodeImplementation(u.ownerDocument,r,!0));u.appendChild(r);q.appendChild(u);this.updateTextNodes(a,b,c,d,f,g,k,m,n,p,q);this.root.ownerDocument!=document&&(a=this.createAlternateContent(u,a,b,c,d,e,f,g,k,l, +m,n,p),null!=a&&(u.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility"),b=this.createElement("switch"),b.appendChild(u),b.appendChild(a),q.appendChild(b)));t.appendChild(q)}; +mxSvgCanvas2D.prototype.updateTextNodes=function(a,b,c,d,e,f,g,k,l,m,n){var p=this.state.scale;mxSvgCanvas2D.createCss(c,d,e,f,g,k,l,null!=this.state.fontBackgroundColor?this.state.fontBackgroundColor:null,null!=this.state.fontBorderColor?this.state.fontBorderColor:null,"display: flex; align-items: unsafe "+(f==mxConstants.ALIGN_TOP?"flex-start":f==mxConstants.ALIGN_BOTTOM?"flex-end":"center")+"; justify-content: unsafe "+(e==mxConstants.ALIGN_LEFT?"flex-start":e==mxConstants.ALIGN_RIGHT?"flex-end": +"center")+"; ",this.getTextCss(),p,mxUtils.bind(this,function(c,d,e,f,g){a+=this.state.dx;b+=this.state.dy;var k=n.firstChild,l=k.firstChild,q=l.firstChild,r=(this.rotateHtml?this.state.rotation:0)+(null!=m?m:0),t=(0!=this.foOffset?"translate("+this.foOffset+" "+this.foOffset+")":"")+(1!=p?"scale("+p+")":"");q.firstChild.setAttribute("style",g);q.setAttribute("style",f);k.setAttribute("width",Math.ceil(1/Math.min(1,p)*100)+"%");k.setAttribute("height",Math.ceil(1/Math.min(1,p)*100)+"%");d=Math.round(b+ +d);0>d?k.setAttribute("y",d):(k.removeAttribute("y"),e+="padding-top: "+d+"px; ");l.setAttribute("style",e+"margin-left: "+Math.round(a+c)+"px;");t+=0!=r?"rotate("+r+" "+a+" "+b+")":"";""!=t?n.setAttribute("transform",t):n.removeAttribute("transform");1!=this.state.alpha?n.setAttribute("opacity",this.state.alpha):n.removeAttribute("opacity")}))}; mxSvgCanvas2D.createCss=function(a,b,c,d,e,f,g,k,l,m,n,p,q){p="box-sizing: border-box; text-align: "+(c==mxConstants.ALIGN_LEFT?"left":c==mxConstants.ALIGN_RIGHT?"right":"center")+"; ";var r=mxUtils.getAlignmentAsPoint(c,d);c="overflow: hidden; ";d="width: 1px; ";var t="height: 1px; ",u=r.x*a,r=r.y*b;g?(d="width: "+Math.round(a)+"px; ",p+="max-height: "+Math.round(b)+"px; ",r=0):"fill"==f?(d="width: "+Math.round(a)+"px; ",t="height: "+Math.round(b)+"px; ",n+="width: 100%; height: 100%; ",p+=d+t): "width"==f?(d="width: "+Math.round(a)+"px; ",n+="width: 100%; ",p+=d,r=0,0this.indexOfNextAdd)for(var a=this.history.splice(this.indexOfNextAdd,this.history.length-this.indexOfNextAdd),b=0;b/g,"
").replace(/
/g,"
").replace(/(]+)>/gm,"$1 />")}return a}; mxSvgCanvas2D.prototype.createDiv=function(a){mxUtils.isNode(a)||(a="
"+this.convertHtml(a)+"
");if(mxClient.IS_IE||mxClient.IS_IE11||!document.createElementNS){mxUtils.isNode(a)&&(a="
"+mxUtils.getXml(a)+"
");a='
'+a+"
";if("ActiveXObject"in window){var b=mxUtils.createMsXmlDocument();b.loadXML(a);return b.documentElement}return mxUtils.parseXml(a).documentElement}b=document.createElementNS("http://www.w3.org/1999/xhtml", "div");if(mxUtils.isNode(a)){var c=document.createElement("div"),d=c.cloneNode(!1);this.root.ownerDocument!=document?c.appendChild(a.cloneNode(!0)):c.appendChild(a);d.appendChild(c);b.appendChild(d)}else b.innerHTML=a;return b};mxSvgCanvas2D.prototype.updateText=function(a,b,c,d,e,f,g,k,l,m,n){null!=n&&null!=n.firstChild&&null!=n.firstChild.firstChild&&this.updateTextNodes(a,b,c,d,e,f,g,k,l,m,n.firstChild)}; -mxSvgCanvas2D.prototype.addForeignObject=function(a,b,c,d,e,f,g,k,l,m,n,p,q,r,t){q=this.createElement("foreignObject");var u=this.createElement("g");r.ownerDocument!=document&&(r=mxUtils.importNodeImplementation(q.ownerDocument,r,!0));q.appendChild(r);u.appendChild(q);this.updateTextNodes(a,b,c,d,f,g,k,m,n,p,u);this.root.ownerDocument!=document&&(a=this.createAlternateContent(q,a,b,c,d,e,f,g,k,l,m,n,p),null!=a&&(q.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility"), -b=this.createElement("switch"),b.appendChild(q),b.appendChild(a),u.appendChild(b)));t.appendChild(u)}; -mxSvgCanvas2D.prototype.updateTextNodes=function(a,b,c,d,e,f,g,k,l,m,n){a+=this.state.dx;b+=this.state.dy;var p=this.state.scale,q=n.firstChild,r=q.firstChild,t=r.firstChild,u=t.firstChild,x=this.getTextCss();q.setAttribute("width",Math.ceil(1/Math.min(1,p)*100)+"%");q.setAttribute("height",Math.ceil(1/Math.min(1,p)*100)+"%");q.setAttribute("style","overflow: visible;");q.setAttribute("pointer-events","none");mxSvgCanvas2D.createCss(c,d,e,f,g,k,l,null!=this.state.fontBackgroundColor?this.state.fontBackgroundColor: -null,null!=this.state.fontBorderColor?this.state.fontBorderColor:null,"display: flex; align-items: unsafe "+(f==mxConstants.ALIGN_TOP?"flex-start":f==mxConstants.ALIGN_BOTTOM?"flex-end":"center")+"; justify-content: unsafe "+(e==mxConstants.ALIGN_LEFT?"flex-start":e==mxConstants.ALIGN_RIGHT?"flex-end":"center")+"; ",x,p,mxUtils.bind(this,function(c,d,e,f,g){r.setAttribute("style",e+"padding-left: "+Math.round(a+c)+"px; padding-top: "+Math.round(b+d)+"px;");t.setAttribute("style",f);u.setAttribute("style", -g);c=(this.rotateHtml?this.state.rotation:0)+(null!=m?m:0);c=(0!=this.foOffset?"translate("+this.foOffset+" "+this.foOffset+") ":"")+(1!=p?"scale("+p+") ":"")+(0!=c?"rotate("+c+" "+a+" "+b+")":"");""!=c?n.setAttribute("transform",c):n.removeAttribute("transform");1!=this.state.alpha?n.setAttribute("opacity",this.state.alpha):n.removeAttribute("opacity")}))}; +mxSvgCanvas2D.prototype.addForeignObject=function(a,b,c,d,e,f,g,k,l,m,n,p,q,r,t){q=this.createElement("g");var u=this.createElement("foreignObject");u.setAttribute("style","overflow: visible; text-align: left;");u.setAttribute("pointer-events","none");r.ownerDocument!=document&&(r=mxUtils.importNodeImplementation(u.ownerDocument,r,!0));u.appendChild(r);q.appendChild(u);this.updateTextNodes(a,b,c,d,f,g,k,m,n,p,q);this.root.ownerDocument!=document&&(a=this.createAlternateContent(u,a,b,c,d,e,f,g,k,l, +m,n,p),null!=a&&(u.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility"),b=this.createElement("switch"),b.appendChild(u),b.appendChild(a),q.appendChild(b)));t.appendChild(q)}; +mxSvgCanvas2D.prototype.updateTextNodes=function(a,b,c,d,e,f,g,k,l,m,n){var p=this.state.scale;mxSvgCanvas2D.createCss(c,d,e,f,g,k,l,null!=this.state.fontBackgroundColor?this.state.fontBackgroundColor:null,null!=this.state.fontBorderColor?this.state.fontBorderColor:null,"display: flex; align-items: unsafe "+(f==mxConstants.ALIGN_TOP?"flex-start":f==mxConstants.ALIGN_BOTTOM?"flex-end":"center")+"; justify-content: unsafe "+(e==mxConstants.ALIGN_LEFT?"flex-start":e==mxConstants.ALIGN_RIGHT?"flex-end": +"center")+"; ",this.getTextCss(),p,mxUtils.bind(this,function(c,d,e,f,g){a+=this.state.dx;b+=this.state.dy;var k=n.firstChild,l=k.firstChild,q=l.firstChild,r=(this.rotateHtml?this.state.rotation:0)+(null!=m?m:0),t=(0!=this.foOffset?"translate("+this.foOffset+" "+this.foOffset+")":"")+(1!=p?"scale("+p+")":"");q.firstChild.setAttribute("style",g);q.setAttribute("style",f);k.setAttribute("width",Math.ceil(1/Math.min(1,p)*100)+"%");k.setAttribute("height",Math.ceil(1/Math.min(1,p)*100)+"%");d=Math.round(b+ +d);0>d?k.setAttribute("y",d):(k.removeAttribute("y"),e+="padding-top: "+d+"px; ");l.setAttribute("style",e+"margin-left: "+Math.round(a+c)+"px;");t+=0!=r?"rotate("+r+" "+a+" "+b+")":"";""!=t?n.setAttribute("transform",t):n.removeAttribute("transform");1!=this.state.alpha?n.setAttribute("opacity",this.state.alpha):n.removeAttribute("opacity")}))}; mxSvgCanvas2D.createCss=function(a,b,c,d,e,f,g,k,l,m,n,p,q){p="box-sizing: border-box; text-align: "+(c==mxConstants.ALIGN_LEFT?"left":c==mxConstants.ALIGN_RIGHT?"right":"center")+"; ";var r=mxUtils.getAlignmentAsPoint(c,d);c="overflow: hidden; ";d="width: 1px; ";var t="height: 1px; ",u=r.x*a,r=r.y*b;g?(d="width: "+Math.round(a)+"px; ",p+="max-height: "+Math.round(b)+"px; ",r=0):"fill"==f?(d="width: "+Math.round(a)+"px; ",t="height: "+Math.round(b)+"px; ",n+="width: 100%; height: 100%; ",p+=d+t): "width"==f?(d="width: "+Math.round(a)+"px; ",n+="width: 100%; ",p+=d,r=0,0
')))}catch(A){}})(); -(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,d,b){b.ui=a.ui;return d};a.afterDecode=function(a,d,b){b.previousColor=b.color;b.previousImage=b.image;b.previousFormat=b.format;null!=b.foldingEnabled&&(b.foldingEnabled=!b.foldingEnabled);null!=b.mathEnabled&&(b.mathEnabled=!b.mathEnabled);null!=b.shadowVisible&&(b.shadowVisible=!b.shadowVisible);return b};mxCodecRegistry.register(a)})();(function(){EditorUi.VERSION="12.5.0";EditorUi.compactUi="atlas"!=uiTheme;mxGraphView.prototype.defaultDarkGridColor="#6e6e6e";"dark"==uiTheme&&(mxGraphView.prototype.gridColor=mxGraphView.prototype.defaultDarkGridColor);EditorUi.enableLogging="1"!=urlParams.stealth&&/.*\.draw\.io$/.test(window.location.hostname)&&"support.draw.io"!=window.location.hostname;EditorUi.drawHost="https://www.draw.io";EditorUi.lastErrorMessage=null;EditorUi.ignoredAnonymizedChars="\n\t`~!@#$%^&*()_+{}|:\"<>?-=[];'./,\n\t"; +(function(){var a=new mxObjectCodec(new ChangePageSetup,["ui","previousColor","previousImage","previousFormat"]);a.beforeDecode=function(a,d,b){b.ui=a.ui;return d};a.afterDecode=function(a,d,b){b.previousColor=b.color;b.previousImage=b.image;b.previousFormat=b.format;null!=b.foldingEnabled&&(b.foldingEnabled=!b.foldingEnabled);null!=b.mathEnabled&&(b.mathEnabled=!b.mathEnabled);null!=b.shadowVisible&&(b.shadowVisible=!b.shadowVisible);return b};mxCodecRegistry.register(a)})();(function(){EditorUi.VERSION="12.5.1";EditorUi.compactUi="atlas"!=uiTheme;mxGraphView.prototype.defaultDarkGridColor="#6e6e6e";"dark"==uiTheme&&(mxGraphView.prototype.gridColor=mxGraphView.prototype.defaultDarkGridColor);EditorUi.enableLogging="1"!=urlParams.stealth&&/.*\.draw\.io$/.test(window.location.hostname)&&"support.draw.io"!=window.location.hostname;EditorUi.drawHost="https://www.draw.io";EditorUi.lastErrorMessage=null;EditorUi.ignoredAnonymizedChars="\n\t`~!@#$%^&*()_+{}|:\"<>?-=[];'./,\n\t"; EditorUi.templateFile=TEMPLATE_PATH+"/index.xml";EditorUi.cacheUrl="1"==urlParams.dev?"/cache":window.REALTIME_URL;null==EditorUi.cacheUrl&&"undefined"!==typeof DrawioFile&&(DrawioFile.SYNC="none");Editor.cacheTimeout=1E4;EditorUi.enablePlantUml=EditorUi.enableLogging;EditorUi.isElectronApp=null!=window&&null!=window.process&&null!=window.process.versions&&null!=window.process.versions.electron;EditorUi.scratchpadHelpLink="https://desk.draw.io/support/solutions/articles/16000042367";EditorUi.logError= function(a,b,c,d,e){if("1"==urlParams.dev)EditorUi.debug("logError",a,b,c,d,e);else if(EditorUi.enableLogging)try{if(a!=EditorUi.lastErrorMessage&&(null==a||null==b||-1==a.indexOf("Script error")&&-1==a.indexOf("extension"))&&null!=a&&0>a.indexOf("DocumentClosedError")){EditorUi.lastErrorMessage=a;var f=0<=a.indexOf("NetworkError")||0<=a.indexOf("SecurityError")||0<=a.indexOf("NS_ERROR_FAILURE")||0<=a.indexOf("out of memory")?"CONFIG":"SEVERE",l=null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL:""; e=null!=e?e:Error(a);(new Image).src=l+"/log?severity="+f+"&v="+encodeURIComponent(EditorUi.VERSION)+"&msg=clientError:"+encodeURIComponent(a)+":url:"+encodeURIComponent(window.location.href)+":lnum:"+encodeURIComponent(c)+(null!=d?":colno:"+encodeURIComponent(d):"")+(null!=e&&null!=e.stack?"&stack="+encodeURIComponent(e.stack):"")}}catch(y){}};EditorUi.logEvent=function(a){if("1"==urlParams.dev)EditorUi.debug("logEvent",a);else if(EditorUi.enableLogging)try{var b=null!=window.DRAWIO_LOG_URL?window.DRAWIO_LOG_URL: @@ -8883,8 +8883,8 @@ mxGraphView.prototype.defaultDarkGridColor),null==mxSettings.settings.autosave&& this.activityListener=mxUtils.bind(this,function(a){this.lastActivity=new Date;this.start()});mxEvent.addListener(document,mxClient.IS_POINTER?"pointermove":"mousemove",this.activityListener);mxEvent.addListener(document,"keypress",this.activityListener);mxEvent.addListener(window,"focus",this.activityListener);!mxClient.IS_POINTER&&mxClient.IS_TOUCH&&(mxEvent.addListener(document,"touchstart",this.activityListener),mxEvent.addListener(document,"touchmove",this.activityListener));this.pusherErrorListener= mxUtils.bind(this,function(a){null!=a.error&&null!=a.error.data&&4004===a.error.data.code&&EditorUi.logError("Error: Pusher Limit",null,this.file.getId())});this.connectionListener=mxUtils.bind(this,function(){this.updateOnlineState();this.updateStatus();if(this.isConnected())if(this.announced)this.fileChangedNotify();else{var a=this.file.getCurrentUser(),d={a:"join"};null!=a&&(d.name=encodeURIComponent(a.displayName),d.uid=a.id);mxUtils.post(EditorUi.cacheUrl,this.getIdParameters()+"&msg="+encodeURIComponent(this.objectToString(this.createMessage(d)))); this.file.stats.msgSent++;this.announced=!0}});this.changeListener=mxUtils.bind(this,function(a){this.file.stats.msgReceived++;this.lastActivity=new Date;if(this.enabled&&!this.file.inConflictState&&!this.file.redirectDialogShowing)try{var c=this.stringToObject(a);null!=c&&(EditorUi.debug("Sync.message",[this],c,a.length,"bytes"),c.v>DrawioFileSync.PROTOCOL?this.file.redirectToNewApp(mxUtils.bind(this,function(){})):c.v===DrawioFileSync.PROTOCOL&&null!=c.d&&this.handleMessageData(c.d))}catch(b){this.isConnected()&& -this.fileChangedNotify(),EditorUi.logError("Protocol Error "+b.message,null,"data_"+(null!=a?a.length:"null")+"_file_"+this.file.getHash()+"_client_"+this.clientId),null!=window.console&&console.log(b)}})};DrawioFileSync.PROTOCOL=6;mxUtils.extend(DrawioFileSync,mxEventSource);DrawioFileSync.prototype.maxCacheEntrySize=1E6;DrawioFileSync.prototype.enabled=!0;DrawioFileSync.prototype.updateStatusInterval=1E4;DrawioFileSync.prototype.channelId=null;DrawioFileSync.prototype.channel=null; -DrawioFileSync.prototype.catchupRetryCount=0;DrawioFileSync.prototype.maxCatchupRetries=15;DrawioFileSync.prototype.maxCacheReadyRetries=1;DrawioFileSync.prototype.cacheReadyDelay=700;DrawioFileSync.prototype.inactivityTimeoutSeconds=1800;DrawioFileSync.prototype.lastActivity=null; +this.fileChangedNotify()}})};DrawioFileSync.PROTOCOL=6;mxUtils.extend(DrawioFileSync,mxEventSource);DrawioFileSync.prototype.maxCacheEntrySize=1E6;DrawioFileSync.prototype.enabled=!0;DrawioFileSync.prototype.updateStatusInterval=1E4;DrawioFileSync.prototype.channelId=null;DrawioFileSync.prototype.channel=null;DrawioFileSync.prototype.catchupRetryCount=0;DrawioFileSync.prototype.maxCatchupRetries=15;DrawioFileSync.prototype.maxCacheReadyRetries=1;DrawioFileSync.prototype.cacheReadyDelay=700; +DrawioFileSync.prototype.inactivityTimeoutSeconds=1800;DrawioFileSync.prototype.lastActivity=null; DrawioFileSync.prototype.start=function(){null==this.channelId&&(this.channelId=this.file.getChannelId());null==this.key&&(this.key=this.file.getChannelKey());if(null==this.pusher&&null!=this.channelId&&"hidden"!=document.visibilityState){this.pusher=this.ui.getPusher();if(null!=this.pusher){try{null!=this.pusher.connection&&this.pusher.connection.bind("error",this.pusherErrorListener)}catch(a){}try{this.pusher.connect(),this.channel=this.pusher.subscribe(this.channelId),EditorUi.debug("Sync.start", [this,"v"+DrawioFileSync.PROTOCOL])}catch(a){}this.installListeners()}window.setTimeout(mxUtils.bind(this,function(){this.lastModified=this.file.getLastModifiedDate();this.lastActivity=new Date;this.resetUpdateStatusThread();this.updateOnlineState();this.updateStatus()},0))}};DrawioFileSync.prototype.isConnected=function(){return null!=this.pusher&&null!=this.pusher.connection?"connected"==this.pusher.connection.state:!1}; DrawioFileSync.prototype.updateOnlineState=function(){var a=mxUtils.bind(this,function(a){mxEvent.addListener(a,"click",mxUtils.bind(this,function(a){this.enabled=!this.enabled;this.ui.updateButtonContainer();this.resetUpdateStatusThread();this.updateOnlineState();this.updateStatus();!this.file.inConflictState&&this.enabled&&this.fileChangedNotify()}))});if("min"==uiTheme&&null!=this.ui.buttonContainer){if(null==this.collaboratorsElement){var c=document.createElement("a");c.className="geToolbarButton"; diff --git a/src/main/webapp/js/diagramly/DrawioFileSync.js b/src/main/webapp/js/diagramly/DrawioFileSync.js index 2f24c1a1..4c9b4982 100644 --- a/src/main/webapp/js/diagramly/DrawioFileSync.js +++ b/src/main/webapp/js/diagramly/DrawioFileSync.js @@ -144,16 +144,16 @@ DrawioFileSync = function(file) } // NOTE: Probably UTF16 in username for join/leave message causing this - var len = (data != null) ? data.length : 'null'; - - EditorUi.logError('Protocol Error ' + e.message, - null, 'data_' + len + '_file_' + this.file.getHash() + - '_client_' + this.clientId); - - if (window.console != null) - { - console.log(e); - } +// var len = (data != null) ? data.length : 'null'; +// +// EditorUi.logError('Protocol Error ' + e.message, +// null, 'data_' + len + '_file_' + this.file.getHash() + +// '_client_' + this.clientId); +// +// if (window.console != null) +// { +// console.log(e); +// } } } }); diff --git a/src/main/webapp/js/diagramly/Editor.js b/src/main/webapp/js/diagramly/Editor.js index 13ecffa8..0f4cbc7e 100644 --- a/src/main/webapp/js/diagramly/Editor.js +++ b/src/main/webapp/js/diagramly/Editor.js @@ -897,7 +897,7 @@ Editor.prototype.timeout = 25000; /** - * This should not be enabled if reflows are required for math rendering. + * Zoomed mathjax output is causing problems in Safari. */ Editor.prototype.useForeignObjectForMath = !mxClient.IS_SF; diff --git a/src/main/webapp/js/diagramly/mxTableLayout.js b/src/main/webapp/js/diagramly/mxTableLayout.js index 1953a173..f0dc8870 100644 --- a/src/main/webapp/js/diagramly/mxTableLayout.js +++ b/src/main/webapp/js/diagramly/mxTableLayout.js @@ -260,7 +260,7 @@ mxTableLayout.prototype.calcDims = function(parent) var cellCount = rows * cols; //if auto-add without parent-resize, then each cell size in the table depends on how many columns/rows - if (/*!this.resizeParent && */(this.autoAddCol || this.autoAddRow) && childCount > cellCount) + if (!this.resizeParent && (this.autoAddCol || this.autoAddRow) && childCount > cellCount) { var actualChildCount = 0; //get actual child count (movable and not ignored) @@ -490,6 +490,8 @@ function mxTableLayoutHandle(index, isCol, state, layoutDims) mxUtils.extend(mxTableLayoutHandle, mxHandle); mxTableLayoutHandle.prototype.color = '#00FF00'; +mxTableLayoutHandle.prototype.MIN_COL_W = 10; +mxTableLayoutHandle.prototype.MIN_ROW_H = 10; mxTableLayoutHandle.prototype.createShape = function(html) { @@ -545,46 +547,277 @@ mxTableLayoutHandle.prototype.getPosition = function(bounds) mxTableLayoutHandle.prototype.setPosition = function(bounds, pt) { this.state.style['resizeParent'] = '0'; + var anotherRedraw = []; if (this.isCol) { + if (this.origCellWidth == null) + { + this.origCellWidth = this.dims.cellWidth.slice(); + } + this.state.style['equalColumns'] = '0'; var oldColW = this.dims.cellWidth[this.index]; var newColW = oldColW + pt.x - this.x; - this.dims.cellWidth[this.index] = newColW; - if (newColW > oldColW) + if (newColW < this.MIN_COL_W) { - this.dims.cellWidth[this.index + 1] -= (newColW - oldColW); + this.dims.cellWidth[this.index] = this.MIN_COL_W; + var addedW = oldColW - this.MIN_COL_W; + newColW = Math.abs(newColW - this.MIN_COL_W); + var i = this.index - 1; + + while (i >= 0 && newColW > 0) + { + if (newColW < this.dims.cellWidth[i] - this.MIN_COL_W) + { + this.dims.cellWidth[i] -= newColW; + addedW += newColW; + newColW = 0; + } + else + { + var diff = this.dims.cellWidth[i] - this.MIN_COL_W; + newColW -= diff; + addedW += diff; + this.dims.cellWidth[i] = this.MIN_COL_W; + } + + anotherRedraw.push(i); + i--; + } + + this.dims.cellWidth[this.index + 1] += addedW; + } + else if (this.dims.cellWidth[this.index + 1] < (newColW - oldColW + this.MIN_COL_W)) + { + var addedW = this.dims.cellWidth[this.index + 1] - this.MIN_COL_W; + this.dims.cellWidth[this.index + 1] = this.MIN_COL_W; + var neededW = newColW - oldColW; + var i = this.index + 2; + + while (i < this.dims.cols && neededW > 0) + { + if (neededW < this.dims.cellWidth[i] - this.MIN_COL_W) + { + this.dims.cellWidth[i] -= neededW; + addedW += neededW; + neededW = 0; + } + else + { + var diff = this.dims.cellWidth[i] - this.MIN_COL_W; + neededW -= diff; + addedW += diff; + this.dims.cellWidth[i] = this.MIN_COL_W; + } + + anotherRedraw.push(i - 1); + i++; + } + + this.dims.cellWidth[this.index] += addedW; } else { - this.dims.cellWidth[this.index + 1] += (oldColW - newColW); + if (newColW > oldColW) + { + var diff = newColW - oldColW; + var addAll = false; + var i; + + //check other cols if we already resized them + for (i = 0; i < this.index && diff > 0; i++) + { + var cDiff = this.origCellWidth[i] - this.dims.cellWidth[i]; + + if (cDiff != 0) + { + cDiff = Math.min(diff, cDiff); + diff -= cDiff; + this.dims.cellWidth[i] += cDiff; + anotherRedraw.push(i); + addAll = true; + } + } + + for (; i < this.index && addAll; i++) + { + anotherRedraw.push(i); + } + + this.dims.cellWidth[this.index] += diff; + this.dims.cellWidth[this.index + 1] -= (newColW - oldColW); + } + else + { + var diff = oldColW - newColW; + var addAll = false; + var i; + + //check other cols if we already resized them + for (i = this.dims.cols - 2; i >= this.index && diff > 0; i--) + { + var cDiff = this.origCellWidth[i + 1] - this.dims.cellWidth[i + 1]; + + if (cDiff != 0) + { + cDiff = Math.min(diff, cDiff); + diff -= cDiff; + this.dims.cellWidth[i + 1] += cDiff; + anotherRedraw.push(i); // FIXME this.index can be redrawn twice + addAll = true; + } + } + + for (; i > this.index && addAll; i--) + { + anotherRedraw.push(i); + } + + this.dims.cellWidth[this.index] = newColW; + this.dims.cellWidth[this.index + 1] += diff; + } } - + console.log(this.dims.cellWidth) var perc = []; for (var i = 0; i < this.dims.cols; i++) { perc.push((this.dims.cellWidth[i] / this.dims.fillWidth) * 100); } - + this.state.style['colPercentages'] = perc.join(','); } else { - this.state.style['equalRows'] = '0'; - var oldColH = this.dims.cellHeight[this.index]; - var newColH = oldColH + pt.y - this.y; - this.dims.cellHeight[this.index] = newColH; - - if (newColH > oldColH) + if (this.origCellHeight == null) { - this.dims.cellHeight[this.index + 1] -= (newColH - oldColH); + this.origCellHeight = this.dims.cellHeight.slice(); + } + + this.state.style['equalRows'] = '0'; + var oldRowH = this.dims.cellHeight[this.index]; + var newRowH = oldRowH + pt.y - this.y; + + if (newRowH < this.MIN_ROW_H) + { + this.dims.cellHeight[this.index] = this.MIN_ROW_H; + var addedH = oldRowH - this.MIN_ROW_H; + newRowH = Math.abs(newRowH - this.MIN_ROW_H); + var i = this.index - 1; + + while (i >= 0 && newRowH > 0) + { + if (newRowH < this.dims.cellHeight[i] - this.MIN_ROW_H) + { + this.dims.cellHeight[i] -= newRowH; + addedH += newRowH; + newRowH = 0; + } + else + { + var diff = this.dims.cellHeight[i] - this.MIN_ROW_H; + newRowH -= diff; + addedH += diff; + this.dims.cellHeight[i] = this.MIN_ROW_H; + } + + anotherRedraw.push(i); + i--; + } + + this.dims.cellHeight[this.index + 1] += addedH; + } + else if (this.dims.cellHeight[this.index + 1] < (newRowH - oldRowH + this.MIN_ROW_H)) + { + var addedH = this.dims.cellHeight[this.index + 1] - this.MIN_ROW_H; + this.dims.cellHeight[this.index + 1] = this.MIN_ROW_H; + var neededH = newRowH - oldRowH; + var i = this.index + 2; + + while (i < this.dims.rows && neededH > 0) + { + if (neededH < this.dims.cellHeight[i] - this.MIN_ROW_H) + { + this.dims.cellHeight[i] -= neededH; + addedH += neededH; + neededH = 0; + } + else + { + var diff = this.dims.cellHeight[i] - this.MIN_ROW_H; + neededH -= diff; + addedH += diff; + this.dims.cellHeight[i] = this.MIN_ROW_H; + } + + anotherRedraw.push(i - 1); + i++; + } + + this.dims.cellHeight[this.index] += addedH; } else { - this.dims.cellHeight[this.index + 1] += (oldColH - newColH); + if (newRowH > oldRowH) + { + var diff = newRowH - oldRowH; + var addAll = false; + var i; + + //check other cols if we already resized them + for (i = 0; i < this.index && diff > 0; i++) + { + var cDiff = this.origCellHeight[i] - this.dims.cellHeight[i]; + + if (cDiff != 0) + { + cDiff = Math.min(diff, cDiff); + diff -= cDiff; + this.dims.cellHeight[i] += cDiff; + anotherRedraw.push(i); + addAll = true; + } + } + + for (; i < this.index && addAll; i++) + { + anotherRedraw.push(i); + } + + this.dims.cellHeight[this.index] += diff; + this.dims.cellHeight[this.index + 1] -= (newRowH - oldRowH); + } + else + { + var diff = oldRowH - newRowH; + var addAll = false; + var i; + + //check other cols if we already resized them + for (i = this.dims.rows - 2; i >= this.index && diff > 0; i--) + { + var cDiff = this.origCellHeight[i + 1] - this.dims.cellHeight[i + 1]; + + if (cDiff != 0) + { + cDiff = Math.min(diff, cDiff); + diff -= cDiff; + this.dims.cellHeight[i + 1] += cDiff; + anotherRedraw.push(i); // FIXME this.index can be redrawn twice + addAll = true; + } + } + + for (; i > this.index && addAll; i--) + { + anotherRedraw.push(i); + } + + this.dims.cellHeight[this.index] = newRowH; + this.dims.cellHeight[this.index + 1] += diff; + } } var perc = []; @@ -593,9 +826,16 @@ mxTableLayoutHandle.prototype.setPosition = function(bounds, pt) { perc.push((this.dims.cellHeight[i] / this.dims.fillHeight) * 100); } - + this.state.style['rowPercentages'] = perc.join(','); } + + var handlers = this.isCol? this.dims.colHandlers : this.dims.rowHandlers; + + for (var i = 0; i < anotherRedraw.length; i++) + { + handlers[anotherRedraw[i]].redraw(); + } }; mxTableLayoutHandle.prototype.execute = function() @@ -604,11 +844,13 @@ mxTableLayoutHandle.prototype.execute = function() if (this.isCol) { + this.origCellWidth = null; this.copyStyle('equalColumns'); this.copyStyle('colPercentages'); } else { + this.origCellHeight = null; this.copyStyle('equalRows'); this.copyStyle('rowPercentages'); } @@ -622,6 +864,7 @@ mxTableLayout.prototype.origCreateCustomHandles = mxVertexHandler.prototype.crea mxVertexHandler.prototype.createCustomHandles = function() { + var rowHandlers = [], colHandlers = []; var origHandlers = mxTableLayout.prototype.origCreateCustomHandles.apply(this, arguments); var cell = this.state.cell; @@ -635,15 +878,21 @@ mxVertexHandler.prototype.createCustomHandles = function() } var dims = layout.calcDims(this.state.cell); + dims.rowHandlers = rowHandlers; + dims.colHandlers = colHandlers; for (var i = 0; i < dims.rows - 1; i++) { - origHandlers.push(new mxTableLayoutHandle(i, false, this.state, dims)); + var rowH = new mxTableLayoutHandle(i, false, this.state, dims); + origHandlers.push(rowH); + rowHandlers.push(rowH); } for (var i = 0; i < dims.cols - 1; i++) { - origHandlers.push(new mxTableLayoutHandle(i, true, this.state, dims)); + var colH = new mxTableLayoutHandle(i, true, this.state, dims); + origHandlers.push(colH); + colHandlers.push(colH); } } diff --git a/src/main/webapp/js/mxgraph/Graph.js b/src/main/webapp/js/mxgraph/Graph.js index a77d1b2f..deb63218 100644 --- a/src/main/webapp/js/mxgraph/Graph.js +++ b/src/main/webapp/js/mxgraph/Graph.js @@ -1363,11 +1363,13 @@ Graph.prototype.init = function(container) }; /** - * Only foreignObject supported for now (no IE11). + * Only foreignObject supported for now (no IE11). Safari disabled as it ignores + * overflow visible on foreignObject in negative space (lightbox and viewer). */ Graph.prototype.isCssTransformsSupported = function() { - return this.dialect == mxConstants.DIALECT_SVG && !mxClient.NO_FO; + return this.dialect == mxConstants.DIALECT_SVG && !mxClient.NO_FO && + (!this.lightbox || !mxClient.IS_SF); }; /** diff --git a/src/main/webapp/js/viewer.min.js b/src/main/webapp/js/viewer.min.js index 33b93c57..5010d39a 100644 --- a/src/main/webapp/js/viewer.min.js +++ b/src/main/webapp/js/viewer.min.js @@ -323,7 +323,7 @@ mxUndoManager.prototype.undo=function(){for(;0this.indexOfNextAdd)for(var a=this.history.splice(this.indexOfNextAdd,this.history.length-this.indexOfNextAdd),b=0;b/g,"
").replace(/
/g,"
").replace(/(]+)>/gm,"$1 />")}return a}; mxSvgCanvas2D.prototype.createDiv=function(a){mxUtils.isNode(a)||(a="
"+this.convertHtml(a)+"
");if(mxClient.IS_IE||mxClient.IS_IE11||!document.createElementNS){mxUtils.isNode(a)&&(a="
"+mxUtils.getXml(a)+"
");a='
'+a+"
";if("ActiveXObject"in window){var b=mxUtils.createMsXmlDocument();b.loadXML(a);return b.documentElement}return mxUtils.parseXml(a).documentElement}b=document.createElementNS("http://www.w3.org/1999/xhtml", "div");if(mxUtils.isNode(a)){var c=document.createElement("div"),d=c.cloneNode(!1);this.root.ownerDocument!=document?c.appendChild(a.cloneNode(!0)):c.appendChild(a);d.appendChild(c);b.appendChild(d)}else b.innerHTML=a;return b};mxSvgCanvas2D.prototype.updateText=function(a,b,c,d,e,f,g,k,l,m,n){null!=n&&null!=n.firstChild&&null!=n.firstChild.firstChild&&this.updateTextNodes(a,b,c,d,e,f,g,k,l,m,n.firstChild)}; -mxSvgCanvas2D.prototype.addForeignObject=function(a,b,c,d,e,f,g,k,l,m,n,p,q,r,t){q=this.createElement("foreignObject");var u=this.createElement("g");r.ownerDocument!=document&&(r=mxUtils.importNodeImplementation(q.ownerDocument,r,!0));q.appendChild(r);u.appendChild(q);this.updateTextNodes(a,b,c,d,f,g,k,m,n,p,u);this.root.ownerDocument!=document&&(a=this.createAlternateContent(q,a,b,c,d,e,f,g,k,l,m,n,p),null!=a&&(q.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility"), -b=this.createElement("switch"),b.appendChild(q),b.appendChild(a),u.appendChild(b)));t.appendChild(u)}; -mxSvgCanvas2D.prototype.updateTextNodes=function(a,b,c,d,e,f,g,k,l,m,n){a+=this.state.dx;b+=this.state.dy;var p=this.state.scale,q=n.firstChild,r=q.firstChild,t=r.firstChild,u=t.firstChild,x=this.getTextCss();q.setAttribute("width",Math.ceil(1/Math.min(1,p)*100)+"%");q.setAttribute("height",Math.ceil(1/Math.min(1,p)*100)+"%");q.setAttribute("style","overflow: visible;");q.setAttribute("pointer-events","none");mxSvgCanvas2D.createCss(c,d,e,f,g,k,l,null!=this.state.fontBackgroundColor?this.state.fontBackgroundColor: -null,null!=this.state.fontBorderColor?this.state.fontBorderColor:null,"display: flex; align-items: unsafe "+(f==mxConstants.ALIGN_TOP?"flex-start":f==mxConstants.ALIGN_BOTTOM?"flex-end":"center")+"; justify-content: unsafe "+(e==mxConstants.ALIGN_LEFT?"flex-start":e==mxConstants.ALIGN_RIGHT?"flex-end":"center")+"; ",x,p,mxUtils.bind(this,function(c,d,e,f,g){r.setAttribute("style",e+"padding-left: "+Math.round(a+c)+"px; padding-top: "+Math.round(b+d)+"px;");t.setAttribute("style",f);u.setAttribute("style", -g);c=(this.rotateHtml?this.state.rotation:0)+(null!=m?m:0);c=(0!=this.foOffset?"translate("+this.foOffset+" "+this.foOffset+") ":"")+(1!=p?"scale("+p+") ":"")+(0!=c?"rotate("+c+" "+a+" "+b+")":"");""!=c?n.setAttribute("transform",c):n.removeAttribute("transform");1!=this.state.alpha?n.setAttribute("opacity",this.state.alpha):n.removeAttribute("opacity")}))}; +mxSvgCanvas2D.prototype.addForeignObject=function(a,b,c,d,e,f,g,k,l,m,n,p,q,r,t){q=this.createElement("g");var u=this.createElement("foreignObject");u.setAttribute("style","overflow: visible; text-align: left;");u.setAttribute("pointer-events","none");r.ownerDocument!=document&&(r=mxUtils.importNodeImplementation(u.ownerDocument,r,!0));u.appendChild(r);q.appendChild(u);this.updateTextNodes(a,b,c,d,f,g,k,m,n,p,q);this.root.ownerDocument!=document&&(a=this.createAlternateContent(u,a,b,c,d,e,f,g,k,l, +m,n,p),null!=a&&(u.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility"),b=this.createElement("switch"),b.appendChild(u),b.appendChild(a),q.appendChild(b)));t.appendChild(q)}; +mxSvgCanvas2D.prototype.updateTextNodes=function(a,b,c,d,e,f,g,k,l,m,n){var p=this.state.scale;mxSvgCanvas2D.createCss(c,d,e,f,g,k,l,null!=this.state.fontBackgroundColor?this.state.fontBackgroundColor:null,null!=this.state.fontBorderColor?this.state.fontBorderColor:null,"display: flex; align-items: unsafe "+(f==mxConstants.ALIGN_TOP?"flex-start":f==mxConstants.ALIGN_BOTTOM?"flex-end":"center")+"; justify-content: unsafe "+(e==mxConstants.ALIGN_LEFT?"flex-start":e==mxConstants.ALIGN_RIGHT?"flex-end": +"center")+"; ",this.getTextCss(),p,mxUtils.bind(this,function(c,d,e,f,g){a+=this.state.dx;b+=this.state.dy;var k=n.firstChild,l=k.firstChild,q=l.firstChild,r=(this.rotateHtml?this.state.rotation:0)+(null!=m?m:0),t=(0!=this.foOffset?"translate("+this.foOffset+" "+this.foOffset+")":"")+(1!=p?"scale("+p+")":"");q.firstChild.setAttribute("style",g);q.setAttribute("style",f);k.setAttribute("width",Math.ceil(1/Math.min(1,p)*100)+"%");k.setAttribute("height",Math.ceil(1/Math.min(1,p)*100)+"%");d=Math.round(b+ +d);0>d?k.setAttribute("y",d):(k.removeAttribute("y"),e+="padding-top: "+d+"px; ");l.setAttribute("style",e+"margin-left: "+Math.round(a+c)+"px;");t+=0!=r?"rotate("+r+" "+a+" "+b+")":"";""!=t?n.setAttribute("transform",t):n.removeAttribute("transform");1!=this.state.alpha?n.setAttribute("opacity",this.state.alpha):n.removeAttribute("opacity")}))}; mxSvgCanvas2D.createCss=function(a,b,c,d,e,f,g,k,l,m,n,p,q){p="box-sizing: border-box; text-align: "+(c==mxConstants.ALIGN_LEFT?"left":c==mxConstants.ALIGN_RIGHT?"right":"center")+"; ";var r=mxUtils.getAlignmentAsPoint(c,d);c="overflow: hidden; ";d="width: 1px; ";var t="height: 1px; ",u=r.x*a,r=r.y*b;g?(d="width: "+Math.round(a)+"px; ",p+="max-height: "+Math.round(b)+"px; ",r=0):"fill"==f?(d="width: "+Math.round(a)+"px; ",t="height: "+Math.round(b)+"px; ",n+="width: 100%; height: 100%; ",p+=d+t): "width"==f?(d="width: "+Math.round(a)+"px; ",n+="width: 100%; ",p+=d,r=0,0