Gaudenz Alder 8 anni fa
parent
commit
d42fa49f65

+ 10 - 0
ChangeLog

@@ -1,3 +1,13 @@
+17-AUG-2017: 7.1.5
+
+- Uses mxGraph 3.7.5 beta 10
+- Fixes custom handle positions for turned shapes
+- Fixes image export for clipart in Electron App
+- Adds close in file menu for Electron/Chrome App
+- Repositions inline dialogs if window is resized
+- Removes indirection for saving PDF in Electron App
+- Adds export in library dialog for Chrome App
+
 16-AUG-2017: 7.1.4
 
 - Adds footer for Desktop Apps Facebook post

+ 1 - 1
VERSION

@@ -1 +1 @@
-7.1.4
+7.1.5

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


+ 1 - 1
war/cache.manifest

@@ -1,7 +1,7 @@
 CACHE MANIFEST
 
 # THIS FILE WAS GENERATED. DO NOT MODIFY!
-# 08/16/2017 07:47 PM
+# 08/17/2017 08:49 AM
 
 app.html
 index.html?offline=1

BIN
war/images/heart.png


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


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


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


+ 4 - 6
war/js/diagramly/App.js

@@ -754,14 +754,12 @@ App.prototype.init = function()
 	/**
 	 * Basic adds for all backends.
 	 */
-	this.basicAds = ['<a title="' + mxResources.get('loveIt', ['draw.io']) +
-		'" target="_blank" href="https://twitter.com/intent/tweet?text=' +
-		'I%20%E2%9D%A4%EF%B8%8F%20www.draw.io' +
+	this.basicAds = ['<a title="Share on Twitter" target="_blank" href="https://twitter.com/intent/tweet?text=' +
+		'www.draw.io free online diagramming' +
 		'" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,' +
 		'left=\'+((screen.width-640)/2)+\',top=\'+((screen.height-280)/3)+\',height=280,width=640\');return false;"\'>' +
-		'<img border="0" align="absmiddle" width="18" height="18" style="margin-top:-2px;padding-right:12px;" src="' +
-		Editor.tweetImage + '"/>I <img width="18" height="18" src="' + Editor.heartImage +
-		'" border="0" align="absmiddle"> draw.io</a>',
+		'<img border="0" align="absmiddle" width="18" height="18" style="margin-top:-2px;padding-right:8px;" src="' +
+		Editor.tweetImage + '"/>Share on Twitter</a>',
 		'<a title="Share on Facebook" target="_blank" href="https://www.facebook.com/sharer.php?u=' +
 		encodeURIComponent('https://www.draw.io') +
 		'" onclick="javascript:window.open(this.href, \'\', \'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,' +

+ 10 - 17
war/js/diagramly/Dialogs.js

@@ -7428,18 +7428,15 @@ var LibraryDialog = function(editorUi, name, library, initialImages, file, mode)
 		btns.appendChild(cancelBtn);
 	}
 
-	// Does not show download button, allow filename editing in Chrome Apps
-	if (!window.chrome || !chrome.app || !chrome.app.runtime)
+	var btn = mxUtils.button(mxResources.get('export'), function()
 	{
-		var btn = mxUtils.button(mxResources.get('export'), function()
-		{
 	    	var data = editorUi.createLibraryDataFromImages(images);
 	    	var filename = nameInput.value;
 	    	
-			if (!/(\.xml)$/i.test(filename))
-			{
-				filename += '.xml';
-			}
+		if (!/(\.xml)$/i.test(filename))
+		{
+			filename += '.xml';
+		}
 	    	
 	    	if (editorUi.isLocalFileSave())
 	    	{
@@ -7450,15 +7447,11 @@ var LibraryDialog = function(editorUi, name, library, initialImages, file, mode)
 	    		new mxXmlRequest(SAVE_URL, 'filename=' + encodeURIComponent(filename) +
 	    			'&format=xml&xml=' + encodeURIComponent(data)).simulate(document, '_blank');
 	    	}
-		});
-		btn.setAttribute('id', 'btnDownload');
-		btn.className = 'geBtn';
-		btns.appendChild(btn);
-	}
-	else
-	{
-		nameInput.setAttribute('disabled', 'disabled');
-	}
+	});
+	
+	btn.setAttribute('id', 'btnDownload');
+	btn.className = 'geBtn';
+	btns.appendChild(btn);
 	
 	var fileInput = document.createElement('input');
 	fileInput.setAttribute('multiple', 'multiple');

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

@@ -29,11 +29,6 @@
 	 */
 	Editor.tweetImage = IMAGE_PATH + '/tweet.png';
 
-	/**
-	 * 
-	 */
-	Editor.heartImage = IMAGE_PATH + '/heart.png';
-
 	/**
 	 * Used in the GraphViewer lightbox.
 	 */

+ 8 - 2
war/js/diagramly/EditorUi.js

@@ -2835,7 +2835,7 @@
 	 */
 	EditorUi.prototype.saveRequest = function(filename, format, fn, data, base64Encoded, mimeType)
 	{
-		var allowTab = (!mxClient.IS_IOS || !navigator.standalone) && !EditorUi.isElectronApp;
+		var allowTab = !mxClient.IS_IOS || !navigator.standalone;
 		
 		var dlg = new CreateDialog(this, filename, mxUtils.bind(this, function(newTitle, mode)
 		{
@@ -2848,7 +2848,7 @@
 				{
 					if (mode == App.MODE_DEVICE || mode == '_blank')
 					{
-						xhr.simulate(document, (!EditorUi.isElectronApp) ? '_blank' : null);
+						xhr.simulate(document, '_blank');
 					}
 					else
 					{
@@ -7729,6 +7729,11 @@
 		this.sidebarContainer.style.display = (enabled) ? '' : 'none';
 		this.hsplit.style.display = (enabled) ? '' : 'none';
 		this.editor.graph.setEnabled(enabled);
+		
+		if (this.tabContainer != null)
+		{
+			this.tabContainer.style.visibility = (enabled) ? '' : 'hidden';	
+		}
 	};
 	
 	/**
@@ -9322,6 +9327,7 @@
 		this.actions.get('publishLink').setEnabled(file != null && !file.isRestricted());
 		this.actions.get('tags').setEnabled((urlParams['embed'] == '1' &&
 			this.editor.graph.isEnabled()) || (file != null && !file.isRestricted()));
+		this.actions.get('close').setEnabled(file != null);
 		this.menus.get('publish').setEnabled(file != null && !file.isRestricted());
 		
 		var state = graph.view.getState(graph.getSelectionCell());

+ 47 - 4
war/js/diagramly/ElectronApp.js

@@ -87,7 +87,9 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 			this.addMenuItems(menu, ['new', 'open', '-', 'save', 'saveAs', '-', 'import'], parent);
 			this.addSubmenu('exportAs', menu, parent);
 			this.addSubmenu('embed', menu, parent);
-			this.addMenuItems(menu, ['-', 'newLibrary', 'openLibrary', '-', 'documentProperties', 'print'], parent);
+			this.addMenuItems(menu, ['-', 'newLibrary', 'openLibrary', '-', 'documentProperties',
+									'print', '-', 'close'], parent);
+			// LATER: Find API for application.quit
 		})));
 		
 		this.put('extras', new Menu(mxUtils.bind(this, function(menu, parent)
@@ -761,7 +763,38 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 			}
 		}
 	};
-
+	
+	EditorUi.prototype.saveLocalFile = function(data, filename, mimeType, base64Encoded, format, allowBrowser)
+	{
+		this.saveData(filename, format, data, mimeType, base64Encoded);
+	};
+	
+	EditorUi.prototype.saveRequest = function(filename, format, fn, data, base64Encoded, mimeType)
+	{
+		var xhr = fn(null, '1');
+		
+		if (xhr != null && this.spinner.spin(document.body, mxResources.get('saving')))
+		{
+			xhr.send(mxUtils.bind(this, function()
+			{
+				this.spinner.stop();
+				
+				if (xhr.getStatus() >= 200 && xhr.getStatus() <= 299)
+				{
+					this.saveData(filename, format, xhr.getText(), mimeType, true);
+				}
+				else
+				{
+					this.handleError({message: mxResources.get('errorSavingFile')});
+				}
+			}), function(resp)
+			{
+				this.spinner.stop();
+				this.handleError(resp);
+			});
+		}
+	};
+	
 	EditorUi.prototype.saveData = function(filename, format, data, mimeType, base64Encoded)
 	{
 		const electron = require('electron');
@@ -793,18 +826,28 @@ FeedbackDialog.feedbackUrl = 'https://log.draw.io/email';
 					{
 						this.handleError({message: mxResources.get('errorSavingFile')});
 					}
-	        	}));
+	        		}));
 			}
 		}), 0);
 	};
-	
+
 	EditorUi.prototype.createImageUrlConverter = function()
 	{
 		var converter = new mxUrlConverter();
 		converter.updateBaseUrl();
+		
 		return converter;
 	};
+
+	// Adds file: protocol as absolute URL for images
+	var mxUrlConverterIsRelativeUrl = mxUrlConverter.prototype.isRelativeUrl;
 	
+	mxUrlConverter.prototype.isRelativeUrl = function(url)
+	{
+		return url.substring(0, 7) !== 'file://' && mxUrlConverterIsRelativeUrl.apply(this, arguments);
+	};
+		
+	// Disables proxy for all images
 	EditorUi.prototype.isCorsEnabledForUrl = function()
 	{
 		return true;

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

@@ -229,7 +229,8 @@
 			'UMLCircleContainerBlock': 'shape=ellipse;container=1;',
 			'UMLRectangleContainerBlock': 'rounded=1;container=1;',
 //UML State/Activity			
-			'UMLOptionLoopBlock' : s + 'sysml.package;xSize=90;align=left;spacingLeft=10;overflow=fill;',
+			'UMLOptionLoopBlock' : s + 'sysml.package2;xSize=90;align=left;spacingLeft=10;overflow=fill;',
+			'UMLAlternativeBlock2' : s + 'sysml.package2;xSize=90;align=left;spacingLeft=10;overflow=fill;',
 			'UMLStartBlock' : 'shape=ellipse;fillColor=#000000;',
 			'UMLStateBlock' : 'shape=rect;rounded=1;',
 			'UMLDecisionBlock' : 'shape=rhombus;rounded=1;',

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


File diff suppressed because it is too large
+ 33 - 33
war/js/extensions.min.js


+ 39 - 0
war/js/mxgraph/Editor.js

@@ -703,6 +703,9 @@ function Dialog(editorUi, elt, w, h, modal, closable, onClose)
 	w += dx;
 	h += dx;
 	
+	var w0 = w;
+	var h0 = h;
+	
 	var dh = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
 	var left = Math.max(1, Math.round((document.body.clientWidth - w - 64) / 2));
 	var top = Math.max(1, Math.round((dh - h - editorUi.footerHeight) / 3));
@@ -791,6 +794,41 @@ function Dialog(editorUi, elt, w, h, modal, closable, onClose)
 		}));
 	}
 	
+	this.resizeListener = mxUtils.bind(this, function()
+	{
+		dh = Math.max(document.body.clientHeight, document.documentElement.clientHeight);
+		this.bg.style.height = dh + 'px';
+		
+		left = Math.max(1, Math.round((document.body.clientWidth - w - 64) / 2));
+		top = Math.max(1, Math.round((dh - h - editorUi.footerHeight) / 3));
+	
+		div.style.left = left + 'px';
+		div.style.top = top + 'px';
+		
+		w = Math.min(w0, document.body.scrollWidth - 64);
+		h = Math.min(h0, dh - 64);
+		
+		div.style.width = w + 'px';
+		div.style.height = h + 'px';
+		
+		if (h0 > dh - 64)
+		{
+			elt.style.overflowY = 'auto';
+		}
+		else
+		{
+			elt.style.overflowY = '';
+		}
+		
+		if (this.dialogImg != null)
+		{
+			this.dialogImg.style.top = (top + 14) + 'px';
+			this.dialogImg.style.left = (left + w + 38 - dx) + 'px';
+		}
+	});
+	
+	mxEvent.addListener(window, 'resize', this.resizeListener);
+
 	this.onDialogClose = onClose;
 	this.container = div;
 	
@@ -854,6 +892,7 @@ Dialog.prototype.close = function(cancel)
 		this.bg.parentNode.removeChild(this.bg);
 	}
 	
+	mxEvent.removeListener(window, 'resize', this.resizeListener);
 	this.container.parentNode.removeChild(this.container);
 };
 

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


File diff suppressed because it is too large
+ 5 - 2
war/js/shapes.min.js


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


+ 82 - 0
war/shapes/mxSysML.js

@@ -187,6 +187,88 @@ Graph.handleFactory[mxShapeSysMLPackage.prototype.cst.PACKAGE] = function(state)
 
 }
 
+//**********************************************************************************************************************************************************
+//Package2
+//**********************************************************************************************************************************************************
+/**
+* Extends mxShape.
+*/
+function mxShapeSysMLPackage2(bounds, fill, stroke, strokewidth)
+{
+	mxShape.call(this);
+	this.bounds = bounds;
+	this.fill = fill;
+	this.stroke = stroke;
+	this.strokewidth = (strokewidth != null) ? strokewidth : 1;
+};
+
+/**
+* Extends mxShape.
+*/
+mxUtils.extend(mxShapeSysMLPackage2, mxShape);
+
+mxShapeSysMLPackage2.prototype.cst = {
+		PACKAGE2 : 'mxgraph.sysml.package2',
+		LABEL_X : 'labelX'
+};
+
+/**
+* Function: paintVertexShape
+* 
+* Paints the vertex shape.
+*/
+mxShapeSysMLPackage2.prototype.paintVertexShape = function(c, x, y, w, h)
+{
+	c.translate(x, y);
+	this.background(c, x, y, w, h);
+	c.setShadow(false);
+	this.foreground(c, x, y, w, h);
+};
+
+mxShapeSysMLPackage2.prototype.background = function(c, x, y, w, h)
+{
+	c.rect(0, 0, w, h);
+	c.stroke();
+};
+
+mxShapeSysMLPackage2.prototype.foreground = function(c, x, y, w, h)
+{
+	var xSize = parseInt(mxUtils.getValue(this.style, mxShapeSysMLPackage2.prototype.cst.LABEL_X, '90'));
+	var ySize = 20;
+	
+	xSize = Math.min(xSize, w);
+	
+	if (xSize > ySize)
+	{
+		c.begin();
+		c.moveTo(0, ySize);
+		c.lineTo(xSize - ySize * 0.5, ySize);
+		c.lineTo(xSize, ySize * 0.5);
+		c.lineTo(xSize, 0);
+		c.lineTo(0, 0);
+		c.close();
+		c.fillAndStroke();
+	}
+};
+
+mxCellRenderer.registerShape(mxShapeSysMLPackage2.prototype.cst.PACKAGE2, mxShapeSysMLPackage2);
+
+Graph.handleFactory[mxShapeSysMLPackage2.prototype.cst.PACKAGE2] = function(state)
+{
+	var handles = [Graph.createHandle(state, ['labelX'], function(bounds)
+			{
+				var labelX = Math.max(0, Math.min(bounds.width, parseFloat(mxUtils.getValue(this.state.style, 'labelX', 90))));
+
+				return new mxPoint(bounds.x + labelX, bounds.y + 10);
+			}, function(bounds, pt)
+			{
+				this.state.style['labelX'] = Math.round(100 * Math.max(0, Math.min(bounds.width, pt.x - bounds.x))) / 100;
+			})];
+	
+	return handles;
+
+}
+
 //**********************************************************************************************************************************************************
 //None
 //**********************************************************************************************************************************************************