瀏覽代碼

10.1.2 release

Former-commit-id: a121c48149ca8ae2e161dc92395ecd35d24c43fe
Gaudenz Alder 6 年之前
父節點
當前提交
5baee81c7a

+ 8 - 0
ChangeLog

@@ -1,3 +1,11 @@
+18-JAN-2019: 10.1.2
+
+- Adds debug output
+
+18-JAN-2019: 10.1.1
+
+- Fixes possible NPEs
+
 17-JAN-2019: 10.1.0
 
 - Adds auth token refresh for OneDrive

+ 1 - 1
VERSION

@@ -1 +1 @@
-10.1.0
+10.1.2

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

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 01/17/2019 04:16 PM
+# 01/18/2019 11:34 AM
 
 app.html
 index.html?offline=1

文件差異過大導致無法顯示
+ 314 - 316
src/main/webapp/js/app.min.js


文件差異過大導致無法顯示
+ 405 - 408
src/main/webapp/js/atlas-viewer.min.js


文件差異過大導致無法顯示
+ 574 - 576
src/main/webapp/js/atlas.min.js


+ 38 - 21
src/main/webapp/js/diagramly/Dialogs.js

@@ -2902,7 +2902,7 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
 				}
 				else if (list.length == 0)
 				{
-					div.innerHTML = mxResources.get('noDiagrams', null, 'No Diagrams Found');
+					div.innerHTML = mxUtils.htmlEntities(mxResources.get('noDiagrams', null, 'No Diagrams Found'));
 				}
 				else
 				{
@@ -2936,7 +2936,7 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
 		{
 			var searchTab = document.createElement('span');
 			searchTab.style.marginLeft = '10px';
-			searchTab.innerHTML = mxResources.get('search') + ":";
+			searchTab.innerHTML = mxUtils.htmlEntities(mxResources.get('search') + ':');
 			tabs.appendChild(searchTab);
 
 			var searchInput = document.createElement('input');
@@ -5492,10 +5492,19 @@ var RevisionDialog = function(editorUi, revs, restoreFn)
 								
 								pageSelectFunction = function()
 								{
-									currentPage = parseInt(pageSelect.value);
-									realPage = currentPage;
-									parseDiagram(diagrams[currentPage]);
-								}
+									try
+									{
+										var temp = parseInt(pageSelect.value);
+										parseDiagram(diagrams[temp]);
+										currentPage = temp;
+										realPage = currentPage;
+									}
+									catch (e)
+									{
+										pageSelect.value = currentPage;
+										editorUi.handleError(e);
+									}
+								};
 							}
 							else
 							{
@@ -5564,7 +5573,7 @@ var RevisionDialog = function(editorUi, revs, restoreFn)
 							currentXml = null;
 
 							fileInfo.removeAttribute('title');
-							fileInfo.innerHTML = mxResources.get('loading') + '...';
+							fileInfo.innerHTML = mxUtils.htmlEntities(mxResources.get('loading') + '...');
 							container.style.backgroundColor = '#ffffff';
 							graph.getModel().clear();
 	
@@ -5589,7 +5598,15 @@ var RevisionDialog = function(editorUi, revs, restoreFn)
 				   			{
 								if (currentRev == item)
 								{
-									updateGraph(xml);
+									try
+									{
+										updateGraph(xml);
+									}
+									catch (e)
+									{
+										fileInfo.innerHTML = mxUtils.htmlEntities(
+											mxResources.get('error') + ': ' + e.message);
+									}
 								}
 				   			}, function(err)
 				   			{
@@ -6932,7 +6949,7 @@ var PluginsDialog = function(editorUi)
 	{
 		if (plugins.length == 0)
 		{
-			inner.innerHTML = mxResources.get('noPlugins');
+			inner.innerHTML = mxUtils.htmlEntities(mxResources.get('noPlugins'));
 		}
 		else
 		{
@@ -8910,11 +8927,11 @@ TemplatesDialog.prototype.init = function(editorUi, callback, cancelCallback,
 		{
 			if (isTemplate)
 			{
-				createBtn.innerHTML = mxResources.get('create');
+				createBtn.innerHTML = mxUtils.htmlEntities(mxResources.get('create'));
 			}
 			else
 			{
-				createBtn.innerHTML = mxResources.get('copy');
+				createBtn.innerHTML = mxUtils.htmlEntities(mxResources.get('copy'));
 			}
 			
 			showLinkToDiagram (!isTemplate);
@@ -8933,15 +8950,15 @@ TemplatesDialog.prototype.init = function(editorUi, callback, cancelCallback,
 			var hrow = document.createElement('tr');
 			var th = document.createElement('th');
 			th.style.width = "50%";
-			th.innerHTML = mxResources.get('diagram', null, 'Diagram');
+			th.innerHTML = mxUtils.htmlEntities(mxResources.get('diagram', null, 'Diagram'));
 			hrow.appendChild(th);
 			th = document.createElement('th');
 			th.style.width = "25%";
-			th.innerHTML = mxResources.get('changedBy', null, 'Changed By');
+			th.innerHTML = mxUtils.htmlEntities(mxResources.get('changedBy', null, 'Changed By'));
 			hrow.appendChild(th);
 			th = document.createElement('th');
 			th.style.width = "25%";
-			th.innerHTML = mxResources.get('lastModifiedOn', null, 'Last modified on');
+			th.innerHTML = mxUtils.htmlEntities(mxResources.get('lastModifiedOn', null, 'Last modified on'));
 			hrow.appendChild(th);
 			grid.appendChild(hrow);
 			diagramsTiles.appendChild(grid);
@@ -9117,7 +9134,7 @@ TemplatesDialog.prototype.init = function(editorUi, callback, cancelCallback,
 
 			if (currentItem == null)
 			{
-				createBtn.innerHTML = mxResources.get('create');
+				createBtn.innerHTML = mxUtils.htmlEntities(mxResources.get('create'));
 				showLinkToDiagram();
 				swapActiveItem(entry, "geTempDlgNewDiagramCatItemActive", cat);
 			}
@@ -9142,7 +9159,7 @@ TemplatesDialog.prototype.init = function(editorUi, callback, cancelCallback,
 				{
 					if (currentItem != entry2)
 					{
-						createBtn.innerHTML = mxResources.get('create');
+						createBtn.innerHTML = mxUtils.htmlEntities(mxResources.get('create'));
 						showLinkToDiagram();
 						swapActiveItem(entry2, "geTempDlgNewDiagramCatItemActive", cat2);
 					}
@@ -9161,14 +9178,14 @@ TemplatesDialog.prototype.init = function(editorUi, callback, cancelCallback,
 		{
 			newDiagramCat.style.height = "280px";
 			newDiagramCatList.style.height = "190px";
-			showAllBtn.innerHTML = mxResources.get('showAll', null, '+ Show all');
+			showAllBtn.innerHTML = mxUtils.htmlEntities(mxResources.get('showAll', null, '+ Show all'));
 			fillNewDiagramCats(newDiagramCats);
 		}
 		else 
 		{
 			newDiagramCat.style.height = "440px";
 			newDiagramCatList.style.height = "355px";
-			showAllBtn.innerHTML = mxResources.get('showLess', null, '- Show less');
+			showAllBtn.innerHTML = mxUtils.htmlEntities(mxResources.get('showLess', null, '- Show less'));
 			fillNewDiagramCats(newDiagramCats, true);
 		}
 
@@ -9335,7 +9352,7 @@ TemplatesDialog.prototype.init = function(editorUi, callback, cancelCallback,
 		}
 		else if (list.length == 0)
 		{
-			diagramsTiles.innerHTML = mxResources.get('noDiagrams', null, 'No Diagrams Found');
+			diagramsTiles.innerHTML = mxUtils.htmlEntities(mxResources.get('noDiagrams', null, 'No Diagrams Found'));
 		}
 		else
 		{
@@ -9352,7 +9369,7 @@ TemplatesDialog.prototype.init = function(editorUi, callback, cancelCallback,
 			spinner.spin(diagramsTiles);
 			cancelPendingCall = false;
 			callInitiated = true;
-			diagramsListTitle.innerHTML = mxResources.get('recentDiag', null, 'Recent Diagrams');
+			diagramsListTitle.innerHTML = mxUtils.htmlEntities(mxResources.get('recentDiag', null, 'Recent Diagrams'));
 			lastSearchStr = null;
 			recentDocsCallback(extDiagramsCallback, getAll? null : username);
 		}
@@ -9371,7 +9388,7 @@ TemplatesDialog.prototype.init = function(editorUi, callback, cancelCallback,
 		cancelPendingCall = false;
 		callInitiated = true;
 		delayTimer = null;
-		diagramsListTitle.innerHTML = mxResources.get('searchResults', null, 'Search Results') + 
+		diagramsListTitle.innerHTML = mxUtils.htmlEntities(mxResources.get('searchResults', null, 'Search Results')) + 
 								' "' + mxUtils.htmlEntities(searchStr) + '"';
 		searchDocsCallback(searchStr, extDiagramsCallback, isGetAll? null : username);
 		lastSearchStr = searchStr;

+ 15 - 3
src/main/webapp/js/diagramly/DiffSync.js

@@ -604,10 +604,22 @@ EditorUi.prototype.getPagesForNode = function(node, nodeName)
 	var diagrams = node.getElementsByTagName(nodeName || 'diagram');
 	var pages = [];
 	
-	for (var i = 0; i < diagrams.length; i++)
+	if (diagrams.length > 0)
 	{
-		var page = new DiagramPage(diagrams[i]);
-		this.updatePageRoot(page);
+		for (var i = 0; i < diagrams.length; i++)
+		{
+			var page = new DiagramPage(diagrams[i]);
+			this.updatePageRoot(page);
+			pages.push(page);
+		}
+	}
+	else if (node.nodeName == 'mxGraphModel')
+	{
+		var graph = this.editor.graph;
+		var page = new DiagramPage(node.ownerDocument.createElement('diagram'));
+		page.setName(mxResources.get('pageWithNumber', [1]));
+		mxUtils.setTextContent(page.node, graph.compress(
+			graph.zapGremlins(mxUtils.getXml(node))));
 		pages.push(page);
 	}
 	

+ 4 - 47
src/main/webapp/js/diagramly/DrawioFile.js

@@ -28,7 +28,7 @@ DrawioFile = function(ui, data)
 		lastMerge: 0, /* details of the last successful merge */
 		lastMergeTime: 0, /* timestamp of the last call to merge */
 		lastOpenTime: 0, /* timestamp of the last call to open */
-		lastIgnored: 0, /* timestamp of the last ignored mergeFile */
+		emptyPrefix: false, /* timestamp of the last call to open */
 		shadowState: 0, /* current etag hash for shadow */
 		opened: 0, /* number of calls to open */
 		closed: 0, /* number of calls to close */
@@ -243,7 +243,6 @@ DrawioFile.prototype.mergeFile = function(file, success, error, diffShadow)
 		var shadow = (this.shadowPages != null) ? this.shadowPages :
 			this.ui.getPagesForNode(mxUtils.parseXml(
 			this.shadowData).documentElement);
-		this.checkPages(shadow, 'mergeFile init');
 	
 		// Loads new document as shadow document
 		var pages = this.ui.getPagesForNode(
@@ -268,7 +267,6 @@ DrawioFile.prototype.mergeFile = function(file, success, error, diffShadow)
 				// Patching previous shadow to verify checksum
 				var patched = this.ui.patchPages(shadow, patches[0]);
 				this.stats.shadowState = this.ui.hashValue(file.getCurrentEtag());
-				this.checkPages(patched, 'mergeFile patched');
 				
 				var patchedDetails = {};
 				var checksum = this.ui.getHashValueForPages(patched, patchedDetails);
@@ -304,7 +302,6 @@ DrawioFile.prototype.mergeFile = function(file, success, error, diffShadow)
 					this.patch(patches,
 						(DrawioFile.LAST_WRITE_WINS) ?
 						this.backupPatch : null);
-					this.checkPages(this.ui.pages, 'mergeFile done');
 				}
 			}
 			else
@@ -314,23 +311,7 @@ DrawioFile.prototype.mergeFile = function(file, success, error, diffShadow)
 		}
 		else
 		{
-			try
-			{
-				// Report only once per session
-				if (this.stats.lastIgnored == 0)
-				{
-					this.sendErrorReport('Ignored empty pages in mergeFile',
-						'File Data: ' + this.compressReportData(
-						this.ui.anonymizeString(file.data),
-						null, 500));
-				}
-				
-				this.stats.lastIgnored = new Date().toISOString();
-			}
-			catch (e2)
-			{
-				// ignore
-			}
+			throw new Error(mxResources.get('notADiagramFile'));
 		}
 	
 		this.invalidChecksum = false;
@@ -399,29 +380,6 @@ DrawioFile.prototype.getAnonymizedXmlForPages = function(pages)
 	return mxUtils.getPrettyXml(file);
 };
 
-/**
- * Checks if the given shadow is valid.
- */
-DrawioFile.prototype.checkPages = function(pages, info)
-{
-	if (this.ui.getCurrentFile() == this && (pages == null || pages.length == 0))
-	{
-		var data = (this.shadowData == null) ? 'null' :
-			this.compressReportData(
-			this.ui.anonymizeString(
-			this.shadowData),
-			null, 5000);
-		
-		this.sendErrorReport(
-			'Pages is null or empty',
-			'Shadow: ' + ((pages != null) ? pages.length : 'null') +
-			'\nShadowPages: ' + ((this.shadowPages != null) ?
-				this.shadowPages.length : 'null') +
-			((info != null) ? ('\nInfo: ' + info) : '') +
-			'\nShadowData: ' + data);
-	}
-};
-
 /**
  * Adds the listener for automatically saving the diagram for local changes.
  */
@@ -1683,8 +1641,7 @@ DrawioFile.prototype.fileSaved = function(savedData, lastDesc, success, error)
 		this.stats.fileSaved++;
 		this.inConflictState = false;
 		this.invalidChecksum = false;
-		this.checkPages(this.ui.pages, 'fileSaved');
-		
+
 		if (this.sync == null)
 		{
 			this.shadowData = savedData;
@@ -1717,7 +1674,7 @@ DrawioFile.prototype.fileSaved = function(savedData, lastDesc, success, error)
 		{
 			this.sendErrorReport('Error in fileSaved',
 				'Saved Data:\n' + this.compressReportData(
-				this.ui.anonymizeString(savedData), null, 500), e);
+				this.ui.anonymizeString(savedData), null, 1000), e);
 		}
 		catch (e2)
 		{

+ 3 - 4
src/main/webapp/js/diagramly/DrawioFileSync.js

@@ -914,8 +914,7 @@ DrawioFileSync.prototype.merge = function(patches, checksum, etag, success, erro
 		this.file.shadowPages = (this.file.shadowPages != null) ?
 			this.file.shadowPages : this.ui.getPagesForNode(
 			mxUtils.parseXml(this.file.shadowData).documentElement)
-		this.file.checkPages(this.file.shadowPages, 'merge init');
-		
+
 		// Creates a patch for backup if the checksum fails
 		this.file.backupPatch = (this.file.isModified()) ?
 			this.ui.diffPages(this.file.shadowPages,
@@ -930,7 +929,6 @@ DrawioFileSync.prototype.merge = function(patches, checksum, etag, success, erro
 			}
 			
 			this.file.stats.shadowState = this.ui.hashValue(etag);
-			this.file.checkPages(this.file.shadowPages, 'merge patched');
 			var currentDetails = {};
 			var current = (checksum != null) ? this.ui.getHashValueForPages(
 				this.file.shadowPages, currentDetails) : null;
@@ -992,7 +990,6 @@ DrawioFileSync.prototype.merge = function(patches, checksum, etag, success, erro
 		this.file.inConflictState = false;
 		this.file.setCurrentEtag(etag);
 		this.file.backupPatch = null;
-		this.file.checkPages(this.ui.pages, 'merge done');
 		
 		if (success != null)
 		{
@@ -1143,6 +1140,8 @@ DrawioFileSync.prototype.fileSaved = function(pages, lastDesc, success, error)
 	}
 	
 	this.file.shadowPages = pages;
+	this.file.stats.emptyPrefix = this.file.stats.emptyPrefix ||
+		this.ui.editor.graph.model.prefix.length == 0;
 	
 	if (success != null)
 	{

+ 41 - 27
src/main/webapp/js/diagramly/Menus.js

@@ -980,6 +980,7 @@
 							if (newValue.charAt(0) != '<')
 							{
 								newValue = graph.decompress(newValue);
+								mxLog.debug('See console for uncompressed XML');
 								console.log('xml', newValue);
 							}
 							
@@ -988,42 +989,55 @@
 							
 							if (pages != null && pages.length > 0)
 							{
-								var checksum = editorUi.getHashValueForPages(pages);
-								console.log('checksum', pages, checksum);
+								try
+								{
+									var checksum = editorUi.getHashValueForPages(pages);
+									mxLog.debug('Checksum: ', checksum);
+								}
+								catch (e)
+								{
+									mxLog.debug('Error: ', e.message);
+								}
 							}
 							else
 							{
-								// Checks for duplicates
-								var all = doc.getElementsByTagName('*');
-								var allIds = {};
-								var dups = {};
+								mxLog.debug('No pages found for checksum');
+							}
+
+							// Checks for duplicates
+							var all = doc.getElementsByTagName('*');
+							var allIds = {};
+							var dups = {};
+							
+							for (var i = 0; i < all.length; i++)
+							{
+								var el = all[i];
 								
-								for (var i = 0; i < all.length; i++)
+								if (el.id != null && el.id.length > 0)
 								{
-									var el = all[i];
-									
-									if (el.id != null)
+									if (allIds[el.id] == null)
 									{
-										if (allIds[el.id] == null)
-										{
-											allIds[el.id] = el.id;
-										}
-										else
-										{
-											dups[el.id] = el.id;
-										}
+										allIds[el.id] = el.id;
+									}
+									else
+									{
+										dups[el.id] = el.id;
 									}
-								}
-								
-								if (Object.keys(dups).length > 0)
-								{
-									console.log('duplicates', dups);
-								}
-								else
-								{
-									console.log('no duplicates');
 								}
 							}
+							
+							if (Object.keys(dups).length > 0)
+							{
+								var log = Object.keys(dups).length + ' Duplicates: ' + Object.keys(dups).join(', ');
+								mxLog.debug(log + ' (see console)');
+								console.log(log);
+							}
+							else
+							{
+								mxLog.debug('No duplicates');
+							}
+							
+							mxLog.show();
 						}
 						catch (e)
 						{

+ 2 - 2
src/main/webapp/js/diagramly/OneDriveClient.js

@@ -28,7 +28,7 @@ mxUtils.extend(OneDriveClient, DrawioClient);
  * existing thumbnail with the placeholder only once.
  */
 OneDriveClient.prototype.clientId = (window.location.hostname == 'test.draw.io') ?
-		'c36dee60-2c6d-4b5f-b552-a7d21798ea52' : '45c10911-200f-4e27-a666-9e9fca147395';
+	'2e598409-107f-4b59-89ca-d7723c8e00a4' : '45c10911-200f-4e27-a666-9e9fca147395';
 
 /**
  * OAuth 2.0 scopes for installing Drive Apps.
@@ -746,7 +746,7 @@ OneDriveClient.prototype.writeFile = function(url, data, method, contentType, su
 			var timeoutThread = window.setTimeout(mxUtils.bind(this, function()
 			{
 				acceptResponse = false;
-				error({code: App.ERROR_TIMEOUT, retry: fn});
+				error({code: App.ERROR_TIMEOUT, retry: doExecute});
 			}), this.ui.timeout);
 
 			var req = new mxXmlRequest(url, data, method);

文件差異過大導致無法顯示
+ 1 - 1
src/main/webapp/js/embed-static.min.js


文件差異過大導致無法顯示
+ 1 - 1
src/main/webapp/js/reader.min.js


文件差異過大導致無法顯示
+ 405 - 408
src/main/webapp/js/viewer.min.js


+ 6 - 0
src/main/webapp/plugins/trello.js

@@ -3,6 +3,12 @@
  */
 Draw.loadPlugin(function(editorUi)
 {
+	// Trello plugin only works in embed mode
+	if (editorUi.actions.get('exit') == null)
+	{
+		return;
+	}
+	
 	// Overridden to redirect modified check to file
 	editorUi.actions.get('exit').funct = function()
 	{