Selaa lähdekoodia

6.0.2.7 release

Gaudenz Alder 8 vuotta sitten
vanhempi
commit
b1816f0bb9

+ 10 - 3
ChangeLog

@@ -1,3 +1,10 @@
+28-DEC-2016: 6.0.2.7
+
+- Adds dialog for selecting pages in docs add-on
+- Fixes update all for generic links in docs add-on
+- Adds open in new window, data URI import while offline
+- Adds import for Lucidchart files
+
 26-DEC-2016: 6.0.2.6
 
 - Fixes lazy loading of clients in chromeless mode
@@ -2913,7 +2920,7 @@
 - Adds edge width option in arrange panel
 - Changes replace existing diagram to open in this window
 - Fixes connection points for tee and corner shape
-- Fixes iconfinder search client for github domain
+- Fixes iconfinder search client for GitHub domain
 - Adds thumb=0 URL parameter to disable thumbnails in Drive
 - Adds autosize option in embed dialog for responsive pages
 - Adds rounded support for single- and doubleArrow vertices
@@ -4262,11 +4269,11 @@
 - Uses mxGraph 1.10.3.1
 - Fixes background color for SVG export in quirks mode
 - Enables Google image picker on Mac/iPad
-- Adds Github menu item in help menu
+- Adds GitHub menu item in help menu
 
 29-AUG-2012: 1.6.1.9
 
-- Fixes Github deployment Ant task
+- Fixes GitHub deployment Ant task
 - Fixes German Facebook button (changes to English)
 - Fixes touch-based panning for embedded diagrams
 - Uses mxGraph 1.10.3.0

+ 3 - 3
README.md

@@ -11,14 +11,14 @@ draw.io is licensed under the GPL v3.
 Development
 -----------
 
-A development guide is being started on the Github project wiki. There is a [draw.io](http://stackoverflow.com/questions/tagged/draw.io) tag on Stack Overflow currently, please make sure any questions adhere to their guidelines for question.
+A development guide is being started on the GitHub project wiki. There is a [draw.io](http://stackoverflow.com/questions/tagged/draw.io) tag on Stack Overflow currently, please make sure any questions adhere to their guidelines for question.
 
 The [mxGraph documentation](https://jgraph.github.io/mxgraph/) provides a lot of the docs for the bottom part of the stack. There is an [mxgraph tag on SO](http://stackoverflow.com/questions/tagged/mxgraph).
 
 Running
 -------
-The simplest way to run draw.io initially is to fork this project, [publish the master branch to Github pages](https://help.github.com/categories/github-pages-basics/) and the [pages sites](https://jgraph.github.io/draw.io/war/index.html) will have the full editor functionality (sans the integrations).
+The simplest way to run draw.io initially is to fork this project, [publish the master branch to GitHub pages](https://help.github.com/categories/github-pages-basics/) and the [pages sites](https://jgraph.github.io/draw.io/war/index.html) will have the full editor functionality (sans the integrations).
 
 Supported Browsers
 ------------------
-draw.io supports IE 9+, Chrome 30+, Firefox 31+, Safari versions actively patched by Apple (6.2.x, 7.1.x, 8.0.x and 9.x at time of writing), Opera 20+, Native Android browser 5.x+, the default browser in the current and previous major iOS versions (e.g. 9.x and 8.x) and Edge 20+.
+draw.io supports IE 9+, Chrome 30+, Firefox 31+, Safari versions actively patched by Apple (6.2.x, 7.1.x, 8.0.x and 9.x at time of writing), Opera 20+, Native Android browser 5.x+, the default browser in the current and previous major iOS versions (e.g. 9.x and 8.x) and Edge 20+.

+ 1 - 1
VERSION

@@ -1 +1 @@
-6.0.2.6
+6.0.2.7

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 9 - 9
etc/mxgraph/mxClient.js


+ 1 - 1
war/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 12/26/2016 11:07 AM
+# 12/28/2016 08:43 AM
 
 /app.html
 /index.html?offline=1

+ 24 - 25
war/export2.html

@@ -35,6 +35,7 @@
 			// Parses XML
 			var xmlDoc = mxUtils.parseXml(data.xml);
 			var diagrams = null;
+			var from = 0;
 			
 			// Handles mxfile
 			if (xmlDoc.documentElement.nodeName == 'mxfile')
@@ -43,15 +44,35 @@
 				
 				if (diagrams.length > 0)
 				{
-					var diagramNode = diagrams[data.from || 0];
+					from = Math.max(0, Math.min(parseInt(data.from) || from, diagrams.length - 1));
+					var diagramNode = diagrams[from];
 					
 					if (diagramNode != null)
 					{
-						// TODO: Migrate to pako
 				        xmlDoc = mxUtils.parseXml(graph.decompress(mxUtils.getTextContent(diagramNode)));
 					}
 				}
 			}
+	        
+	        /**
+			 * Implements %page% and %pagenumber% placeholders
+			 */
+			var graphGetGlobalVariable = graph.getGlobalVariable;
+			
+			graph.getGlobalVariable = function(name)
+			{
+				if (name == 'page')
+				{
+					return (diagrams == null) ? 'Page-1' :
+						(diagrams[from].getAttribute('name') || ('Page-' + (from + 1)));
+				}
+				else if (name == 'pagenumber')
+				{
+					return from + 1;
+				}
+				
+				return graphGetGlobalVariable.apply(this, arguments);
+			};
 
 			// Enables math typesetting
 			var math = xmlDoc.documentElement.getAttribute('math') == '1';
@@ -64,29 +85,7 @@
 			// Createa graph instance
 			graph.foldingEnabled = false;
 			graph.setEnabled(false);
-			
-			if (diagrams != null && diagrams.length > 0)
-			{
-				/**
-				 * Adds placeholder for %page% and %pagenumber%
-				 */
-				var graphGetGlobalVariable = graph.getGlobalVariable;
-				
-				graph.getGlobalVariable = function(name)
-				{
-					if (name == 'page')
-					{
-						return diagrams[0].getAttribute('name') || 'Page-1';
-					}
-					else if (name == 'pagenumber')
-					{
-						return 1;
-					}
-					
-					return graphGetGlobalVariable.apply(this, arguments);
-				};
-			}
-			
+
 			// Sets background image
 			var bgImg = xmlDoc.documentElement.getAttribute('backgroundImage');
 

+ 1 - 1
war/index.html

@@ -377,7 +377,7 @@
 			<td id="geFooterItem2">
 				<a title="HTML5 JavaScript Diagramming" target="_blank" href="https://github.com/jgraph/draw.io">
 					<img border="0" align="absmiddle" style="margin-top:-2px;padding-right:14px;"
-						src="images/glyphicons_github.png"/>Fork us on Github
+						src="images/glyphicons_github.png"/>Fork us on GitHub
 				</a>
 			</td>
 			<td id="geFooterItem1">

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 106 - 105
war/js/app.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 101 - 99
war/js/atlas-viewer.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 98 - 97
war/js/atlas.min.js


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

@@ -4434,61 +4434,3 @@ App.prototype.updateUserElement = function()
 		}
 	}
 };
-
-// Handles paste from lucid chart
-(function()
-{
-	var loading = false;
-	var editorUiPasteCells = EditorUi.prototype.pasteCells;
-	
-	EditorUi.prototype.pasteCells = function(evt, elt)
-	{
-		var spans = elt.getElementsByTagName('span');
-		
-		if (spans != null && spans.length > 0 && spans[0].getAttribute('data-lucid-type') ===
-			'application/vnd.lucid.chart.objects')
-		{
-			var content = spans[0].getAttribute('data-lucid-content');
-			
-			if (content != null && content.length > 0)
-			{
-				var delayed = mxUtils.bind(this, function()
-				{
-					// Checks for signature method
-					if (this.pasteLucidChart)
-					{
-						try
-						{
-							this.pasteLucidChart(JSON.parse(content))
-							mxEvent.consume(evt);
-						}
-						catch (e)
-						{
-							// ignore
-						}
-					}
-				});
-				
-				if (!this.pasteLucidChart && !loading && !this.isOffline())
-				{
-					loading = true;
-					
-					if (urlParams['dev'] == '1')
-					{
-						mxscript('/js/diagramly/Extensions.js', delayed);
-					}
-					else
-					{
-						mxscript('/js/extensions.min.js', delayed);
-					}
-				}
-				else
-				{
-					delayed();
-				}
-			}
-		}
-		
-		editorUiPasteCells.apply(this, arguments);
-	};
-})();

+ 36 - 33
war/js/diagramly/Dialogs.js

@@ -3849,44 +3849,47 @@ var CreateDialog = function(editorUi, title, createFn, cancelFn, dlgTitle, btnLa
 	var serviceSelect = document.createElement('select');
 	serviceSelect.style.marginLeft = '10px';
 
-	if (typeof window.DriveClient === 'function')
-	{
-		var googleOption = document.createElement('option');
-		googleOption.setAttribute('value', App.MODE_GOOGLE);
-		mxUtils.write(googleOption, mxResources.get('googleDrive'));
-		serviceSelect.appendChild(googleOption);
-		
-		addLogo(IMAGE_PATH + '/google-drive-logo.svg', mxResources.get('googleDrive'), App.MODE_GOOGLE, 'drive');
-	}
-
-	if (typeof window.DropboxClient === 'function')
+	if (!editorUi.isOfflineApp() && !editorUi.isOffline())
 	{
-		var dropboxOption = document.createElement('option');
-		dropboxOption.setAttribute('value', App.MODE_DROPBOX);
-		mxUtils.write(dropboxOption, mxResources.get('dropbox'));
-		serviceSelect.appendChild(dropboxOption);
-		
-		if (editorUi.mode == App.MODE_DROPBOX)
+		if (typeof window.DriveClient === 'function')
 		{
-			dropboxOption.setAttribute('selected', 'selected');
+			var googleOption = document.createElement('option');
+			googleOption.setAttribute('value', App.MODE_GOOGLE);
+			mxUtils.write(googleOption, mxResources.get('googleDrive'));
+			serviceSelect.appendChild(googleOption);
+			
+			addLogo(IMAGE_PATH + '/google-drive-logo.svg', mxResources.get('googleDrive'), App.MODE_GOOGLE, 'drive');
 		}
-		
-		addLogo(IMAGE_PATH + '/dropbox-logo.svg', mxResources.get('dropbox'), App.MODE_DROPBOX, 'dropbox');
-	}
-
-	if (typeof window.OneDriveClient === 'function')
-	{
-		var oneDriveOption = document.createElement('option');
-		oneDriveOption.setAttribute('value', App.MODE_ONEDRIVE);
-		mxUtils.write(oneDriveOption, mxResources.get('oneDrive'));
-		serviceSelect.appendChild(oneDriveOption);
-		
-		if (editorUi.mode == App.MODE_ONEDRIVE)
+	
+		if (typeof window.DropboxClient === 'function')
 		{
-			oneDriveOption.setAttribute('selected', 'selected');
+			var dropboxOption = document.createElement('option');
+			dropboxOption.setAttribute('value', App.MODE_DROPBOX);
+			mxUtils.write(dropboxOption, mxResources.get('dropbox'));
+			serviceSelect.appendChild(dropboxOption);
+			
+			if (editorUi.mode == App.MODE_DROPBOX)
+			{
+				dropboxOption.setAttribute('selected', 'selected');
+			}
+			
+			addLogo(IMAGE_PATH + '/dropbox-logo.svg', mxResources.get('dropbox'), App.MODE_DROPBOX, 'dropbox');
+		}
+	
+		if (typeof window.OneDriveClient === 'function')
+		{
+			var oneDriveOption = document.createElement('option');
+			oneDriveOption.setAttribute('value', App.MODE_ONEDRIVE);
+			mxUtils.write(oneDriveOption, mxResources.get('oneDrive'));
+			serviceSelect.appendChild(oneDriveOption);
+			
+			if (editorUi.mode == App.MODE_ONEDRIVE)
+			{
+				oneDriveOption.setAttribute('selected', 'selected');
+			}
+			
+			addLogo(IMAGE_PATH + '/onedrive-logo.svg', mxResources.get('oneDrive'), App.MODE_ONEDRIVE, 'oneDrive');
 		}
-		
-		addLogo(IMAGE_PATH + '/onedrive-logo.svg', mxResources.get('oneDrive'), App.MODE_ONEDRIVE, 'oneDrive');
 	}
 	
 	if (!Editor.useLocalStorage || urlParams['storage'] == 'device' ||

+ 208 - 172
war/js/diagramly/EditorUi.js

@@ -2478,64 +2478,58 @@
 	 */
 	EditorUi.prototype.saveLocalFile = function(data, filename, mimeType, base64Encoded)
 	{
-		if (this.isOfflineApp() || this.isOffline())
-		{
-			this.doSaveLocalFile(data, filename, mimeType, base64Encoded);
-		}
-		else
+		var allowTab = !mxClient.IS_IOS || !navigator.standalone;
+		var backends = !this.isOfflineApp() && !this.isOffline() &&
+			(typeof window.DriveClient === 'function' ||
+			typeof window.DropboxClient === 'function' ||
+			typeof window.OneDriveClient === 'function');
+		
+		var dlg = new CreateDialog(this, filename, mxUtils.bind(this, function(newTitle, mode)
 		{
-			var allowTab = !mxClient.IS_IOS || !navigator.standalone;
-			var backends = typeof window.DriveClient === 'function' ||
-						typeof window.DropboxClient === 'function' ||
-						typeof window.OneDriveClient === 'function';
-			
-			var dlg = new CreateDialog(this, filename, mxUtils.bind(this, function(newTitle, mode)
+			try
 			{
-				try
+				// Opens a new window
+				if (mode == '_blank')
 				{
-					// Opens a new window
-					if (mode == '_blank')
+					// Workaround for "Access denied" after URL.createObjectURL
+					// and blank window for window.open with data URI in MS Edge
+					// and empty window for IE 11 and 10
+					if (mxClient.IS_EDGE || document.documentMode == 11 || document.documentMode == 10)
 					{
-						// Workaround for "Access denied" after URL.createObjectURL
-						// and blank window for window.open with data URI in MS Edge
-						// and empty window for IE 11 and 10
-						if (mxClient.IS_EDGE || document.documentMode == 11 || document.documentMode == 10)
-						{
-				    		var param = (typeof(pako) === 'undefined') ? '&xml=' + encodeURIComponent(data) :
-				    			'&data=' + encodeURIComponent(this.editor.graph.compress(data));
-				    		
-				    		new mxXmlRequest(SAVE_URL, 'mime=' + mimeType + param).simulate(document, '_blank');
-						}
-						else
-						{
-							// Cannot use URL.createObjectURL since it kills gradients in FF
-							window.open('data:' + mimeType + ((base64Encoded) ? ';base64,' +
-								data : ';charset=utf8,' + encodeURIComponent(data)));
-						}
+			    		var param = (typeof(pako) === 'undefined') ? '&xml=' + encodeURIComponent(data) :
+			    			'&data=' + encodeURIComponent(this.editor.graph.compress(data));
+			    		
+			    		new mxXmlRequest(SAVE_URL, 'mime=' + mimeType + param).simulate(document, '_blank');
 					}
-					else if (mode == App.MODE_DEVICE)
-					{
-						this.doSaveLocalFile(data, newTitle, mimeType, base64Encoded);
-					} 
-					else if (newTitle != null && newTitle.length > 0)
+					else
 					{
-						this.pickFolder(mode, mxUtils.bind(this, function(folderId)
-						{
-							this.exportFile(data, newTitle, mimeType, base64Encoded, mode, folderId);
-						}));
+						// Cannot use URL.createObjectURL since it kills gradients in FF
+						window.open('data:' + mimeType + ((base64Encoded) ? ';base64,' +
+							data : ';charset=utf8,' + encodeURIComponent(data)));
 					}
 				}
-				catch (e)
+				else if (mode == App.MODE_DEVICE)
 				{
-					this.handleError(e);
+					this.doSaveLocalFile(data, newTitle, mimeType, base64Encoded);
+				} 
+				else if (newTitle != null && newTitle.length > 0)
+				{
+					this.pickFolder(mode, mxUtils.bind(this, function(folderId)
+					{
+						this.exportFile(data, newTitle, mimeType, base64Encoded, mode, folderId);
+					}));
 				}
-			}), mxUtils.bind(this, function()
+			}
+			catch (e)
 			{
-				this.hideDialog();
-			}), mxResources.get('saveAs'), mxResources.get('download'), false, false, allowTab);
-			this.showDialog(dlg.container, 380, (backends) ? 280 : 160, true, true);
-			dlg.init();
-		}
+				this.handleError(e);
+			}
+		}), mxUtils.bind(this, function()
+		{
+			this.hideDialog();
+		}), mxResources.get('saveAs'), mxResources.get('download'), false, false, allowTab);
+		this.showDialog(dlg.container, 380, (backends) ? 280 : 160, true, true);
+		dlg.init();
 	};
 
 	/**
@@ -3890,6 +3884,47 @@
 		return cells;
 	};
 
+	/**
+	 * Automatic loading for lucidchart import.
+	 */
+	EditorUi.prototype.insertLucidChart = function(g, dx, dy, crop)
+	{
+		var delayed = mxUtils.bind(this, function()
+		{
+			// Checks for signature method
+			if (this.pasteLucidChart)
+			{
+				try
+				{
+					this.pasteLucidChart(g, dx, dy, crop);
+				}
+				catch (e)
+				{
+					// ignore
+				}
+			}
+		});
+		
+		if (!this.pasteLucidChart && !this.loadingExtensions && !this.isOffline())
+		{
+			this.loadingExtensions = true;
+			
+			if (urlParams['dev'] == '1')
+			{
+				mxscript('/js/diagramly/Extensions.js', delayed);
+			}
+			else
+			{
+				mxscript('/js/extensions.min.js', delayed);
+			}
+		}
+		else
+		{
+			// Must be async for cell selection
+			window.setTimeout(delayed, 0);
+		}
+	};
+	
 	/**
 	 * Imports the given XML into the existing diagram.
 	 * TODO: Make this function asynchronous
@@ -3916,7 +3951,7 @@
 				return [];
 			}
 			// Handles special case of data URI which requires async loading for finding size
-			else if (!this.isOffline() && (asImage || text.substring(0, 5) == 'data:' || (/\.(gif|jpg|jpeg|tiff|png|svg)$/i).test(text)))
+			else if (text.substring(0, 5) == 'data:' || (!this.isOffline() && (asImage || (/\.(gif|jpg|jpeg|tiff|png|svg)$/i).test(text))))
 			{
 				var graph = this.editor.graph;
 				
@@ -4016,40 +4051,47 @@
 				}
 				else if (text.length > 0)
 				{
-					var graph = this.editor.graph;
-					var cell = null;
-					
-			    	graph.getModel().beginUpdate();
-			    	try
-			    	{
-			    		// Fires cellsInserted to apply the current style to the inserted text.
-			    		// This requires the value to be empty when the event is fired.
-						cell = graph.insertVertex(graph.getDefaultParent(), null, '',
-								graph.snap(dx), graph.snap(dy), 1, 1, 'text;' + ((html) ? 'html=1;' : ''));
-						graph.fireEvent(new mxEventObject('textInserted', 'cells', [cell]));
-						
-						// Apply value and updates the cell size to fit the text block
-						cell.value = text;
-						graph.updateCellSize(cell);
-						
-						// See http://stackoverflow.com/questions/6927719/url-regex-does-not-work-in-javascript
-						var regexp = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;
+					if (text.substring(0, 26) == '{"state":"{\\"Properties\\":')
+					{
+						this.insertLucidChart(JSON.parse(JSON.parse(text).state)['Pages']['0_0'], dx, dy, crop);
+					}
+					else
+					{
+						var graph = this.editor.graph;
+						var cell = null;
 						
-						if (regexp.test(cell.value))
-						{
-							graph.setLinkForCell(cell, cell.value);
-						}
+				    	graph.getModel().beginUpdate();
+				    	try
+				    	{
+				    		// Fires cellsInserted to apply the current style to the inserted text.
+				    		// This requires the value to be empty when the event is fired.
+							cell = graph.insertVertex(graph.getDefaultParent(), null, '',
+									graph.snap(dx), graph.snap(dy), 1, 1, 'text;' + ((html) ? 'html=1;' : ''));
+							graph.fireEvent(new mxEventObject('textInserted', 'cells', [cell]));
+							
+							// Apply value and updates the cell size to fit the text block
+							cell.value = text;
+							graph.updateCellSize(cell);
+							
+							// See http://stackoverflow.com/questions/6927719/url-regex-does-not-work-in-javascript
+							var regexp = /\b((?:[a-z][\w-]+:(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]+|\(([^\s()<>]+|(\([^\s()<>]+\)))*\))+(?:\(([^\s()<>]+|(\([^\s()<>]+\)))*\)|[^\s`!()\[\]{};:'".,<>?«»“”‘’]))/i;
+							
+							if (regexp.test(cell.value))
+							{
+								graph.setLinkForCell(cell, cell.value);
+							}
+							
+							// Adds spacing
+							cell.geometry.width += graph.gridSize;
+							cell.geometry.height += graph.gridSize;
+				    	}
+				    	finally
+				    	{
+				    		graph.getModel().endUpdate();
+				    	}
 						
-						// Adds spacing
-						cell.geometry.width += graph.gridSize;
-						cell.geometry.height += graph.gridSize;
-			    	}
-			    	finally
-			    	{
-			    		graph.getModel().endUpdate();
-			    	}
-					
-					return [cell];
+						return [cell];
+					}
 				}
 			}
 		}
@@ -4176,25 +4218,7 @@
 		}
 		else
 		{
-			if (/(\.vsdx)($|\?)/i.test(filename))
-			{
-				var vsdxModel = new mxVsdxModel();
-				vsdxModel.decode(file);
-			}
-			else
-			{
-				cells = this.insertTextAt(this.validateFileData(data), dx, dy, true);
-			}
-//			else if (String.prototype.trim)
-//			{
-//				var trimmed = data.trim();
-//				
-//				if (trimmed.substring(0, 6) == 'strict ' || trimmed.substring(0, 5) == 'graph' || trimmed.substring(0, 7) == 'digraph')
-//				{
-//					// GraphViz dot format http://www.graphviz.org/content/dot-language
-//					//var digraph = graphlibDot.read("digraph { 1; 2; 1 -> 2 [label=\"label\"] }");
-//				}
-//			}
+			cells = this.insertTextAt(this.validateFileData(data), dx, dy, true, null, crop);
 		}
 		
 		if (!async && done != null)
@@ -4541,10 +4565,6 @@
 		}
 	};
 
-	
-	
-	
-	
 	/**
 	 * Parses the file using XHR2 via the server. File can be a blob or file object.
 	 * Filename is an optional parameter for blobs (that do not have a filename).
@@ -5553,97 +5573,113 @@
 	{
 		if (!mxEvent.isConsumed(evt))
 		{
-			var graph = this.editor.graph;
-			var xml = mxUtils.trim((mxClient.IS_QUIRKS || document.documentMode == 8) ?
-				mxUtils.getTextContent(elt) : elt.textContent);
-			var compat = false;
-
-			// Workaround for junk after XML in VM
-			try
+			var spans = elt.getElementsByTagName('span');
+		
+			if (spans != null && spans.length > 0 && spans[0].getAttribute('data-lucid-type') ===
+				'application/vnd.lucid.chart.objects')
 			{
-				var idx = xml.lastIndexOf('%3E');
+				var content = spans[0].getAttribute('data-lucid-content');
 				
-				if (idx >= 0 && idx < xml.length - 3)
+				if (content != null && content.length > 0)
 				{
-					xml = xml.substring(0, idx + 3);
+					this.insertLucidChart(JSON.parse(content));
+					mxEvent.consume(evt);
 				}
 			}
-			catch (e)
-			{
-				// ignore
-			}
-			
-			// Checks for embedded XML content
-			try
+			else
 			{
-				var spans = elt.getElementsByTagName('span');
-				var tmp = (spans != null && spans.length > 0) ? 
-					mxUtils.trim(decodeURIComponent(spans[0].textContent)) :
-					decodeURIComponent(xml);
-						
-				if (this.isCompatibleString(tmp))
+				var graph = this.editor.graph;
+				var xml = mxUtils.trim((mxClient.IS_QUIRKS || document.documentMode == 8) ?
+					mxUtils.getTextContent(elt) : elt.textContent);
+				var compat = false;
+	
+				// Workaround for junk after XML in VM
+				try
 				{
-					compat = true;
-					xml = tmp;
+					var idx = xml.lastIndexOf('%3E');
+					
+					if (idx >= 0 && idx < xml.length - 3)
+					{
+						xml = xml.substring(0, idx + 3);
+					}
 				}
-			}
-			catch (e)
-			{
-				// ignore
-			}
-			
-			if (graph.lastPasteXml == xml)
-			{
-				graph.pasteCounter++;
-			}
-			else
-			{
-				graph.lastPasteXml = xml;
-				graph.pasteCounter = 0;
-			}
-			
-			var dx = graph.pasteCounter * graph.gridSize;
-			
-			if (xml != null && xml.length > 0)
-			{
-				if (compat || this.isCompatibleString(xml))
+				catch (e)
 				{
-					graph.setSelectionCells(this.importXml(xml, dx, dx));
+					// ignore
 				}
-				else
+				
+				// Checks for embedded XML content
+				try
 				{
-					var pt = graph.getInsertPoint();
-					
-					if (graph.isMouseInsertPoint())
+					var spans = elt.getElementsByTagName('span');
+					var tmp = (spans != null && spans.length > 0) ? 
+						mxUtils.trim(decodeURIComponent(spans[0].textContent)) :
+						decodeURIComponent(xml);
+							
+					if (this.isCompatibleString(tmp))
 					{
-						dx = 0;
-						
-						// No offset for insert at mouse position
-						if (graph.lastPasteXml == xml && graph.pasteCounter > 0)
-						{
-							graph.pasteCounter--;
-						}
+						compat = true;
+						xml = tmp;
 					}
-					
-					graph.setSelectionCells(this.insertTextAt(xml, pt.x + dx, pt.y + dx, true));
+				}
+				catch (e)
+				{
+					// ignore
 				}
 				
-				if (!graph.isSelectionEmpty())
+				if (graph.lastPasteXml == xml)
+				{
+					graph.pasteCounter++;
+				}
+				else
 				{
-					graph.scrollCellToVisible(graph.getSelectionCell());
+					graph.lastPasteXml = xml;
+					graph.pasteCounter = 0;
+				}
 				
-					if (this.hoverIcons != null)
+				var dx = graph.pasteCounter * graph.gridSize;
+				
+				if (xml != null && xml.length > 0)
+				{
+					if (compat || this.isCompatibleString(xml))
 					{
-						this.hoverIcons.update(graph.view.getState(graph.getSelectionCell()));
+						graph.setSelectionCells(this.importXml(xml, dx, dx));
 					}
-					
-					try
+					else
 					{
-						mxEvent.consume(evt);
+						var pt = graph.getInsertPoint();
+						
+						if (graph.isMouseInsertPoint())
+						{
+							dx = 0;
+							
+							// No offset for insert at mouse position
+							if (graph.lastPasteXml == xml && graph.pasteCounter > 0)
+							{
+								graph.pasteCounter--;
+							}
+						}
+						
+						graph.setSelectionCells(this.insertTextAt(xml, pt.x + dx, pt.y + dx, true));
 					}
-					catch (e)
+					
+					if (!graph.isSelectionEmpty())
 					{
-						// ignore event no longer exists in async handler in IE8-
+						graph.scrollCellToVisible(graph.getSelectionCell());
+					
+						if (this.hoverIcons != null)
+						{
+							this.hoverIcons.update(graph.view.getState(graph.getSelectionCell()));
+						}
+						
+						try
+						{
+							mxEvent.consume(evt);
+						}
+						catch (e)
+						{
+							// ignore event no longer exists in async handler in IE8-
+						}
 					}
 				}
 			}

+ 98 - 38
war/js/diagramly/Extensions.js

@@ -1613,12 +1613,23 @@
 		// TODO: Convert text object to HTML
 		return (text != null && text.t != null) ? text.t : '';
 	};
-
-	function updateCell(cell, obj)
+		
+	function getAction(obj)
 	{
 		if (obj.Action != null)
 		{
-			var a = obj.Action;
+			return obj.Action;
+		}
+		
+		return obj;
+	};
+		
+	function updateCell(cell, obj)
+	{
+		var a = getAction(obj);
+		
+		if (a != null)
+		{
 			var s = styleMap[a.Class];
 			
 			if (s != null)
@@ -1630,9 +1641,10 @@
 				//console.log('no mapping', a.Class);
 			}
 			
-			if (a.Properties != null)
+			var p = (a.Properties != null) ? a.Properties : a;
+			
+			if (p != null)
 			{
-				var p = obj.Action.Properties;
 				cell.value = convertText(p);
 				
 				// Converts images
@@ -1758,7 +1770,7 @@
 	
 	function createVertex(obj)
 	{
-		var p = obj.Action.Properties;
+		var p = getAction(obj).Properties;
 		var b = p.BoundingBox;
 		
 		var v = new mxCell('', new mxGeometry(Math.round(b.x * scale + dx), Math.round(b.y * scale + dy),
@@ -1777,15 +1789,17 @@
 		updateCell(e, obj);
 		
 		// Adds text labels
-		var p = obj.Action.Properties;
+		var a = getAction(obj);
+		var p = a.Properties;
+		var ta = (p != null) ? p.TextAreas : obj.TextAreas;
 		
-		if (p.TextAreas != null)
+		if (ta != null)
 		{
 			var count = 0;
 			
-			while (p.TextAreas['t' + count] != null)
+			while (ta['t' + count] != null)
 			{
-				var ta = p.TextAreas['t' + count];
+				var ta = ta['t' + count];
 				
 				var x = (parseFloat(ta.Location) - 0.5) * 2;
 				var lab = new mxCell(convertText(ta), new mxGeometry(x, 0, 0, 0), labelStyle);
@@ -1843,7 +1857,7 @@
 		}
 	};
 
-	EditorUi.prototype.pasteLucidChart = function(g)
+	EditorUi.prototype.pasteLucidChart = function(g, dx, dy, crop)
 	{
 		// Creates a new graph, inserts cells and returns XML for insert
 		var graph = this.editor.graph;
@@ -1856,32 +1870,69 @@
 			var queue = [];
 
 			// Vertices first (populates lookup table for connecting edges)
-			for (var i = 0; i < g.Objects.length; i++)
+			if (g.Blocks != null)
 			{
-				var obj = g.Objects[i];
-				
-				if (obj.IsBlock && obj.Action != null && obj.Action.Properties != null)
+				for (var key in g.Blocks)
 				{
+					var obj = g.Blocks[key];
+					obj.id = key;
 				    lookup[obj.id] = createVertex(obj);
+					queue.push(obj);
 				}
-				
-				queue.push(obj);
 			}
-			
+			else
+			{
+				for (var i = 0; i < g.Objects.length; i++)
+				{
+					var obj = g.Objects[i];
+					
+					if (obj.IsBlock && obj.Action != null && obj.Action.Properties != null)
+					{
+					    lookup[obj.id] = createVertex(obj);
+					}
+					
+					queue.push(obj);
+				}
+			}
+				
 			// Sorts all cells by ZOrder
 			queue.sort(function(a, b)
 			{
-				if (a.Action != null && a.Action.Properties != null)
+				a = getAction(a);
+				b = getAction(b);
+				
+				if (a.Properties != null)
 				{
-					if (b.Action != null && b.Action.Properties != null)
+					if (b.Properties != null)
 					{
-						return a.Action.Properties.ZOrder - b.Action.Properties.ZOrder;
+						return a.Properties.ZOrder - b.Properties.ZOrder;
 					}
 				}
 				
 				return 0;
 			});
 			
+			function addLine(obj, p)
+			{
+				var src = (p.Endpoint1.Block != null) ? lookup[p.Endpoint1.Block] : null;
+				var trg = (p.Endpoint2.Block != null) ? lookup[p.Endpoint2.Block] : null;
+				var e = createEdge(obj);
+				
+				if (src == null && p.Endpoint1 != null)
+				{
+					e.geometry.setTerminalPoint(new mxPoint(Math.round(p.Endpoint1.x * scale + dx),
+						Math.round(p.Endpoint1.y * scale + dy)), true);
+				}
+				
+				if (trg == null && p.Endpoint2 != null)
+				{
+					e.geometry.setTerminalPoint(new mxPoint(Math.round(p.Endpoint2.x * scale + dx),
+						Math.round(p.Endpoint2.y * scale + dy)), false);
+				}
+				
+				select.push(graph.addCell(e, null, null, src, trg));
+			};
+			
 			// Inserts cells in ZOrder and connects edges via lookup
 			for (var i = 0; i < queue.length; i++)
 			{
@@ -1895,23 +1946,32 @@
 				else if (obj.IsLine && obj.Action != null && obj.Action.Properties != null)
 				{
 					var p = obj.Action.Properties;
-					var src = (p.Endpoint1.Block != null) ? lookup[p.Endpoint1.Block] : null;
-					var trg = (p.Endpoint2.Block != null) ? lookup[p.Endpoint2.Block] : null;
-					var e = createEdge(obj);
-					
-					if (src == null && p.Endpoint1 != null)
-					{
-						e.geometry.setTerminalPoint(new mxPoint(Math.round(p.Endpoint1.x * scale + dx),
-							Math.round(p.Endpoint1.y * scale + dy)), true);
-					}
-					
-					if (trg == null && p.Endpoint2 != null)
-					{
-						e.geometry.setTerminalPoint(new mxPoint(Math.round(p.Endpoint2.x * scale + dx),
-							Math.round(p.Endpoint2.y * scale + dy)), false);
-					}
-					
-					select.push(graph.addCell(e, null, null, src, trg));
+					addLine(obj, p);
+				}
+			}
+			
+			if (g.Lines != null)
+			{
+				for (var key in g.Lines)
+				{
+					var obj = g.Lines[key];
+				    addLine(obj, obj);
+				}
+			}
+			
+			if (crop && dx != null && dy != null)
+			{
+				if (graph.isGridEnabled())
+				{
+					dx = graph.snap(dx);
+					dy = graph.snap(dy);
+				}
+				
+				var bounds = graph.getBoundingBoxFromGeometry(select, true);
+				
+				if (bounds != null)
+				{
+					graph.moveCells(select, dx - bounds.x, dy - bounds.y);
 				}
 			}
 

+ 1 - 0
war/js/diagramly/sidebar/Sidebar.js

@@ -580,6 +580,7 @@
 		
 		if (urlParams['createindex'] == '1')
 		{
+			mxLog.show();
 			mxLog.textarea.value = '';
 		}
 

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 10
war/js/embed-static.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 60 - 60
war/js/extensions.min.js


+ 17 - 7
war/js/mxgraph/Sidebar.js

@@ -432,19 +432,16 @@ Sidebar.prototype.addEntry = function(tags, fn)
 		// Replaces special characters
 		var tmp = tags.toLowerCase().replace(/[\/\,\(\)]/g, ' ').split(' ');
 
-		for (var i = 0; i < tmp.length; i++)
+		var doAddEntry = mxUtils.bind(this, function(tag)
 		{
-			// Replaces trailing numbers and special characters
-			tmp[i] = tmp[i].replace(/\.*\d*$/, '');
-			
-			if (tmp[i].length > 1)
+			if (tag.length > 1)
 			{
-				var entry = this.taglist[tmp[i]];
+				var entry = this.taglist[tag];
 				
 				if (entry == null)
 				{
 					entry = {entries: [], dict: new mxDictionary()};
-					this.taglist[tmp[i]] = entry;
+					this.taglist[tag] = entry;
 				}
 				
 				// Ignores duplicates
@@ -454,6 +451,19 @@ Sidebar.prototype.addEntry = function(tags, fn)
 					entry.entries.push(fn);
 				}
 			}
+		});
+		
+		for (var i = 0; i < tmp.length; i++)
+		{
+			doAddEntry(tmp[i]);
+			
+			// Adds additional entry with removed trailing numbers
+			var normalized = tmp[i].replace(/\.*\d*$/, '');
+			
+			if (normalized != tmp[i])
+			{
+				doAddEntry(normalized);
+			}
 		}
 	}
 	

Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 10 - 10
war/js/reader.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 102 - 101
war/js/viewer.min.js


Tiedoston diff-näkymää rajattu, sillä se on liian suuri
+ 601 - 767
war/search.xml