瀏覽代碼

12.1.2 release

Gaudenz Alder 5 年之前
父節點
當前提交
fecc68fb81

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+16-OCT-2019: 12.1.2
+
+- Fixes scrollbars in Confluence Cloud and Jira Cloud
+- Fixes export of uncompressed XML files to PDF
+- Uses mxGraph 4.0.3 beta 7
+
 14-OCT-2019: 12.1.1
 
 - Uses uncompressed XML files in GitLab and GitHub

+ 1 - 1
VERSION

@@ -1 +1 @@
-12.1.1
+12.1.2

File diff suppressed because it is too large
+ 2 - 2
etc/mxgraph/mxClient.js


+ 131 - 150
src/main/java/com/mxgraph/online/AbsAuthServlet.java

@@ -72,51 +72,37 @@ abstract public class AbsAuthServlet extends HttpServlet
 					stateVars.put(keyVal[0], keyVal[1]);
 				}
 			}
-		}
-		catch (Exception e) 
-		{
-			e.printStackTrace();
-		}
-		
-		int configIndex = 0;
-		
-		try 
-		{
+			
+			int configIndex = 0;
+
 			String appIndex = stateVars.get("appIndex");
 					
 			if (appIndex != null)
 			{
 				configIndex = Integer.parseInt(appIndex);
 			}
-		}
-		catch (Exception e) 
-		{
-			e.printStackTrace();
-		}
-		
-		Config CONFIG = getConfig();
-		String secret, client, redirectUri;
-		String[] secrets, clients;
-		
-		if ("127.0.0.1".equals(request.getServerName()))
-		{
-			secrets = CONFIG.DEV_CLIENT_SECRET.split(SEPARATOR);
-			clients = CONFIG.DEV_CLIENT_ID.split(SEPARATOR);
-			redirectUri = CONFIG.DEV_REDIRECT_URI;
-		}
-		else
-		{
-			secrets = CONFIG.CLIENT_SECRET.split(SEPARATOR);
-			clients = CONFIG.CLIENT_ID.split(SEPARATOR);
-			redirectUri = CONFIG.REDIRECT_URI;
-		}
-
-		secret = secrets.length > configIndex ? secrets[configIndex] : secrets[0];
-		client = clients.length > configIndex ? clients[configIndex] : clients[0];
+			
+			Config CONFIG = getConfig();
+			String secret, client, redirectUri;
+			String[] secrets, clients;
 
-		if (error != null)
-		{
-			try
+			if ("127.0.0.1".equals(request.getServerName()))
+			{
+				secrets = CONFIG.DEV_CLIENT_SECRET.split(SEPARATOR);
+				clients = CONFIG.DEV_CLIENT_ID.split(SEPARATOR);
+				redirectUri = CONFIG.DEV_REDIRECT_URI;
+			}
+			else
+			{
+				secrets = CONFIG.CLIENT_SECRET.split(SEPARATOR);
+				clients = CONFIG.CLIENT_ID.split(SEPARATOR);
+				redirectUri = CONFIG.REDIRECT_URI;
+			}
+	
+			secret = secrets.length > configIndex ? secrets[configIndex] : secrets[0];
+			client = clients.length > configIndex ? clients[configIndex] : clients[0];
+	
+			if (error != null)
 			{
 				response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
 				
@@ -130,137 +116,132 @@ abstract public class AbsAuthServlet extends HttpServlet
 				writer.flush();
 				writer.close();
 			}
-			catch(Exception e)
+			else if (code == null && refreshToken == null)
 			{
-				e.printStackTrace();
-				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+				response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
 			}
-		}
-		else if (code == null && refreshToken == null)
-		{
-			response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
-		}
-		else
-		{
-			HttpURLConnection con = null;
-			
-			try
+			else
 			{
-				String url = CONFIG.AUTH_SERVICE_URL;
-				URL obj = new URL(url);
-				con = (HttpURLConnection) obj.openConnection();
-	
-				con.setRequestMethod("POST");
-				con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
-	
-				boolean jsonResponse = false;
-				StringBuilder urlParameters = new StringBuilder();
-				
-				urlParameters.append("client_id=");
-				urlParameters.append(client);
-				urlParameters.append("&redirect_uri=");
-				urlParameters.append(redirectUri);
-				urlParameters.append("&client_secret=");
-				urlParameters.append(secret);
+				HttpURLConnection con = null;
 				
-				if (code != null)
-				{
-					urlParameters.append("&code=");
-					urlParameters.append(code);
-					urlParameters.append("&grant_type=authorization_code");
-				}
-				else
+				try
 				{
-					urlParameters.append("&refresh_token=");
-					urlParameters.append(refreshToken);
-					urlParameters.append("&grant_type=refresh_token");
-					jsonResponse = true;
-				}
-				
-				// Send post request
-				con.setDoOutput(true);
-				DataOutputStream wr = new DataOutputStream(con.getOutputStream());
-				wr.writeBytes(urlParameters.toString());
-				wr.flush();
-				wr.close();
+					String url = CONFIG.AUTH_SERVICE_URL;
+					URL obj = new URL(url);
+					con = (HttpURLConnection) obj.openConnection();
+		
+					con.setRequestMethod("POST");
+					con.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");
+		
+					boolean jsonResponse = false;
+					StringBuilder urlParameters = new StringBuilder();
+					
+					urlParameters.append("client_id=");
+					urlParameters.append(client);
+					urlParameters.append("&redirect_uri=");
+					urlParameters.append(redirectUri);
+					urlParameters.append("&client_secret=");
+					urlParameters.append(secret);
+					
+					if (code != null)
+					{
+						urlParameters.append("&code=");
+						urlParameters.append(code);
+						urlParameters.append("&grant_type=authorization_code");
+					}
+					else
+					{
+						urlParameters.append("&refresh_token=");
+						urlParameters.append(refreshToken);
+						urlParameters.append("&grant_type=refresh_token");
+						jsonResponse = true;
+					}
+					
+					// Send post request
+					con.setDoOutput(true);
+					DataOutputStream wr = new DataOutputStream(con.getOutputStream());
+					wr.writeBytes(urlParameters.toString());
+					wr.flush();
+					wr.close();
+		
+					BufferedReader in = new BufferedReader(
+							new InputStreamReader(con.getInputStream()));
+					String inputLine;
+					StringBuffer authRes = new StringBuffer();
+		
+					while ((inputLine = in.readLine()) != null)
+					{
+						authRes.append(inputLine);
+					}
+					in.close();
 	
-				BufferedReader in = new BufferedReader(
-						new InputStreamReader(con.getInputStream()));
-				String inputLine;
-				StringBuffer authRes = new StringBuffer();
+					response.setStatus(con.getResponseCode());
+					
+					OutputStream out = response.getOutputStream();
+		
+					PrintWriter writer = new PrintWriter(out);
 	
-				while ((inputLine = in.readLine()) != null)
-				{
-					authRes.append(inputLine);
+					// Writes JavaScript code
+					writer.println(processAuthResponse(authRes.toString(), jsonResponse));
+		
+					writer.flush();
+					writer.close();
 				}
-				in.close();
-
-				response.setStatus(con.getResponseCode());
-				
-				OutputStream out = response.getOutputStream();
-	
-				PrintWriter writer = new PrintWriter(out);
-
-				// Writes JavaScript code
-				writer.println(processAuthResponse(authRes.toString(), jsonResponse));
-	
-				writer.flush();
-				writer.close();
-			}
-			catch(IOException e)
-			{
-				e.printStackTrace();
-				StringBuilder details = new StringBuilder("");
-				
-				if (con != null)
+				catch(IOException e)
 				{
-					try 
+					e.printStackTrace();
+					StringBuilder details = new StringBuilder("");
+					
+					if (con != null)
 					{
-						BufferedReader in = new BufferedReader(
-								new InputStreamReader(con.getErrorStream()));
-						
-						String inputLine;
-	
-						while ((inputLine = in.readLine()) != null)
+						try 
+						{
+							BufferedReader in = new BufferedReader(
+									new InputStreamReader(con.getErrorStream()));
+							
+							String inputLine;
+		
+							while ((inputLine = in.readLine()) != null)
+							{
+								System.err.println(inputLine);
+								details.append(inputLine);
+								details.append("\n");
+							}
+							in.close();
+						}
+						catch (Exception e2) 
 						{
-							System.err.println(inputLine);
-							details.append(inputLine);
-							details.append("\n");
+							// Ignore
 						}
-						in.close();
 					}
-					catch (Exception e2) 
+					
+					if (e.getMessage() != null && e.getMessage().contains("401"))
 					{
-						// Ignore
+						response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
+					}
+					else
+					{
+						response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
 					}
-				}
-				
-				if (e.getMessage() != null && e.getMessage().contains("401"))
-				{
-					response.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
-				}
-				else
-				{
-					response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-				}
-				
-				if (DEBUG)
-				{
-					OutputStream out = response.getOutputStream();
 					
-					PrintWriter writer = new PrintWriter(out);
-	
-					e.printStackTrace(writer);
-					writer.println(details.toString());
+					if (DEBUG)
+					{
+						OutputStream out = response.getOutputStream();
+						
+						PrintWriter writer = new PrintWriter(out);
 		
-					writer.flush();
-					writer.close();
+						e.printStackTrace(writer);
+						writer.println(details.toString());
+			
+						writer.flush();
+						writer.close();
+					}
 				}
 			}
-			catch (Exception e) 
-			{
-				response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
-			}
+		}
+		catch (Exception e) 
+		{
+			response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
 		}
 	}
 

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

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 10/14/2019 01:46 PM
+# 10/16/2019 02:41 PM
 
 app.html
 index.html?offline=1

+ 7 - 1
src/main/webapp/export3.html

@@ -643,7 +643,13 @@
 							pageId = diagrams[i].getAttribute('id')
 						}
 						
-						xmlDoc = mxUtils.parseXml(Graph.decompress(mxUtils.getTextContent(diagrams[i])));
+						xmlDoc = Editor.parseDiagramNode(diagrams[i]);
+						
+						if (xmlDoc != null)
+						{
+							xmlDoc = xmlDoc.ownerDocument;
+						}
+
 						graph.getModel().clear();
 						from = i;
 						renderPage();

File diff suppressed because it is too large
+ 11 - 10
src/main/webapp/js/app.min.js


+ 3 - 3
src/main/webapp/js/diagramly/Dialogs.js

@@ -2085,7 +2085,7 @@ var ParseDialog = function(editorUi, title, defaultType)
 						graph.setSelectionCell(cell);
 						graph.scrollCellToVisible(cell);
 					}
-				}, function(err)
+				}, function(e)
 				{
 					editorUi.handleError(e);
 				});
@@ -2462,11 +2462,11 @@ var ParseDialog = function(editorUi, title, defaultType)
 		}
 		else if (typeSelect.value == 'plantUmlPng')
 		{
-			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';
+			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' || 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';
+			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';
 		}
 		else
 		{

+ 49 - 37
src/main/webapp/js/diagramly/GraphViewer.js

@@ -496,7 +496,8 @@ GraphViewer.prototype.addSizeHandler = function()
 			
 			if (this.graphConfig['toolbar-nohide'] != true)
 			{
-				if (container.offsetWidth <= tmp.width + 2 * this.graph.border * this.graph.view.scale)
+				// Shows scrollbars if graph is larger than available width
+				if (tmp.width + 2 * this.graph.border > container.offsetWidth - 2)
 				{
 					container.style.overflow = 'auto';
 				}
@@ -516,7 +517,8 @@ GraphViewer.prototype.addSizeHandler = function()
 				
 				// Workaround for position:relative set in ResizeSensor
 				var origin = mxUtils.getScrollOrigin(document.body)
-				var b = (document.body.style.position === 'relative') ? document.body.getBoundingClientRect() :
+				var b = (document.body.style.position === 'relative') ?
+					document.body.getBoundingClientRect() :
 					{left: -origin.x, top: -origin.y};
 				r = {left: r.left - b.left, top: r.top - b.top, bottom: r.bottom - b.top, right: r.right - b.left};
 				
@@ -553,39 +555,42 @@ GraphViewer.prototype.addSizeHandler = function()
 	{
 		var cachedOffsetWidth = container.offsetWidth;
 		
-		if (cachedOffsetWidth != lastOffsetWidth)
+		if (cachedOffsetWidth != lastOffsetWidth && !this.handlingResize)
 		{
-			if (!this.handlingResize)
-			{
-				this.handlingResize = true;
-				
-				this.graph.maxFitScale = (maxScale != null) ? maxScale : (this.graphConfig.zoom ||
-					((this.allowZoomIn) ? null : 1));
-				this.graph.fit((maxScale != null) ? 0 : null, null, null, null, false, true);
-				var tmp = this.graph.getGraphBounds();
-				
-				if (this.center)
-				{
-					this.graph.center();
-				}	
-				
-				this.graph.maxFitScale = null;
-				
-				this.updateContainerHeight(container, Math.max(this.minHeight, tmp.height + 2 * this.graph.border + 1));
+			this.handlingResize = true;
+			
+			this.graph.maxFitScale = (maxScale != null) ? maxScale : (this.graphConfig.zoom ||
+				((this.allowZoomIn) ? null : 1));
+			this.graph.container.style.overflow = 'hidden';
+			this.graph.fit();
 
-				this.graph.initialViewState = {
-					translate: this.graph.view.translate.clone(),
-					scale: this.graph.view.scale
-				};
-				
-				lastOffsetWidth = cachedOffsetWidth;
-				
-				// Workaround for fit triggering scrollbars triggering doResize (infinite loop)
-				window.setTimeout(mxUtils.bind(this, function()
-				{
-					this.handlingResize = false;
-				}), 0);
+			if (this.center || !(this.graphConfig.resize != false || container.style.height == ''))
+			{
+				this.graph.center();
+				console.log('center0');
+			}	
+			
+			this.graph.maxFitScale = null;
+			
+			if (this.graphConfig.resize != false || container.style.height == '')
+			{
+				this.updateContainerHeight(container, Math.max(this.minHeight,
+					this.graph.getGraphBounds().height +
+					2 * this.graph.border + 1));
 			}
+
+			this.graph.initialViewState = {
+				translate: this.graph.view.translate.clone(),
+				scale: this.graph.view.scale
+			};
+			
+			lastOffsetWidth = cachedOffsetWidth;
+			
+			// Workaround for fit triggering scrollbars triggering doResize (infinite loop)
+			window.setTimeout(mxUtils.bind(this, function()
+			{
+				this.handlingResize = false;
+			}), 0);
 		}
 	});
 
@@ -616,7 +621,10 @@ GraphViewer.prototype.addSizeHandler = function()
 			this.updateContainerWidth(container, bounds.width + 2 * this.graph.border);
 		}
 		
-		this.updateContainerHeight(container, Math.max(this.minHeight, bounds.height + 2 * this.graph.border + 1));
+		if (this.graphConfig.resize != false || container.style.height == '')
+		{
+			this.updateContainerHeight(container, Math.max(this.minHeight, bounds.height + 2 * this.graph.border + 1));
+		}
 
 		if (!this.zoomEnabled && this.autoFit)
 		{
@@ -672,17 +680,21 @@ GraphViewer.prototype.addSizeHandler = function()
 		{
 			var maxScale = null;
 
-			if (maxHeight != null && bounds.height + 2 * this.graph.border > maxHeight)
+			if (maxHeight != null && bounds.height + 2 * this.graph.border > maxHeight - 2)
 			{
-				maxScale = (maxHeight - 2 * this.graph.border) / bounds.height;
+				maxScale = (maxHeight - 2 * this.graph.border - 2) / bounds.height;
 			}
 
 			this.fitGraph(maxScale);
 		}
+		else if (!this.widthIsEmpty && !(this.graphConfig.resize != false || container.style.height == ''))
+		{
+			this.graph.center((!this.widthIsEmpty || bounds.width < this.minWidth) && this.graphConfig.resize != true);
+		}
 		else
 		{
-			this.graph.view.setTranslate(Math.floor((this.graph.border - bounds.x) / this.graph.view.scale),
-				Math.floor((this.graph.border - bounds.y) / this.graph.view.scale));
+			this.graph.view.setTranslate(Math.floor(this.graph.border - bounds.x / this.graph.view.scale),
+				Math.floor(this.graph.border - bounds.y / this.graph.view.scale));
 			lastOffsetWidth = container.offsetWidth;
 		}
 		

+ 59 - 52
src/main/webapp/js/diagramly/mxRuler.js

@@ -355,61 +355,68 @@ function mxRuler(editorUi, unit, isVertical, isSecondery)
 			
 			ret = ruler.origGuideMove.apply(this, arguments);
 	
-			var x1, y1, imgData1, x2, y2, imgData2, x3, y3, imgData3;
-			ctx.lineWidth = 0.5;
-	        ctx.strokeStyle = style.guideClr;
-	        ctx.setLineDash([2]);
-	
-	        if (isVertical)
-			{
-				y1 = bounds.y + ret.y + RULER_THICKNESS - this.graph.container.scrollTop;
-				x1 = 0;
-				y2 = y1 + bounds.height / 2;
-				x2 = RULER_THICKNESS / 2;
-				y3 = y1 + bounds.height;
-				x3 = 0;
-				imgData1 = ctx.getImageData(x1, y1 - 1, RULER_THICKNESS, 3);
-				drawLine(x1, y1, RULER_THICKNESS, y1);
-				y1--;
-				imgData2 = ctx.getImageData(x2, y2 - 1, RULER_THICKNESS, 3);
-				drawLine(x2, y2, RULER_THICKNESS, y2);
-				y2--;
-				imgData3 = ctx.getImageData(x3, y3 - 1, RULER_THICKNESS, 3);
-				drawLine(x3, y3, RULER_THICKNESS, y3);
-				y3--;
-			}
-			else
+			try
 			{
-				y1 = 0;
-				x1 = bounds.x + ret.x + RULER_THICKNESS - this.graph.container.scrollLeft;
-				y2 = RULER_THICKNESS / 2;
-				x2 = x1 + bounds.width / 2;
-				y3 = 0;
-				x3 = x1 + bounds.width;
-				imgData1 = ctx.getImageData(x1 - 1, y1, 3, RULER_THICKNESS);
-				drawLine(x1, y1, x1, RULER_THICKNESS);
-				x1--;
-				imgData2 = ctx.getImageData(x2 - 1, y2, 3, RULER_THICKNESS);
-				drawLine(x2, y2, x2, RULER_THICKNESS);
-				x2--;
-				imgData3 = ctx.getImageData(x3 - 1, y3, 3, RULER_THICKNESS);
-				drawLine(x3, y3, x3, RULER_THICKNESS);
-				x3--;
+				var x1, y1, imgData1, x2, y2, imgData2, x3, y3, imgData3;
+				ctx.lineWidth = 0.5;
+		        ctx.strokeStyle = style.guideClr;
+		        ctx.setLineDash([2]);
+		
+		        if (isVertical)
+				{
+					y1 = bounds.y + ret.y + RULER_THICKNESS - this.graph.container.scrollTop;
+					x1 = 0;
+					y2 = y1 + bounds.height / 2;
+					x2 = RULER_THICKNESS / 2;
+					y3 = y1 + bounds.height;
+					x3 = 0;
+					imgData1 = ctx.getImageData(x1, y1 - 1, RULER_THICKNESS, 3);
+					drawLine(x1, y1, RULER_THICKNESS, y1);
+					y1--;
+					imgData2 = ctx.getImageData(x2, y2 - 1, RULER_THICKNESS, 3);
+					drawLine(x2, y2, RULER_THICKNESS, y2);
+					y2--;
+					imgData3 = ctx.getImageData(x3, y3 - 1, RULER_THICKNESS, 3);
+					drawLine(x3, y3, RULER_THICKNESS, y3);
+					y3--;
+				}
+				else
+				{
+					y1 = 0;
+					x1 = bounds.x + ret.x + RULER_THICKNESS - this.graph.container.scrollLeft;
+					y2 = RULER_THICKNESS / 2;
+					x2 = x1 + bounds.width / 2;
+					y3 = 0;
+					x3 = x1 + bounds.width;
+					imgData1 = ctx.getImageData(x1 - 1, y1, 3, RULER_THICKNESS);
+					drawLine(x1, y1, x1, RULER_THICKNESS);
+					x1--;
+					imgData2 = ctx.getImageData(x2 - 1, y2, 3, RULER_THICKNESS);
+					drawLine(x2, y2, x2, RULER_THICKNESS);
+					x2--;
+					imgData3 = ctx.getImageData(x3 - 1, y3, 3, RULER_THICKNESS);
+					drawLine(x3, y3, x3, RULER_THICKNESS);
+					x3--;
+				}
+				
+				if (ruler.guidePart == null || ruler.guidePart.x1 != x1 || ruler.guidePart.y1 != y1)
+				{
+					ruler.guidePart = { 
+						imgData1: imgData1,
+						x1: x1,
+						y1: y1,
+						imgData2: imgData2,
+						x2: x2,
+						y2: y2,
+						imgData3: imgData3,
+						x3: x3,
+						y3: y3
+					}	
+				}
 			}
-			
-			if (ruler.guidePart == null || ruler.guidePart.x1 != x1 || ruler.guidePart.y1 != y1)
+			catch (e)
 			{
-				ruler.guidePart = { 
-					imgData1: imgData1,
-					x1: x1,
-					y1: y1,
-					imgData2: imgData2,
-					x2: x2,
-					y2: y2,
-					imgData3: imgData3,
-					x3: x3,
-					y3: y3
-				}	
+				// ignore
 			}
 		}
 		else

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

@@ -1864,6 +1864,14 @@ Graph.prototype.initLayoutManager = function()
 				
 				return flowLayout;
 			}
+			else if (style['childLayout'] == 'circleLayout')
+			{
+				return new mxCircleLayout(this.graph);
+			}
+			else if (style['childLayout'] == 'organicLayout')
+			{
+				return new mxFastOrganicLayout(this.graph);
+			}
 		}
 		
 		return null;

File diff suppressed because it is too large
+ 14 - 12
src/main/webapp/js/viewer.min.js