Gaudenz Alder před 7 roky
rodič
revize
485615ed0c

+ 9 - 0
ChangeLog

@@ -1,3 +1,12 @@
+13-MAR-2018: 8.4.6
+
+- Fixes adding of clones with new index
+
+13-MAR-2018: 8.4.5
+
+- Fixes Confluence Cloud page includes
+- Removes default empty layer in Gliffy import
+
 12-MAR-2018: 8.4.4
 
 - Uses mxGraph 3.9.4 beta 2

+ 1 - 1
VERSION

@@ -1 +1 @@
-8.4.4
+8.4.6

+ 12 - 1
src/main/java/com/mxgraph/io/gliffy/importer/GliffyDiagramConverter.java

@@ -38,6 +38,7 @@ import com.mxgraph.io.gliffy.model.Graphic.GliffyShape;
 import com.mxgraph.io.gliffy.model.Graphic.GliffySvg;
 import com.mxgraph.model.mxCell;
 import com.mxgraph.model.mxGeometry;
+import com.mxgraph.model.mxIGraphModel;
 import com.mxgraph.online.Utils;
 import com.mxgraph.util.mxConstants;
 import com.mxgraph.util.mxDomUtils;
@@ -485,7 +486,6 @@ public class GliffyDiagramConverter
 		}
 
 		drawioDiagram.getModel().setGeometry(cell, geo);
-
 	}
 
 	/**
@@ -498,6 +498,17 @@ public class GliffyDiagramConverter
 		if (layers == null)
 			return;
 		
+		// Removes empty default layer
+		if (layers.size() > 0)
+		{
+			mxIGraphModel model = drawioDiagram.getModel();
+			
+			if (model.getChildCount(model.getRoot()) > 0)
+			{
+				model.remove(model.getChildAt(model.getRoot(), 0));
+			}
+		}
+		
 		for (GliffyLayer layer : layers)
 		{
 			mxCell layerCell = new mxCell();

+ 1 - 1
src/main/webapp/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 03/12/2018 12:01 PM
+# 03/13/2018 05:13 PM
 
 app.html
 index.html?offline=1

+ 1 - 1
src/main/webapp/connect/confluence/ac.js

@@ -1112,7 +1112,7 @@ AC.init = function(baseUrl, location, pageId, editor, diagramName, initialXml, d
 };
 
 AC.loadDiagram = function (pageId, diagramName, revision, success, error, owningPageId, tryRev1) {
-	// TODO: Get binary
+	revision = null;
 	
 	AP.require('request', function(request) {
 		request({

+ 5 - 3
src/main/webapp/connect/confluence/viewer-1-4-8.html

@@ -320,7 +320,9 @@ if (lang != null)
 											};
 
 										}
-										if (retryParams.saveIt)
+										//Saving the diagram to this page negates page linking feature!
+										//May be we should ask the user first or saving is not needed all together
+										/*if (retryParams.saveIt)
 										{
 								 			//Since attachment wasn't found in this page, it is better to save it to this page
 								 			//First load AC dynamically. Since AC is not needed in the viewer except for this case
@@ -332,7 +334,7 @@ if (lang != null)
 											script.onload = function()
 											{
 												//save diagram
-												AC.saveDiagram(retryParams.pageId, name, btoa(unescape(encodeURIComponent(xml))),
+												AC.saveDiagram(retryParams.pageId, name, xml,
 												function()
 												{
 													//nothing!
@@ -347,7 +349,7 @@ if (lang != null)
 											};
 											script.src = 'connectUtils-1-4-8.js';
 											head.appendChild(script);
-										}
+										}*/
 							 		}
 								},
 								error: function (err)

+ 1 - 1
src/main/webapp/connect/confluence/viewer2.html

@@ -84,7 +84,7 @@ if (lang != null)
 	//ceoId is used as fallback in case owningPageId is not set(should be very rare)
 	var ceoId = getUrlParam('ceoId');
 	var owningPageId = getUrlParam('owningPageId');
-	var revision = getUrlParam('revision');
+	var revision = null;
 	
 	var tbStyle = getUrlParam('tbstyle') || 'top';
 	var links = getUrlParam('links') || 'auto';

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 309 - 307
src/main/webapp/js/app.min.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 414 - 414
src/main/webapp/js/atlas-viewer.min.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 641 - 639
src/main/webapp/js/atlas.min.js


+ 90 - 58
src/main/webapp/js/diagramly/Dialogs.js

@@ -367,7 +367,7 @@ var StorageDialog = function(editorUi, fn, rowLimit)
 		link.style.padding = '18px 0px 6px 0px';
 		link.style.fontSize = '12px';
 		link.style.color = 'gray';
-		mxUtils.write(link, mxResources.get('import') + ' ' + mxResources.get('gliffy') + ', ' +
+		mxUtils.write(link, mxResources.get('import') + ': ' + mxResources.get('gliffy') + ', ' +
 				mxResources.get('formatVssx') + ', ' + mxResources.get('formatVsdx') + ', ' +
 				mxResources.get('lucidchart') + '...');
 		
@@ -2104,10 +2104,11 @@ var ParseDialog = function(editorUi, title)
 	{
 		var lines = text.split('\n');
 		
-		if (type == 'plantUmlPng' || type == 'plantUmlSvg')
+		if (type == 'plantUmlPng' || type == 'plantUmlSvg' || type == 'plantUmlTxt')
 		{
-			var plantUmlServerUrl = (type == 'plantUmlPng') ? 'https://exp.draw.io/plantuml2/png/' :
-				'https://exp.draw.io/plantuml2/svg/';
+			var plantUmlServerUrl = (type == 'plantUmlTxt') ? 'https://exp.draw.io/plantuml2/txt/' :
+				((type == 'plantUmlPng') ? 'https://exp.draw.io/plantuml2/png/' :
+				'https://exp.draw.io/plantuml2/svg/');
 		    	var graph = editorUi.editor.graph;
 		    	
 		    	// TODO: Change server to return base64 & accept POST request
@@ -2171,64 +2172,90 @@ var ParseDialog = function(editorUi, title)
 			
 				var xhr = new XMLHttpRequest();
 				xhr.open('GET', plantUmlServerUrl + compress(text), true);
-				xhr.responseType = 'blob';
+				
+				if (type != 'plantUmlTxt')
+				{
+					xhr.responseType = 'blob';
+				}
 				
 				xhr.onload = function(e) 
 				{
 				  if (this.status >= 200 && this.status < 300)
 				  {
-				    var reader = new FileReader();
-				    reader.readAsDataURL(this.response);
-				    
-				    reader.onload = function(e) 
-				    {
-					    	var img = new Image();
-					    	
-					    	img.onload = function()
-					    	{
-					    		editorUi.spinner.stop();
-					    		var w = img.width;
-					    		var h = img.height;
-					    		
-					    		// Workaround for 0 image size in IE11
-					    		if (w == 0 && h == 0)
-					    		{
-						    		var data = e.target.result;
-						    		var comma = data.indexOf(',');
-			    					var svgText = decodeURIComponent(escape(atob(data.substring(comma + 1))));
-			    					var root = mxUtils.parseXml(svgText);
-		    						var svgs = root.getElementsByTagName('svg');
-		    						
-		    						if (svgs.length > 0)
-		    						{
-		    							w = parseFloat(svgs[0].getAttribute('width'));
-		    							h = parseFloat(svgs[0].getAttribute('height'));
-		    						}
-					    		}
-					    		
-					    		graph.getModel().beginUpdate();
-							try
-							{
-					    			cell = graph.insertVertex(null, null, text, insertPoint.x, insertPoint.y,
-									w, h, 'shape=image;noLabel=1;verticalAlign=top;aspect=fixed;imageAspect=0;' +
-									'image=' + editorUi.convertDataUri(e.target.result) + ';');
-							}
-							finally
-							{
-								graph.getModel().endUpdate();
-							}
-							
-							graph.setSelectionCell(cell);
-				           	graph.scrollCellToVisible(graph.getSelectionCell());
-					    	};
-					    	
-					    	img.src = e.target.result;
-				    };
-				    
-				    reader.onerror = function(e)
-				    {
-				    		editorUi.handleError(e);
-				    };
+					if (type == 'plantUmlTxt')
+					{
+						editorUi.spinner.stop();
+						
+			    			graph.getModel().beginUpdate();
+						try
+						{
+				    			cell = graph.insertVertex(null, null, '<pre>' + this.response + '</pre>',
+				    				insertPoint.x, insertPoint.y, 1, 1, 'text;html=1;overflow=fill;');
+				    			graph.updateCellSize(cell, true);
+						}
+						finally
+						{
+							graph.getModel().endUpdate();
+						}
+						
+						graph.setSelectionCell(cell);
+			           	graph.scrollCellToVisible(graph.getSelectionCell());
+					}
+					else
+					{
+					    var reader = new FileReader();
+					    reader.readAsDataURL(this.response);
+					    
+					    reader.onload = function(e) 
+					    {
+						    	var img = new Image();
+						    	
+						    	img.onload = function()
+						    	{
+						    		editorUi.spinner.stop();
+						    		var w = img.width;
+						    		var h = img.height;
+						    		
+						    		// Workaround for 0 image size in IE11
+						    		if (w == 0 && h == 0)
+						    		{
+							    		var data = e.target.result;
+							    		var comma = data.indexOf(',');
+				    					var svgText = decodeURIComponent(escape(atob(data.substring(comma + 1))));
+				    					var root = mxUtils.parseXml(svgText);
+			    						var svgs = root.getElementsByTagName('svg');
+			    						
+			    						if (svgs.length > 0)
+			    						{
+			    							w = parseFloat(svgs[0].getAttribute('width'));
+			    							h = parseFloat(svgs[0].getAttribute('height'));
+			    						}
+						    		}
+						    		
+						    		graph.getModel().beginUpdate();
+								try
+								{
+						    			cell = graph.insertVertex(null, null, text, insertPoint.x, insertPoint.y,
+										w, h, 'shape=image;noLabel=1;verticalAlign=top;aspect=fixed;imageAspect=0;' +
+										'image=' + editorUi.convertDataUri(e.target.result) + ';');
+								}
+								finally
+								{
+									graph.getModel().endUpdate();
+								}
+								
+								graph.setSelectionCell(cell);
+					           	graph.scrollCellToVisible(graph.getSelectionCell());
+						    	};
+						    	
+						    	img.src = e.target.result;
+					    };
+					    
+					    reader.onerror = function(e)
+					    {
+					    		editorUi.handleError(e);
+					    };
+					}
 				  }
 				  else 
 				  {
@@ -2533,11 +2560,16 @@ var ParseDialog = function(editorUi, title)
 	plantUmlPngOption.setAttribute('value', 'plantUmlPng');
 	mxUtils.write(plantUmlPngOption, mxResources.get('plantUml') + ' (' + mxResources.get('formatPng') + ')');
 	
+	var plantUmlTxtOption = document.createElement('option');
+	plantUmlTxtOption.setAttribute('value', 'plantUmlTxt');
+	mxUtils.write(plantUmlTxtOption, mxResources.get('plantUml') + ' (' + mxResources.get('text') + ')');
+	
 	// Disabled for invalid hosts via CORS headers
 	if (EditorUi.enablePlantUml && Graph.fileSupport && !editorUi.isOffline())
 	{
 		typeSelect.appendChild(plantUmlSvgOption);
 		typeSelect.appendChild(plantUmlPngOption);
+		typeSelect.appendChild(plantUmlTxtOption);
 	}
 
 	function getDefaultValue()
@@ -2555,7 +2587,7 @@ var ParseDialog = function(editorUi, title)
 		{
 			return '@startuml\nskinparam backgroundcolor transparent\nskinparam shadowing false\nAlice -> Bob: Authentication Request\nBob --> Alice: Authentication Response\n\nAlice -> Bob: Another authentication Request\nAlice <-- Bob: another authentication Response\n@enduml';
 		}
-		else if (typeSelect.value == 'plantUmlSvg')
+		else if (typeSelect.value == 'plantUmlSvg' || typeSelect.value == 'plantUmlTxt')
 		{
 			return '@startuml\nskinparam shadowing false\nAlice -> Bob: Authentication Request\nBob --> Alice: Authentication Response\n\nAlice -> Bob: Another authentication Request\nAlice <-- Bob: another authentication Response\n@enduml';
 		}

+ 12 - 12
src/main/webapp/js/diagramly/vsdx/VsdxExport.js

@@ -334,7 +334,7 @@ function VsdxExport(editorUi)
 		if (lbkgnd) shape.appendChild(createCellElem("TextBkgnd", lbkgnd, xmlDoc));
 	};
 
-	function createShape(id, geo, xmlDoc, parentHeight)
+	function createShape(id, geo, xmlDoc, parentHeight, isChild)
 	{
 		var shape = createElt(xmlDoc, that.XMLNS, "Shape");
 		
@@ -346,8 +346,8 @@ function VsdxExport(editorUi)
 		
 		var hw = geo.width/2, hh = geo.height/2;
 		
-		shape.appendChild(createCellElemScaled("PinX", geo.x + hw + vsdxCanvas.shiftX, xmlDoc));
-		shape.appendChild(createCellElemScaled("PinY", parentHeight - geo.y - hh - vsdxCanvas.shiftY, xmlDoc));
+		shape.appendChild(createCellElemScaled("PinX", geo.x + hw + (isChild? 0 : vsdxCanvas.shiftX), xmlDoc));
+		shape.appendChild(createCellElemScaled("PinY", parentHeight - geo.y - hh - (isChild? 0 : vsdxCanvas.shiftY), xmlDoc));
 		shape.appendChild(createCellElemScaled("Width", geo.width, xmlDoc));
 		shape.appendChild(createCellElemScaled("Height", geo.height, xmlDoc));
 		shape.appendChild(createCellElemScaled("LocPinX", hw, xmlDoc));
@@ -388,7 +388,7 @@ function VsdxExport(editorUi)
 			return 6;
 	};
 
-	function createEdge(cell, graph, xmlDoc, parentHeight)
+	function createEdge(cell, graph, xmlDoc, parentHeight, isChild)
 	{
 		var state = graph.view.getState(cell);
 		
@@ -423,8 +423,8 @@ function VsdxExport(editorUi)
 		var calcVsdxPoint = function(p, noHeight) 
 		{
 			var x = p.x, y = p.y;
-			x = (x * s.scale - bounds.x + s.dx + vsdxCanvas.shiftX) ;
-			y = ((noHeight? 0 : bounds.height) - y * s.scale + bounds.y - s.dy - vsdxCanvas.shiftY) ;
+			x = (x * s.scale - bounds.x + s.dx + (isChild? 0 : vsdxCanvas.shiftX)) ;
+			y = ((noHeight? 0 : bounds.height) - y * s.scale + bounds.y - s.dy - (isChild? 0 : vsdxCanvas.shiftY)) ;
 			return {x: x, y: y};
 		};
 
@@ -491,7 +491,7 @@ function VsdxExport(editorUi)
 		return shape;
 	};
 	
-	function convertMxCell2Shape(cell, graph, xmlDoc, parentHeight, parentGeo)
+	function convertMxCell2Shape(cell, graph, xmlDoc, parentHeight, parentGeo, isChild)
 	{
 		var geo = cell.geometry;
 		
@@ -511,7 +511,7 @@ function VsdxExport(editorUi)
 			if (!cell.treatAsSingle && cell.getChildCount() > 0) //Group 
 			{
 				//Create group shape as an empty shape with no geo
-				var shape = createShape(vsdxId + "10000", geo, xmlDoc, parentHeight);
+				var shape = createShape(vsdxId + "10000", geo, xmlDoc, parentHeight, isChild);
 				shape.setAttribute("Type", "Group");
 				
 				//Create group shape
@@ -528,7 +528,7 @@ function VsdxExport(editorUi)
 				newGeo.y = 0;
 				cell.setGeometry(newGeo);
 				cell.treatAsSingle = true;
-				var subShape = convertMxCell2Shape(cell, graph, xmlDoc, geo.height, geo);
+				var subShape = convertMxCell2Shape(cell, graph, xmlDoc, geo.height, geo, true);
 				cell.treatAsSingle = false;
 				cell.setGeometry(geo);
 				gShapes.appendChild(subShape);
@@ -538,7 +538,7 @@ function VsdxExport(editorUi)
 				{
 					var child = cell.children[i];
 					
-					var subShape = convertMxCell2Shape(child, graph, xmlDoc, geo.height, geo);
+					var subShape = convertMxCell2Shape(child, graph, xmlDoc, geo.height, geo, true);
 					
 					gShapes.appendChild(subShape);
 				}
@@ -553,7 +553,7 @@ function VsdxExport(editorUi)
 			else if (cell.vertex)
 			{
 	
-				var shape = createShape(vsdxId, geo, xmlDoc, parentHeight);
+				var shape = createShape(vsdxId, geo, xmlDoc, parentHeight, isChild);
 				
 				var state = graph.view.getState(cell);
 
@@ -584,7 +584,7 @@ function VsdxExport(editorUi)
 			}
 			else
 			{
-				return createEdge(cell, graph, xmlDoc, parentHeight);
+				return createEdge(cell, graph, xmlDoc, parentHeight, isChild);
 			}
 		}
 		else

+ 2 - 2
src/main/webapp/js/diagramly/vsdx/importer.js

@@ -1023,12 +1023,12 @@ var com;
                                             cell = this_1.addUnconnectedEdge(shapeGraph, null, shape, 1169);
                                         }
                                         if (cell != null) {
-                                            /* append */ (function (sb) { return sb.str = sb.str.concat(comma_1); })(shapes_1);
-                                            /* append */ (function (sb) { return sb.str = sb.str.concat("{\"xml\":\""); })(shapes_1);
                                             var geo_1 = this_1.normalizeGeo(cell);
                                             this_1.sanitiseGraph(shapeGraph);
                                             if (shapeGraph.getModel().getChildCount(shapeGraph.getDefaultParent()) === 0)
                                                 return "continue";
+                                            /* append */ (function (sb) { return sb.str = sb.str.concat(comma_1); })(shapes_1);
+                                            /* append */ (function (sb) { return sb.str = sb.str.concat("{\"xml\":\""); })(shapes_1);
                                             var shapeXML_1 = _super.prototype.processPage.call(this_1, shapeGraph, null);
                                             /* append */ (function (sb) { return sb.str = sb.str.concat(shapeXML_1); })(shapes_1);
                                             /* append */ (function (sb) { return sb.str = sb.str.concat("\",\"w\":"); })(shapes_1);

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 178 - 178
src/main/webapp/js/embed-static.min.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 211 - 211
src/main/webapp/js/extensions.min.js


+ 4 - 0
src/main/webapp/js/mxgraph/EditorUi.js

@@ -3005,6 +3005,10 @@ EditorUi.prototype.createDivs = function()
 	{
 		this.tabContainer = this.createTabContainer();
 	}
+	else
+	{
+		this.diagramContainer.style.border = 'none';
+	}
 };
 
 /**

+ 8 - 4
src/main/webapp/js/mxgraph/Graph.js

@@ -878,7 +878,7 @@ Graph = function(container, model, renderHint, stylesheet, themes)
 		{
 			me = graphUpdateMouseEvent.apply(this, arguments);
 			
-			if (this.isCellLocked(me.getCell()))
+			if (me.state != null && this.isCellLocked(me.getCell()))
 			{
 				me.state = null;
 			}
@@ -1119,6 +1119,8 @@ Graph.prototype.labelLinkClicked = function(state, elt, evt)
  */
 Graph.prototype.openLink = function(href, target)
 {
+	var result = window;
+	
 	// Workaround for blocking in same iframe
 	if (target == '_self' && window != window.top)
 	{
@@ -1143,9 +1145,11 @@ Graph.prototype.openLink = function(href, target)
 		}
 		else
 		{
-			window.open(href, target);
+			result = window.open(href, target);
 		}
 	}
+	
+	return result;
 };
 
 /**
@@ -3579,7 +3583,7 @@ HoverIcons.prototype.setCurrentState = function(state)
 						var state2 = this.validEdges[e];
 						var pts2 = state2.absolutePoints;
 						
-						if (pts2 != null && mxUtils.intersects(state, state2))
+						if (pts2 != null && mxUtils.intersects(state, state2) && state2.style['noJump'] != '1')
 						{
 							// Compares each segment of the edge with the current segment
 							for (var j = 0; j < pts2.length - 1; j++)
@@ -5438,7 +5442,7 @@ if (typeof mxVertexHandler != 'undefined')
 				for (var i = 0; i < cells.length; i++)
 				{
 					var parent = model.getParent(cells[i]);
-					var child = this.moveCells([clones[i]], s, s, false, parent)[0]; 
+					var child = this.moveCells([clones[i]], s, s, false)[0];
 					select.push(child);
 					
 					if (append)

Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 178 - 178
src/main/webapp/js/reader.min.js


Rozdílová data souboru nebyla zobrazena, protože soubor je příliš velký
+ 414 - 414
src/main/webapp/js/viewer.min.js