Sfoglia il codice sorgente

7.0.5 release

Former-commit-id: 80d6f474e354a1ed4703b1d0b7d7b8a3a9e24dcb
Gaudenz Alder 8 anni fa
parent
commit
69cfec3409

+ 12 - 0
ChangeLog

@@ -1,3 +1,15 @@
+09-AUG-2017: 7.0.5
+
+- Uses mxGraph 3.7.5 beta 7
+- Fixes pen events for Chrome on Windows
+- Adds preview for clipboard in save image dialog
+- Enables drafts in Confluence Cloud add-on
+
+08-AUG-2017: 7.0.4
+
+- Improvements to Gliffy import
+- Fixes remember option for image resize dialog
+
 07-AUG-2017: 7.0.3
 
 - Adds cropping for data URIs in edit image dialog

+ 1 - 1
VERSION

@@ -1 +1 @@
-7.0.3
+7.0.5

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


+ 30 - 1
src/com/mxgraph/io/gliffy/importer/DashStyleMapping.java

@@ -1,5 +1,7 @@
 package com.mxgraph.io.gliffy.importer;
 
+import java.util.Arrays;
+
 public class DashStyleMapping
 {
 	public static String get(String value)
@@ -9,6 +11,33 @@ public class DashStyleMapping
 			return "";
 		}
 
-		return "dashed=1;dashPattern=" + value.replace(",", " ") + ";";
+		String[] pattern = value.split(",");
+		
+		try
+		{
+			for (int i = 0; i < pattern.length; i++)
+			{
+				pattern[i] = String.valueOf(Integer.parseInt(pattern[i]) * 7);
+			}
+		} 
+		catch (Exception e) 
+		{
+			// ignore
+		}
+		
+		StringBuilder mxPattern = new StringBuilder("dashed=1;dashPattern=");
+		String space = "";
+		
+		//No join in Java 7!
+		for (String p : pattern)
+		{
+			mxPattern.append(space);
+			mxPattern.append(p);
+			space = " ";
+		}
+		
+		mxPattern.append(";");
+		
+		return  mxPattern.toString();
 	}
 }

+ 1 - 1
war/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 08/07/2017 04:41 PM
+# 08/09/2017 10:14 AM
 
 app.html
 index.html?offline=1

File diff suppressed because it is too large
+ 492 - 485
war/js/app.min.js


File diff suppressed because it is too large
+ 443 - 437
war/js/atlas-viewer.min.js


File diff suppressed because it is too large
+ 631 - 624
war/js/atlas.min.js


+ 0 - 5
war/js/diagramly/App.js

@@ -862,11 +862,6 @@ App.prototype.init = function()
 						if (this.updateAd != null)
 						{
 							this.adsHtml = this.basicAds.concat([
-								'<a title="' + mxResources.get('loveIt', ['draw.io']) +
-								'" target="_blank" href="https://plus.google.com/share?url=' + encodeURIComponent('https://www.draw.io') +
-								'" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,' +
-								'left=\'+((screen.width-480)/2)+\',top=\'+((screen.height-520)/3)+\',height=520,width=480\');return false;"\'>' +
-								'<img border="0" align="absmiddle" style="margin-top:-2px;padding-right:8px;" src="images/glyphicons_google.png"/>' + mxResources.get('loveIt', ['draw.io']) + '</a>',
 								'<a title="Google Docs Add-on" href="https://chrome.google.com/webstore/detail/drawio-diagrams/clpbjldiohnnmfmkngmaohehlnfkmoea" target="_blank">' +
 								'<img border="0" align="absmiddle" style="margin-top:-4px;" src="images/glyphicons_star.png"/>&nbsp;&nbsp;Google Docs Add-on</a>',
 								'<a title="Google Chrome App" href="https://chrome.google.com/webstore/detail/drawio-desktop/pebppomjfocnoigkeepgbmcifnnlndla" target="_blank">' +

+ 37 - 2
war/js/diagramly/Dialogs.js

@@ -2936,7 +2936,7 @@ var NewDialog = function(editorUi, compact, showName, callback)
  * Constructs a dialog for creating new files from a template URL.
  */
 var CreateDialog = function(editorUi, title, createFn, cancelFn, dlgTitle, btnLabel, overrideExtension,
-		allowBrowser, allowTab, helpLink, showDeviceButton, rowLimit)
+		allowBrowser, allowTab, helpLink, showDeviceButton, rowLimit, data, mimeType, base64Encoded)
 {
 	overrideExtension = (overrideExtension != null) ? overrideExtension : true;
 	allowBrowser = (allowBrowser != null) ? allowBrowser : true;
@@ -2978,6 +2978,22 @@ var CreateDialog = function(editorUi, title, createFn, cancelFn, dlgTitle, btnLa
 	};
 
 	div.appendChild(nameInput);
+	
+	if (data != null && mimeType != null && mimeType.substring(0, 6) == 'image/')
+	{
+		nameInput.style.width = '160px';
+		
+		var preview = document.createElement('img');
+		preview.setAttribute('src', 'data:' + mimeType + ((base64Encoded) ? ';base64,': ';utf8,') + data );
+		preview.style.position = 'absolute';
+		preview.style.top = '70px';
+		preview.style.right = '100px';
+		preview.style.maxWidth = '120px';
+		preview.style.maxHeight = '80px';
+		mxUtils.setPrefixedStyle(preview.style, 'transform', 'translate(50%,-50%)');
+		div.appendChild(preview);
+	}
+	
 	mxUtils.br(div);
 	
 	var buttons = document.createElement('div');
@@ -5096,7 +5112,7 @@ var RevisionDialog = function(editorUi, revs)
 /**
  * Constructs a new revision dialog
  */
-var DraftDialog = function(editorUi, title, xml, editFn, discardFn, editLabel, discardLabel)
+var DraftDialog = function(editorUi, title, xml, editFn, discardFn, editLabel, discardLabel, ignoreFn)
 {
 	var div = document.createElement('div');
 	
@@ -5337,10 +5353,23 @@ var DraftDialog = function(editorUi, title, xml, editFn, discardFn, editLabel, d
 	});
 	
 	cancelBtn.className = 'geBtn';
+	
+	var ignoreBtn = (ignoreFn != null) ? mxUtils.button(mxResources.get('ignore'), ignoreFn) : null;
+	
+	if (ignoreBtn != null)
+	{
+		ignoreBtn.className = 'geBtn';
+	}
 
 	if (editorUi.editor.cancelFirst)
 	{
 		buttons.appendChild(cancelBtn);
+		
+		if (ignoreBtn != null)
+		{
+			buttons.appendChild(ignoreBtn);
+		}
+		
 		buttons.appendChild(restoreBtn);
 		buttons.appendChild(showBtn);
 	}
@@ -5348,6 +5377,12 @@ var DraftDialog = function(editorUi, title, xml, editFn, discardFn, editLabel, d
 	{
 		buttons.appendChild(showBtn);
 		buttons.appendChild(restoreBtn);
+		
+		if (ignoreBtn != null)
+		{
+			buttons.appendChild(ignoreBtn);
+		}
+		
 		buttons.appendChild(cancelBtn);
 	}
 

+ 2 - 1
war/js/diagramly/DropboxClient.js

@@ -624,8 +624,9 @@ DropboxClient.prototype.saveFile = function(filename, data, success, error)
 	}
 	else
 	{
+		// Mute switch is ignored
 		var promise = this.client.filesUpload({path: '/' + filename, mode: {'.tag': 'overwrite'},
-			contents: new Blob([data], {type: 'text/plain'})});
+			contents: new Blob([data], {type: 'text/plain'}), mute: true});
 		this.executePromise(promise, success, error);
 	}
 };

+ 46 - 20
war/js/diagramly/EditorUi.js

@@ -222,8 +222,7 @@
 	 */
 	EditorUi.prototype.isOffline = function()
 	{
-		// In FF navigator.onLine is always true
-		return (mxClient.IS_FF && this.isOfflineApp()) || !navigator.onLine || urlParams['stealth'] == '1';
+		return this.isOfflineApp() || !navigator.onLine || urlParams['stealth'] == '1';
 	};
 
 	/**
@@ -2797,7 +2796,8 @@
 		}), mxUtils.bind(this, function()
 		{
 			this.hideDialog();
-		}), mxResources.get('saveAs'), mxResources.get('download'), false, allowBrowser, allowTab, null, null, (allowBrowser) ? 3 : 4);
+		}), mxResources.get('saveAs'), mxResources.get('download'), false, allowBrowser, allowTab,
+			null, null, (allowBrowser) ? 3 : 4, data, mimeType, base64Encoded);
 		this.showDialog(dlg.container, 380, (this.getServiceCount(allowBrowser) - 1 <
 			((allowBrowser) ? 4 : 5)) ? 270 : 390, true, true);
 		dlg.init();
@@ -2906,7 +2906,8 @@
 		}), mxUtils.bind(this, function()
 		{
 			this.hideDialog();
-		}), mxResources.get('saveAs'), mxResources.get('download'), false, false, allowTab, null, null, 4);
+		}), mxResources.get('saveAs'), mxResources.get('download'), false, false, allowTab,
+			null, null, 4, data, mimeType, base64Encoded);
 		this.showDialog(dlg.container, 380, (this.getServiceCount(false) - 1 < 5) ? 270 : 390, true, true);
 		dlg.init();
 	};
@@ -3767,6 +3768,8 @@
 		var cb6 = document.createElement('input');
 		cb6.style.marginTop = '16px';
 		cb6.style.marginRight = '8px';
+		cb6.style.marginLeft = '24px';
+		cb6.setAttribute('disabled', 'disabled');
 		cb6.setAttribute('type', 'checkbox');
 
 		if (cropOption)
@@ -3776,13 +3779,21 @@
 			mxUtils.br(div);
 			
 			height += 26;
+			
+			mxEvent.addListener(selection, 'change', function()
+			{
+				if (selection.checked)
+				{
+					cb6.removeAttribute('disabled');
+				}
+				else
+				{
+					cb6.setAttribute('disabled', 'disabled');
+				}
+			});
 		}
 		
-		if (graph.isSelectionEmpty())
-		{
-			cb6.setAttribute('disabled', 'disabled');
-		}
-		else
+		if (!graph.isSelectionEmpty())
 		{
 			cb6.setAttribute('checked', 'checked');
 			cb6.defaultChecked = true;
@@ -5786,17 +5797,20 @@
 	{
 		force = (force != null) ? force : false;
 		var resume = (this.spinner != null && this.spinner.pause != null) ? this.spinner.pause() : function() {};
+		var resizeImages = (isLocalStorage || mxClient.IS_CHROMEAPP) ? mxSettings.getResizeImages() : null;
 		
 		var wrapper = function(remember, resize)
 		{
-			mxSettings.setResizeImages((remember) ? resize : null);
-			mxSettings.save();
+			if (remember || force)
+			{
+				mxSettings.setResizeImages((remember) ? resize : null);
+				mxSettings.save();
+			}
+			
 			resume();
 			fn(resize);
 		};
-		
-		var resizeImages = (isLocalStorage || mxClient.IS_CHROMEAPP) ? mxSettings.getResizeImages() : null;
-		
+
 		if (resizeImages != null && !force)
 		{
 			wrapper(false, resizeImages);
@@ -7946,7 +7960,12 @@
 						this.hideDialog();
 						parent.postMessage(JSON.stringify({event: 'draft', result: 'discard', message: data}), '*');
 					}), (data.editKey) ? mxResources.get(data.editKey) : null,
-						(data.discardKey) ? mxResources.get(data.discardKey) : null);
+						(data.discardKey) ? mxResources.get(data.discardKey) : null,
+						(data.ignore) ? mxUtils.bind(this, function()
+						{
+							this.hideDialog();
+							parent.postMessage(JSON.stringify({event: 'draft', result: 'ignore', message: data}), '*');
+						}) : null);
 					this.showDialog(dlg.container, 640, 480, true, false, mxUtils.bind(this, function(cancel)
 					{
 						if (cancel)
@@ -8054,8 +8073,9 @@
 								
 								var msg = this.createLoadMessage('export');
 								msg.format = data.format;
-								msg.xml = encodeURIComponent(xml);
+								msg.message = data;
 								msg.data = uri;
+								msg.xml = encodeURIComponent(xml);
 								parent.postMessage(JSON.stringify(msg), '*');
 							});
 							
@@ -8068,12 +8088,12 @@
 								
 						   	    if (data.format == 'xmlpng')
 						   	    {
-						   	    	uri = this.writeGraphModelToPng(uri, 'zTXt', 'mxGraphModel',
-						   	    		atob(this.editor.graph.compress(xml)));	
+						   	    		uri = this.writeGraphModelToPng(uri, 'zTXt', 'mxGraphModel',
+						   	    				atob(this.editor.graph.compress(xml)));	
 						   	    }
 						   	    	
 								// Removes temporary graph from DOM
-				   	   	    	if (graph != this.editor.graph)
+						   	    if (graph != this.editor.graph)
 								{
 									graph.container.parentNode.removeChild(graph.container);
 								}
@@ -8262,8 +8282,14 @@
 							this.buttonContainer.style.paddingRight = '38px';
 							this.buttonContainer.style.paddingTop = '6px';
 						}
-						
+
+						if (this.embedFilenameSpan != null)
+						{
+							this.embedFilenameSpan.parentNode.removeChild(this.embedFilenameSpan);
+						}
+
 						this.buttonContainer.appendChild(tmp);
+						this.embedFilenameSpan = tmp;
 					}
 					
 					if (data.xmlpng != null)

File diff suppressed because it is too large
+ 87 - 82
war/js/embed-static.min.js


+ 10 - 0
war/js/mxgraph/Format.js

@@ -3270,6 +3270,16 @@ TextFormatPanel.prototype.addFont = function(container)
 								{
 									ff = ff.substring(0, ff.length - 1);
 								}
+
+								if (ff.charAt(0) == '"')
+								{
+									ff = ff.substring(1);
+								}
+								
+								if (ff.charAt(ff.length - 1) == '"')
+								{
+									ff = ff.substring(0, ff.length - 1);
+								}
 								
 								fontMenu.firstChild.nodeValue = ff;
 							}

+ 1 - 1
war/js/mxgraph/Graph.js

@@ -1250,7 +1250,7 @@ Graph.prototype.isIgnoreTerminalEvent = function(evt)
  */
 Graph.prototype.isSplitTarget = function(target, cells, evt)
 {
-	return !mxEvent.isShiftDown(evt) && mxGraph.prototype.isSplitTarget.apply(this, arguments);
+	return !mxEvent.isAltDown(evt) && !mxEvent.isShiftDown(evt) && mxGraph.prototype.isSplitTarget.apply(this, arguments);
 };
 
 /**

+ 130 - 0
war/js/mxgraph/Shapes.js

@@ -1321,6 +1321,131 @@
 	
 	mxStyleRegistry.putValue('backbonePerimeter', mxPerimeter.BackbonePerimeter);
 	
+	//Parallelogram Perimeter
+	mxPerimeter.ParallelogramPerimeter = function (bounds, vertex, next, orthogonal)
+	{
+		var size = ParallelogramShape.prototype.size;
+		
+		if (vertex != null)
+		{
+			size = mxUtils.getValue(vertex.style, 'size', size);
+		}
+		
+		var dx = bounds.width * Math.max(0, Math.min(1, size));
+		
+		if (next.y == bounds.y)
+		{
+			return new mxPoint(bounds.x + dx + (next.x - bounds.x) / bounds.width * (bounds.width - dx), next.y);
+		}
+		else if (next.y == bounds.y + bounds.height)
+		{
+			return new mxPoint(bounds.x + (next.x - bounds.x) / bounds.width * (bounds.width - dx), next.y);
+		}
+		else if (next.x == bounds.x)
+		{
+			return new mxPoint(bounds.x + dx * (1 - (next.y - bounds.y) / bounds.height), next.y);
+		}
+		else
+		{
+			return new mxPoint(bounds.x + dx * (1 - (next.y - bounds.y) / bounds.height) + (bounds.width - dx), next.y);
+		}
+	};
+	
+	mxStyleRegistry.putValue('parallelogramPerimeter', mxPerimeter.ParallelogramPerimeter);
+	
+	
+	//Trapezoid Perimeter
+	mxPerimeter.TrapezoidPerimeter = function (bounds, vertex, next, orthogonal)
+	{
+		var size = TrapezoidShape.prototype.size;
+		
+		if (vertex != null)
+		{
+			size = mxUtils.getValue(vertex.style, 'size', size);
+		}
+		
+		var dx = bounds.width * Math.max(0, Math.min(1, size));
+		
+		if (next.y == bounds.y)
+		{
+			return new mxPoint(bounds.x + dx + (next.x - bounds.x) / bounds.width * (bounds.width - 2 * dx), next.y);
+		}
+		else if (next.x == bounds.x)
+		{
+			return new mxPoint(bounds.x + dx * (1 - (next.y - bounds.y) / bounds.height), next.y);
+		}
+		else if (next.x == bounds.x + bounds.width)
+		{
+			return new mxPoint(bounds.x + bounds.width - dx * (1 - (next.y - bounds.y) / bounds.height), next.y);
+		}
+		else
+		{
+			return next;
+		}
+	};
+	
+	mxStyleRegistry.putValue('trapezoidPerimeter', mxPerimeter.TrapezoidPerimeter);
+	
+	//Step Perimeter
+	mxPerimeter.StepPerimeter = function (bounds, vertex, next, orthogonal)
+	{
+		var size = StepShape.prototype.size;
+		
+		if (vertex != null)
+		{
+			size = mxUtils.getValue(vertex.style, 'size', size);
+		}
+		
+		var dx = bounds.width * Math.max(0, Math.min(1, size));
+		
+		if (next.x == bounds.x)
+		{
+			return next.y < bounds.getCenterY() ? new mxPoint(bounds.x + 2 * dx * (next.y - bounds.y) / bounds.height, next.y)
+										: new mxPoint(bounds.x + 2 * dx * (1 - (next.y - bounds.y) / bounds.height), next.y);
+		}
+		else if (next.x == bounds.x + bounds.width)
+		{
+			return next.y < bounds.getCenterY() ? new mxPoint(bounds.x + 2 * dx * (next.y - bounds.y) / bounds.height + (bounds.width - dx), next.y)
+											: new mxPoint(bounds.x + 2 * dx * (1 - (next.y - bounds.y) / bounds.height) + (bounds.width - dx), next.y);
+		}
+		else
+		{
+			return new mxPoint(bounds.x + (next.x - bounds.x) / bounds.width * (bounds.width - dx), next.y);
+		}
+	};
+	
+	mxStyleRegistry.putValue('stepPerimeter', mxPerimeter.StepPerimeter);
+	
+	//Hexagon Perimeter (keep existing one)
+	mxPerimeter.HexagonPerimeter2 = function (bounds, vertex, next, orthogonal)
+	{
+		var size = HexagonShape.prototype.size;
+		
+		if (vertex != null)
+		{
+			size = mxUtils.getValue(vertex.style, 'size', size);
+		}
+		
+		var dx = bounds.width * Math.max(0, Math.min(1, size));
+		
+		if (next.x == bounds.x)
+		{
+			return next.y < bounds.getCenterY() ? new mxPoint(bounds.x + dx * (1 - 2 * (next.y - bounds.y) / bounds.height), next.y)
+										: new mxPoint(bounds.x + dx * (2 * (next.y - bounds.y) / bounds.height - 1), next.y);
+		}
+		else if (next.x == bounds.x + bounds.width)
+		{
+			return next.y < bounds.getCenterY() ? new mxPoint(bounds.x + 2 * dx * (next.y - bounds.y) / bounds.height + (bounds.width - dx), next.y)
+											: new mxPoint(bounds.x + 2 * dx * (1 - (next.y - bounds.y) / bounds.height) + (bounds.width - dx), next.y);
+		}
+		else
+		{
+			return new mxPoint(bounds.x + dx + (next.x - bounds.x) / bounds.width * (bounds.width - 2 * dx), next.y);
+		}
+	};
+	
+	mxStyleRegistry.putValue('hexagonPerimeter2', mxPerimeter.HexagonPerimeter2);
+	
 	// Lollipop Shape
 	function LollipopShape()
 	{
@@ -2122,6 +2247,10 @@
 	FilledEdge.prototype.origPaintEdgeShape = FilledEdge.prototype.paintEdgeShape;
 	FilledEdge.prototype.paintEdgeShape = function(c, pts, rounded)
 	{
+		//paintEdgeShape reset dashed to false
+		var dashed = c.state.dashed;
+		var fixDash = c.state.fixDash; 
+		
 		FilledEdge.prototype.origPaintEdgeShape.apply(this, arguments);
 		if (c.state.strokeWidth >= 3)
 		{
@@ -2131,6 +2260,7 @@
 			{
 				c.setStrokeColor(fillClr);
 				c.setStrokeWidth(c.state.strokeWidth - 2);
+				c.setDashed(dashed, fixDash);
 			
 				FilledEdge.prototype.origPaintEdgeShape.apply(this, arguments);		
 			}

File diff suppressed because it is too large
+ 87 - 82
war/js/reader.min.js


File diff suppressed because it is too large
+ 443 - 437
war/js/viewer.min.js