Jelajahi Sumber

10.0.7 release

Gaudenz Alder 6 tahun lalu
induk
melakukan
8b37e893ec

+ 5 - 0
ChangeLog

@@ -1,3 +1,8 @@
+21-DEC-2018: 10.0.7
+
+- Fixes checksum handling in desktop
+- Uses mxGraph 3.9.13 beta 1
+
 20-DEC-2018: 10.0.6
 
 - Performance fixes for collaborative editing

+ 1 - 1
VERSION

@@ -1 +1 @@
-10.0.6
+10.0.7

File diff ditekan karena terlalu besar
+ 4 - 4
etc/mxgraph/mxClient.js


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

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 12/20/2018 01:32 PM
+# 12/21/2018 04:07 PM
 
 app.html
 index.html?offline=1

File diff ditekan karena terlalu besar
+ 579 - 576
src/main/webapp/js/app.min.js


File diff ditekan karena terlalu besar
+ 527 - 525
src/main/webapp/js/atlas-viewer.min.js


File diff ditekan karena terlalu besar
+ 380 - 377
src/main/webapp/js/atlas.min.js


+ 70 - 27
src/main/webapp/js/diagramly/DrawioFile.js

@@ -214,9 +214,10 @@ DrawioFile.prototype.mergeFile = function(file, success, error)
 		if (shadow == null || shadow.length == 0)
 		{
 			this.sendErrorReport(
-				'Shadow is null or empty',
-				'shadowPages: ' + (this.shadowPages != null) +
-				'\nshadowData: ' + (this.shadowData != null));
+				'Shadow is null or empty in mergeFile',
+				'Shadow: ' + (shadow != null) +
+				'\nShadowPages: ' + (this.shadowPages != null) +
+				'\nShadowData: ' + (this.shadowData != null));
 		}
 	
 		// Loads new document as shadow document
@@ -248,10 +249,18 @@ DrawioFile.prototype.mergeFile = function(file, success, error)
 			
 			if (checksum != null && checksum != current)
 			{
+				var data = this.getAnonymizedXmlForPages(patchedShadow);
+				
+				if (data != null && data.length > 10000)
+				{
+					data = this.ui.editor.graph.compress(data) + '\n';
+				}
+				
 				this.stats.checksumErrors++;
 				this.checksumError(error, patches,
-					'checksum: ' + checksum +
-					'\ncurrent: ' + current);
+					'Checksum: ' + checksum +
+					'\nCurrent: ' + current +
+					'\nPatchedShadow:\n' + data);
 				
 				// Abnormal termination
 				return;
@@ -310,6 +319,39 @@ DrawioFile.prototype.mergeFile = function(file, success, error)
 	}
 };
 
+/**
+ * Adds the listener for automatically saving the diagram for local changes.
+ */
+DrawioFile.prototype.getAnonymizedXmlForPages = function(pages)
+{
+	var enc = new mxCodec(mxUtils.createXmlDocument());
+	var file = enc.document.createElement('mxfile');
+	
+	if (pages != null)
+	{
+		for (var i = 0; i < pages.length; i++)
+		{
+			var temp = this.ui.anonymizeNode(enc.encode(
+				new mxGraphModel(pages[i].root)));
+			temp.setAttribute('id', pages[i].getId());
+			
+			if (pages[i].getName() != null)
+			{
+				temp.setAttribute('name', this.ui.anonymizeString(pages[i].getName()));
+			}
+
+			if (pages[i].viewState)
+			{
+				this.ui.editor.graph.saveViewState(pages[i].viewState, temp);
+			}
+			
+			file.appendChild(temp);
+		}
+	}
+
+	return mxUtils.getPrettyXml(file);
+};
+
 /**
  * Adds the listener for automatically saving the diagram for local changes.
  */
@@ -339,21 +381,7 @@ DrawioFile.prototype.checksumError = function(error, patches, details)
 			}
 		}
 
-		var enc = new mxCodec(mxUtils.createXmlDocument());
-		var file = enc.document.createElement('mxfile');
-		
-		if (this.shadowPages != null)
-		{
-			for (var i = 0; i < this.shadowPages.length; i++)
-			{
-				var temp = this.ui.anonymizeNode(enc.encode(
-					new mxGraphModel(this.shadowPages[i].root)));
-				temp.setAttribute('id', this.shadowPages[i].getId());
-				file.appendChild(temp);
-			}
-		}
-
-		var data = mxUtils.getPrettyXml(file);
+		var data = this.getAnonymizedXmlForPages(this.shadowPages);
 		
 		if (data != null && data.length > 10000)
 		{
@@ -369,7 +397,7 @@ DrawioFile.prototype.checksumError = function(error, patches, details)
 		
 		this.sendErrorReport(
 			'Checksum Error',
-			((details != null) ? (details + '\n') : '') +
+			((details != null) ? (details + '\n\n') : '') +
 			'Data:\n' + data +
 			'\nPatches:\n' + json);
 	}
@@ -405,11 +433,10 @@ DrawioFile.prototype.sendErrorReport = function(title, details)
 		}
 		
 		var stack = new Error().stack;
-		var lf = stack.indexOf('\n');
 		
-		if (lf > 0)
+		if (stack != null)
 		{
-			stack = stack.substring(lf + 1);
+			stack = stack.split('\n').slice(3).join('\n');
 		}
 		
 		EditorUi.sendReport(title + ' ' + new Date().toISOString() + ':' +
@@ -649,11 +676,25 @@ DrawioFile.prototype.save = function(revision, success, error, unloading, overwr
 {
 	if (!this.isEditable())
 	{
-		throw new Error(mxResources.get('readOnly'));
+		if (error != null)
+		{
+			error({message: mxResources.get('readOnly')});
+		}
+		else
+		{
+			throw new Error(mxResources.get('readOnly'));
+		}
 	}
-	else if (this.invalidChecksum)
+	else if (!overwrite && this.invalidChecksum)
 	{
-		throw new Error(mxResources.get('checksum'));
+		if (error != null)
+		{
+			error({message: mxResources.get('checksum')});
+		}
+		else
+		{
+			throw new Error(mxResources.get('checksum'));
+		}
 	}
 	else
 	{
@@ -1223,6 +1264,7 @@ DrawioFile.prototype.showRefreshDialog = function(success, error)
 DrawioFile.prototype.showCopyDialog = function(success, error, overwrite)
 {
 	this.inConflictState = false;
+	this.invalidChecksum = false;
 	this.addUnsavedStatus();
 	
 	this.ui.showError(mxResources.get('externalChanges'),
@@ -1501,6 +1543,7 @@ DrawioFile.prototype.fileChanged = function()
 DrawioFile.prototype.fileSaved = function(savedData, lastDesc, success, error)
 {
 	this.inConflictState = false;
+	this.invalidChecksum = false;
 	
 	if (this.sync == null)
 	{

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

@@ -838,7 +838,16 @@ 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)
-			
+		
+		// Should never happen
+		if (this.file.shadowPages == null || this.file.shadowPages.length == 0)
+		{
+			this.file.sendErrorReport(
+				'Shadowpages is null or empty in merge',
+				'Shadow: ' + (this.file.shadowPages != null) +
+				'\nShadowData: ' + (this.file.shadowData != null));
+		}
+		
 		// Creates a patch for backup if the checksum fails
 		this.file.backupPatch = (this.file.isModified()) ?
 			this.ui.diffPages(this.file.shadowPages,
@@ -868,8 +877,8 @@ DrawioFileSync.prototype.merge = function(patches, checksum, etag, success, erro
 			{
 				this.file.stats.mergeChecksumErrors++;
 				this.file.checksumError(error, patches,
-					'checksum: ' + checksum +
-					'\ncurrent: ' + current);
+					'Checksum: ' + checksum +
+					'\nCurrent: ' + current);
 				
 				// Abnormal termination
 				return;

+ 3 - 2
src/main/webapp/js/diagramly/DriveFile.js

@@ -191,11 +191,12 @@ DriveFile.prototype.saveFile = function(title, revision, success, error, unloadi
 					this.autosaveDelay = Math.min(6000,
 						Math.max(this.saveDelay + 500,
 						DrawioFile.prototype.autosaveDelay));
-
 					this.desc = resp;
-					this.contentChanged();
+					
 					this.fileSaved(savedData, lastDesc, mxUtils.bind(this, function()
 					{
+						this.contentChanged();
+						
 						if (success != null)
 						{
 							success(resp);

+ 52 - 10
src/main/webapp/js/diagramly/EditorUi.js

@@ -984,7 +984,12 @@
 					var data = patch[EditorUi.DIFF_INSERT][i].data;
 					var doc = mxUtils.parseXml(data);
 					var clone = doc.documentElement.cloneNode(false);
-					clone.removeAttribute('name');
+					
+					if (clone.getAttribute('name') != null)
+					{
+						clone.setAttribute('name', this.anonymizeString(clone.getAttribute('name')));
+					}
+					
 					patch[EditorUi.DIFF_INSERT][i].data = mxUtils.getXml(clone);
 				}
 				catch (e)
@@ -999,8 +1004,16 @@
 			for (var pageId in patch[EditorUi.DIFF_UPDATE])
 			{
 				var diff = patch[EditorUi.DIFF_UPDATE][pageId];
-				delete diff.name;
-				delete diff.view;
+				
+				if (diff.name != null)
+				{
+					diff.name = this.anonymizeString(diff.name);
+				}
+				
+				if (diff.view != null)
+				{
+					diff.view = this.anonymizeString(diff.view);
+				}
 				
 				if (diff.cells != null)
 				{
@@ -1076,8 +1089,15 @@
 		
 		for (var i = 0; i < nodes.length; i++)
 		{
-			nodes[i].removeAttribute('value');
-			nodes[i].removeAttribute('style');
+			if (nodes[i].getAttribute('value') != null)
+			{
+				nodes[i].setAttribute('value', this.anonymizeString(nodes[i].getAttribute('value')));
+			}
+			
+			if (nodes[i].getAttribute('style') != null)
+			{
+				nodes[i].setAttribute('style', this.anonymizeString(nodes[i].getAttribute('style')));
+			}
 			
 			if (nodes[i].parentNode != null && nodes[i].parentNode.nodeName != 'root' &&
 				nodes[i].parentNode.parentNode != null)
@@ -3476,15 +3496,30 @@
 					};
 				}
 				
-				if (e.code == 404 || e.status == 404)
+				if (e.code == 404 || e.status == 404 || e.code == 403)
 				{
-					msg = mxUtils.htmlEntities(mxResources.get('fileNotFoundOrDenied'));
+					if (e.code == 403)
+					{
+						if (e.message != null)
+						{
+							msg = mxUtils.htmlEntities(e.message);
+						}
+						else
+						{
+							msg = mxUtils.htmlEntities(mxResources.get('accessDenied'));
+						}
+					}
+					else
+					{
+						msg = mxUtils.htmlEntities(mxResources.get('fileNotFoundOrDenied'));
+					}
+					
 					var id = window.location.hash;
 					
 					if (id != null && id.substring(0, 2) == '#G')
 					{
 						id = id.substring(2);
-						msg += ' <a href="https://drive.google.com/open?id=' + id + '" target="_blank">' +
+						msg += '<br><a href="https://drive.google.com/open?id=' + id + '" target="_blank">' +
 							mxUtils.htmlEntities(mxResources.get('tryOpeningViaThisPage')) + '</a>';
 					}
 				}
@@ -3526,8 +3561,11 @@
 	 */
 	EditorUi.prototype.showError = function(title, msg, btn, fn, retry, btn2, fn2, btn3, fn3, w, h, hide, onClose)
 	{
-		var dlg = new ErrorDialog(this, title, msg, btn || mxResources.get('ok'), fn, retry, btn2, fn2, hide, btn3, fn3);
-		this.showDialog(dlg.container, w || 340, h || 150, true, false, onClose);
+		var height = (msg != null && msg.length > 120) ? 180 : 150;
+		var dlg = new ErrorDialog(this, title, msg, btn || mxResources.get('ok'),
+			fn, retry, btn2, fn2, hide, btn3, fn3);
+		this.showDialog(dlg.container, w || 340, h || ((msg != null && msg.length > 120) ?
+			180 : 150), true, false, onClose);
 		dlg.init();
 	};
 	
@@ -11270,6 +11308,10 @@
 		this.actions.get('zoomIn').setEnabled(active);
 		this.actions.get('zoomOut').setEnabled(active);
 		this.actions.get('resetView').setEnabled(active);
+		
+		// Updates undo history states
+		this.actions.get('undo').setEnabled(this.canUndo() && editable);
+		this.actions.get('redo').setEnabled(this.canUndo() && editable);
 	
 		// Disables menus
 		this.menus.get('edit').setEnabled(active);

+ 11 - 7
src/main/webapp/js/diagramly/ElectronApp.js

@@ -731,14 +731,18 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 									{
 										this.savingFile = false;
 										this.isModified = prevModified;
+										var lastDesc = this.stat;
 										this.stat = stat2;
-										this.contentChanged();
-										this.fileSaved(data);
 										
-										if (success != null)
+										this.fileSaved(data, lastDesc, mxUtils.bind(this, function()
 										{
-											success();
-										}
+											this.contentChanged();
+											
+											if (success != null)
+											{
+												success();
+											}
+										}), error);
 									}
 								}));
 			        		}
@@ -834,7 +838,7 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 			this.fileObject.name = path.replace(/^.*[\\\/]/, '');
 			this.fileObject.type = 'utf-8';
 			
-			this.save(false, success, error);
+			this.save(false, success, error, null, true);
 		}
 	};
 	
@@ -1028,7 +1032,7 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 					{
 						this.handleError({message: mxResources.get('errorSavingFile')});
 					}
-	        		}));
+	        	}));
 			}
 		}), 0);
 	};

+ 3 - 2
src/main/webapp/js/diagramly/GitHubFile.js

@@ -236,10 +236,11 @@ GitHubFile.prototype.saveFile = function(title, revision, success, error, unload
 					this.meta.sha = commit.content.sha;
 					this.meta.html_url = commit.content.html_url;
 					this.meta.download_url = commit.content.download_url;
-					
-					this.contentChanged();
+
 					this.fileSaved(savedData, savedEtag, mxUtils.bind(this, function()
 					{
+						this.contentChanged();
+						
 						if (success != null)
 						{
 							success();

+ 3 - 1
src/main/webapp/js/diagramly/OneDriveFile.js

@@ -344,9 +344,11 @@ OneDriveFile.prototype.saveFile = function(title, revision, success, error, unlo
 					this.isModified = prevModified;
 					this.savingFile = false;
 					this.meta = meta;
-					this.contentChanged();
+
 					this.fileSaved(savedData, lastDesc, mxUtils.bind(this, function()
 					{
+						this.contentChanged();
+						
 						if (success != null)
 						{
 							success();

File diff ditekan karena terlalu besar
+ 4 - 4
src/main/webapp/js/embed-static.min.js


File diff ditekan karena terlalu besar
+ 4 - 4
src/main/webapp/js/reader.min.js


File diff ditekan karena terlalu besar
+ 527 - 525
src/main/webapp/js/viewer.min.js