소스 검색

15.8.5 release

David Benson 3 년 전
부모
커밋
c16a42fc1c

+ 10 - 0
ChangeLog

@@ -1,3 +1,13 @@
+24-NOV-2021: 15.8.5
+
+- Removes alignment from current style
+- Handles combined row- and colspans
+- Adds Ctrl+Enter in text and data dialog https://github.com/jgraph/drawio/issues/2438
+- Removes last row and column line
+- Conf Cloud: Added custom templates preview https://github.com/jgraph/drawio/issues/2436
+- Handles resource not accessible in GitHub
+- Fixes reset of configuration, adds tooltip
+
 22-NOV-2021: 15.8.4
 
 - Fixes move of edge labels after ungroup https://github.com/jgraph/drawio/issues/2433

+ 1 - 1
VERSION

@@ -1 +1 @@
-15.8.4
+15.8.5

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 986 - 981
src/main/webapp/js/app.min.js


+ 6 - 2
src/main/webapp/js/diagramly/App.js

@@ -4983,7 +4983,11 @@ App.prototype.fileCreated = function(file, libs, replace, done, clibs)
 			}), mxUtils.bind(this, function(resp)
 			{
 				complete();
-				this.handleError(resp);
+
+				if (resp.name != 'AbortError')
+				{
+					this.handleError(resp);
+				}
 			}));
 		}
 	}
@@ -6172,7 +6176,7 @@ App.prototype.save = function(name, done)
 				}));
 			}
 			
-			file.handleFileError(err, true);
+			file.handleFileError(err, err == null || err.name != 'AbortError');
 		});
 		
 		try

+ 14 - 0
src/main/webapp/js/diagramly/Dialogs.js

@@ -3141,6 +3141,7 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
 		
 		// Shows a tooltip with the rendered template
 		var loading = false;
+		var extImg = null;
 		
 		function showTooltip(xml, x, y)
 		{
@@ -3174,6 +3175,18 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
 			if (url != null && !loading && editorUi.sidebar.currentElt != elt)
 			{
 				editorUi.sidebar.hideTooltip();
+				
+				if (extImg != null)
+				{
+					//Create a diagram with the image to use the same code
+					//Note: Without compression it doesn't work for some reason. Find out why later
+					var xml = '<mxfile><diagram id="d" name="n">' + Graph.compress('<mxGraphModel><root><mxCell id="0"/><mxCell id="1" parent="0"/>' +
+						'<mxCell id="2" value="" style="shape=image;image=' + extImg.src + ';imageAspect=1;" parent="1" vertex="1"><mxGeometry width="' + 
+						extImg.naturalWidth + '" height="' + extImg.naturalHeight + '" as="geometry" /></mxCell></root></mxGraphModel>') + '</diagram></mxfile>';
+					showTooltip(xml, mxEvent.getClientX(evt), mxEvent.getClientY(evt));
+					return;
+				}
+				
 				editorUi.sidebar.currentElt = elt;
 				loading = true;
 				
@@ -3203,6 +3216,7 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
 			img.setAttribute('alt', tooltip);
 			img.style.maxWidth = w + 'px';
 			img.style.maxHeight = h + 'px';
+			extImg = img;
 			
 			var fallbackImgUrl = imgUrl.replace('.drawio.xml', '').replace('.drawio', '').replace('.xml', '');
 			elt.appendChild(img);

+ 33 - 6
src/main/webapp/js/diagramly/GitHubClient.js

@@ -301,18 +301,45 @@ GitHubClient.prototype.executeRequest = function(req, success, error, ignoreNotF
 					try
 					{
 						var temp = JSON.parse(req.getText());
-						
-						if (temp != null && temp.errors != null && temp.errors.length > 0)
+
+						if (temp != null && temp.message == 'Resource not accessible by integration')
 						{
-							tooLarge = temp.errors[0].code == 'too_large';
+							// Pauses spinner while showing dialog
+							var resume = this.ui.spinner.pause();
+
+							this.ui.showError(mxResources.get('accessDenied'), mxResources.get('authorizationRequired'),
+								mxResources.get('help'), mxUtils.bind(this, function()
+								{
+									this.ui.openLink('https://www.diagrams.net/blog/single-repository-diagrams');
+								}), mxUtils.bind(this, function()
+								{
+									resume();
+									fn();
+								}), mxResources.get('authorize'), mxUtils.bind(this, function()
+								{
+									this.ui.openLink((window.location.hostname == 'test.draw.io') ?
+										'https://github.com/apps/diagrams-net-app-test' :
+										'https://github.com/apps/draw-io-app');
+								}), mxResources.get('cancel'), mxUtils.bind(this, function()
+								{
+									this.ui.hideDialog();
+									error({name: 'AbortError'});
+								}), 480, null, false);
+						}
+						else
+						{
+							if (temp != null && temp.errors != null && temp.errors.length > 0)
+							{
+								tooLarge = temp.errors[0].code == 'too_large';
+							}
+
+							error({message: mxResources.get((tooLarge) ? 'drawingTooLarge' : 'forbidden')});
 						}
 					}
 					catch (e)
 					{
-						// ignore
+						error({message: mxResources.get((tooLarge) ? 'drawingTooLarge' : 'forbidden')});
 					}
-					
-					error({message: mxResources.get((tooLarge) ? 'drawingTooLarge' : 'forbidden')});
 				}
 				else if (req.getStatus() === 404)
 				{

+ 8 - 7
src/main/webapp/js/diagramly/Menus.js

@@ -1033,23 +1033,24 @@
 					{
 						try
 						{
-							localStorage.removeItem(Editor.configurationKey);
-							
 							if (mxEvent.isShiftDown(evt))
 							{
+								localStorage.removeItem(Editor.settingsKey);
 								localStorage.removeItem('.drawio-config');
-								localStorage.removeItem('.mode');
 							}
-							
-							editorUi.hideDialog();
-							editorUi.alert(mxResources.get('restartForChangeRequired'));
+							else
+							{
+								localStorage.removeItem(Editor.configurationKey);
+								editorUi.hideDialog();
+								editorUi.alert(mxResources.get('restartForChangeRequired'));
+							}
 						}
 						catch (e)
 						{
 							editorUi.handleError(e);
 						}
 					});
-				}]];
+				}, 'Shift+Click to Reset Settings']];
 				
 				if (!EditorUi.isElectronApp)
 				{

+ 40 - 3
src/main/webapp/js/grapheditor/Dialogs.js

@@ -499,16 +499,22 @@ var TextareaDialog = function(editorUi, title, url, fn, cancelFn, cancelTitle, w
 	{
 		for (var i = 0; i < customButtons.length; i++)
 		{
-			(function(label, fn)
+			(function(label, fn, title)
 			{
 				var customBtn = mxUtils.button(label, function(e)
 				{
 					fn(e, nameInput);
 				});
+
+				if (title != null)
+				{
+					customBtn.setAttribute('title', title);
+				}
+
 				customBtn.className = 'geBtn';
 				
 				td.appendChild(customBtn);
-			})(customButtons[i][0], customButtons[i][1]);
+			})(customButtons[i][0], customButtons[i][1], customButtons[i][2]);
 		}
 	}
 	
@@ -521,6 +527,8 @@ var TextareaDialog = function(editorUi, title, url, fn, cancelFn, cancelTitle, w
 			cancelFn();
 		}
 	});
+
+	cancelBtn.setAttribute('title', 'Escape');
 	cancelBtn.className = 'geBtn';
 	
 	if (editorUi.editor.cancelFirst)
@@ -545,8 +553,17 @@ var TextareaDialog = function(editorUi, title, url, fn, cancelFn, cancelTitle, w
 			fn(nameInput.value);
 		});
 		
-		genericBtn.className = 'geBtn gePrimaryBtn';	
+		genericBtn.setAttribute('title', 'Ctrl+Enter');
+		genericBtn.className = 'geBtn gePrimaryBtn';
 		td.appendChild(genericBtn);
+
+		mxEvent.addListener(nameInput, 'keypress', function(e)
+		{
+			if (e.keyCode == 13 && mxEvent.isControlDown(e))
+			{
+				genericBtn.click();
+			}
+		});
 	}
 	
 	if (!editorUi.editor.cancelFirst)
@@ -1611,6 +1628,14 @@ var EditDataDialog = function(ui, cell)
 			mxUtils.alert(mxResources.get('invalidName'));
 		}
 	});
+
+	mxEvent.addListener(nameInput, 'keypress', function(e)
+	{
+		if (e.keyCode == 13 )
+		{
+			addBtn.click();
+		}
+	});
 	
 	this.init = function()
 	{
@@ -1639,6 +1664,8 @@ var EditDataDialog = function(ui, cell)
 		ui.hideDialog.apply(ui, arguments);
 	});
 	
+
+	cancelBtn.setAttribute('title', 'Escape');
 	cancelBtn.className = 'geBtn';
 	
 	var applyBtn = mxUtils.button(mxResources.get('apply'), function()
@@ -1679,7 +1706,17 @@ var EditDataDialog = function(ui, cell)
 			mxUtils.alert(e);
 		}
 	});
+
+	applyBtn.setAttribute('title', 'Ctrl+Enter');
 	applyBtn.className = 'geBtn gePrimaryBtn';
+
+	mxEvent.addListener(div, 'keypress', function(e)
+	{
+		if (e.keyCode == 13 && mxEvent.isControlDown(e))
+		{
+			applyBtn.click();
+		}
+	});
 	
 	function updateAddBtn()
 	{

+ 0 - 1
src/main/webapp/js/grapheditor/EditorUi.js

@@ -186,7 +186,6 @@ EditorUi = function(editor, container, lightbox)
 						 ['sourcePerimeterSpacing', 'targetPerimeterSpacing'],
 		                 ['strokeColor', 'strokeWidth'],
 		                 ['fillColor', 'gradientColor', 'gradientDirection'],
-		                 ['align', 'verticalAlign'],
 		                 ['opacity'],
 		                 ['html']];
 		

+ 26 - 17
src/main/webapp/js/grapheditor/Graph.js

@@ -2917,7 +2917,7 @@ Graph.prototype.initLayoutManager = function()
 {
 	this.layoutManager = new mxLayoutManager(this);
 	
-	this.layoutManager.hasLayout = function(cell, eventName)
+	this.layoutManager.hasLayout = function(cell)
 	{
 		return this.graph.getCellStyle(cell)['childLayout'] != null;
 	};
@@ -2932,7 +2932,7 @@ Graph.prototype.initLayoutManager = function()
 		if (eventName != mxEvent.BEGIN_UPDATE || this.hasLayout(parent, eventName))
 		{
 			var style = this.graph.getCellStyle(cell);
-	
+			
 			if (style['childLayout'] == 'stackLayout')
 			{
 				var stackLayout = new mxStackLayout(this.graph, true);
@@ -5864,14 +5864,13 @@ Graph.prototype.createCrossFunctionalSwimlane = function(rowCount, colCount, w,
 	var startSize = (title == null) ? 0 : 40;
 	
 	var s = 'collapsible=0;recursiveResize=0;expand=0;pointerEvents=0;';
-	tableStyle = (tableStyle != null) ? tableStyle : 'shape=table;childLayout=tableLayout;' +
-		'rowLines=0;columnLines=0;startSize=' + startSize + ';' +
+	tableStyle = (tableStyle != null) ? tableStyle : 'shape=table;childLayout=tableLayout;startSize=' + startSize + ';' +
 		((title == null) ? 'fillColor=none;' : '') + s;
 		
-	rowStyle = (rowStyle != null) ? rowStyle : 'swimlane;horizontal=0;points=[[0,0.5],[1,0.5]];' +
-		'portConstraint=eastwest;startSize=' + startSize + ';' + s;
-	firstCellStyle = (firstCellStyle != null) ? firstCellStyle : 'swimlane;connectable=0;startSize=40;' + s;
-	cellStyle = (cellStyle != null) ? cellStyle : 'swimlane;connectable=0;startSize=' +
+	rowStyle = (rowStyle != null) ? rowStyle : 'swimlane;horizontal=0;fontStyle=0;points=[[0,0.5],[1,0.5]];' +
+		'fillColor=none;strokeColor=none;portConstraint=eastwest;startSize=' + startSize + ';' + s;
+	firstCellStyle = (firstCellStyle != null) ? firstCellStyle : 'swimlane;fontStyle=0;connectable=0;fillColor=none;startSize=40;' + s;
+	cellStyle = (cellStyle != null) ? cellStyle : 'swimlane;fontStyle=0;connectable=0;fillColor=none;startSize=' +
 		((title == null) ? '40' : '0') + ';' + s;
 	
 	var table = this.createVertex(null, null, (title != null) ? title : '', 0, 0,
@@ -6005,11 +6004,6 @@ Graph.prototype.setTableRowHeight = function(row, dy, extend)
 					model.setGeometry(table, tgeo);
 				}
 			}
-			
-			if (this.layoutManager != null)
-			{
-				this.layoutManager.executeLayout(table, true);
-			}
 		}
 	}
 	finally
@@ -6099,7 +6093,7 @@ Graph.prototype.setTableColumnWidth = function(col, dx, extend)
 
 		if (this.layoutManager != null)
 		{
-			this.layoutManager.executeLayout(table, true);
+			this.layoutManager.executeLayout(table);
 		}
 	}
 	finally
@@ -6272,6 +6266,10 @@ TableLayout.prototype.layoutRow = function(row, positions, height, tw, lastCells
 			visible = false;
 			upper.rowspan--;
 		}
+		else if (upper != null && upper.rowspan == 1)
+		{
+			upper.rowspan--;
+		}
 
 		// Handles colspan
 		if (last != null && last.geo != null &&
@@ -12012,7 +12010,10 @@ if (typeof mxVertexHandler != 'undefined')
 						(mxUtils.bind(this, function(index)
 						{
 							var rowState = rows[index];
-	
+							var nextRow = (index < rows.length - 1) ? rows[index + 1] : null;
+							var ngeo = (nextRow != null) ? graph.getCellGeometry(nextRow.cell) : null;
+							var ng = (ngeo != null && ngeo.alternateBounds != null) ? ngeo.alternateBounds : ngeo;
+							
 							var shape = new mxLine(new mxRectangle(), mxConstants.NONE, 1);
 							shape.isDashed = sel.isDashed;
 							shape.svgStrokeTolerance++;
@@ -12038,18 +12039,26 @@ if (typeof mxVertexHandler != 'undefined')
 								}
 							};
 							
+							var shiftPressed = false;
+							
 							handle.setPosition = function(bounds, pt, me)
 							{
 								dy = Math.max(Graph.minTableRowHeight - bounds.height,
 									pt.y - bounds.y - bounds.height);
+								shiftPressed = mxEvent.isShiftDown(me.getEvent());
+
+								if (ng != null && shiftPressed)
+								{
+									dy = Math.min(dy, ng.height - Graph.minTableRowHeight);
+								}
 							};
 							
 							handle.execute = function(me)
 							{
 								if (dy != 0)
 								{
-									graph.setTableRowHeight(this.state.cell, dy,
-										!mxEvent.isShiftDown(me.getEvent()));
+									graph.setTableRowHeight(this.state.cell,
+										dy, !shiftPressed);
 								}
 								else if (!self.blockDelayedSelection)
 								{

+ 108 - 121
src/main/webapp/js/grapheditor/Shapes.js

@@ -133,7 +133,6 @@
 	{
 		// LATER: Split background to add striping
 		//paintTableBackground(this.state, c, x, y, w, h);
-		
 		var start = this.getTitleSize();
 		
 		if (start == 0)
@@ -174,156 +173,144 @@
 			this.paintTableForeground(c, x, y, w, h);
 		}
 	};
-	
-	TableShape.prototype.paintTableForeground = function(c, x, y, w, h)
-	{
-		var graph = this.state.view.graph;
-		var start = graph.getActualStartSize(this.state.cell);
-		var rows = graph.model.getChildCells(this.state.cell, true);
 		
-		function getCellStyles(cells)
-		{
-			var result = [];
-
-			for (var i = 0; i < cells.length; i++)
-			{
-				result.push(graph.getCurrentCellStyle(cells[i], true));
-			}
+	/**
+	 * Returns the given table as an array of arrays of cells.
+	 */
+	TableShape.prototype.getTableLines = function(x0, y0, horizontal, vertical)
+	{
+		var hl = [];
+		var vl = [];
 
-			return result;
-		};
-		
-		if (rows.length > 0)
+		if (horizontal || vertical)
 		{
-			var rowLines = mxUtils.getValue(this.state.style,
-				'rowLines', '1') != '0';
-			var columnLines = mxUtils.getValue(this.state.style,
-				'columnLines', '1') != '0';
-			var geo = graph.getCellGeometry(rows[0]);
-			var cells = graph.model.getChildCells(rows[0], true);
-			var lastRow = {y: (geo != null) ? geo.y + geo.height : 0,
-				x: 0, cells: cells, styles: getCellStyles(cells),
-				colspans: [], rowspans: []};
-			var rowData = [lastRow];
-			var colwidths = [];
-
-			// Paints row lines
-			if (rowLines)
+			var lastRow = null;
+			var graph = this.state.view.graph;
+			var rows = graph.model.getChildCells(this.state.cell, true);
+			var start = graph.getActualStartSize(this.state.cell, true);
+			x0 += start.x;
+			y0 += start.y;
+			
+			for (var i = 0; i < rows.length; i++)
 			{
-				// Initializes rowspans on first row
-				var tx = 0;
+				var cols = graph.model.getChildCells(rows[i], true);
+				start = graph.getActualStartSize(rows[i], true);
+				var lastCol = null;
+				var row = [];
 
-				for (var i = 0; i < lastRow.cells.length; i++)
+				for (var j = 0; j < cols.length; j++)
 				{
-					lastRow.rowspans[i] = parseInt(lastRow.styles[i]['rowspan'] || 1);
-					var geo = graph.getCellGeometry(cells[i]);
+					var col = {rospan: 1, colspan: 1};
+					var geo = graph.getCellGeometry(cols[j]);
+					geo = (geo.alternateBounds != null) ? geo.alternateBounds : geo;
+					col.point = new mxPoint(geo.width + (lastCol != null ? lastCol.point.x : x0 + start.x),
+						geo.height + (lastRow != null ? lastRow[0].point.y : y0 + start.y));
 
-					if (geo != null)
+					if (lastRow != null && lastRow[j] != null && lastRow[j].rowspan > 1)
 					{
-						tx += (geo.alternateBounds != null) ? geo.alternateBounds.width : geo.width;
+						col.rowspan = lastRow[j].rowspan - 1;
+						col.colspan = lastRow[j].colspan;
 					}
-
-					colwidths[i] = tx;
-				}
-
-				for (var i = 1; i < rows.length; i++)
-				{
-					geo = graph.getCellGeometry(rows[i]);
-
-					cells = graph.model.getChildCells(rows[i], true);
-					var data = {y: 0, cells: cells, styles: getCellStyles(cells),
-						colspans: [], rowspans: []};
-					rowData.push(data);
-
-					if (geo != null)
+					else
 					{
-						data.y = geo.y + geo.height;
-
-						c.begin();
-						c.moveTo(x + start.x, y + geo.y);
-						var tw = 0;
-
-						for (j = 0; j < data.cells.length; j++)
+						if (lastCol != null && lastCol.colspan > 1)
 						{
-							var rowspan = lastRow.rowspans[j];
-							data.rowspans[j] = rowspan - 1;
+							col.rowspan = lastCol.rowspan;
+							col.colspan = lastCol.colspan - 1;
+						}
+						else
+						{
+							var style = graph.getCurrentCellStyle(cols[j], true);
 
-							if (data.rowspans[j] < 1)
+							if (style != null)
 							{
-								data.rowspans[j] = parseInt(data.styles[j]['rowspan'] || 1);
-								tw = colwidths[j];
+								col.rowspan = parseInt(style['rowspan'] || 1);
+								col.colspan = parseInt(style['colspan'] || 1);
 							}
-							else
-							{
-								if (tw > 0)
-								{
-									c.lineTo(x + tw - start.width, y + geo.y);
-								}
+						}
+					}
 
-								c.moveTo(x + colwidths[j] + start.x, y + geo.y);
-								tw = 0;
-							}
+					row.push(col);
+					lastCol = col;
+
+					// Constructs horizontal lines
+					if (horizontal && i < rows.length - 1)
+					{
+						if (hl[i] == null)
+						{
+							hl[i] = [new mxPoint(x0, col.point.y)];
 						}
 
-						c.lineTo(x + w - start.width, y + geo.y);
-						c.end();
-						c.stroke();
+						if (col.rowspan > 1)
+						{
+							hl[i].push(null);
+						}
+						
+						hl[i].push(col.point);
 					}
 
-					lastRow = data;
+					// Constructs vertical lines
+					if (vertical && j < cols.length - 1)
+					{
+						if (vl[j] == null)
+						{
+							vl[j] = [new mxPoint(col.point.x, y0)];
+						}
+
+						if (col.colspan > 1)
+						{
+							vl[j].push(null);
+						}
+						
+						vl[j].push(col.point);
+					}
 				}
+
+				lastRow = row;
 			}
-			
-			// Paints column lines
-			if (columnLines)
+		}
+
+		return hl.concat(vl);
+	};
+
+	TableShape.prototype.paintTableForeground = function(c, x, y, w, h)
+	{
+		var lines = this.getTableLines(x, y,
+			mxUtils.getValue(this.state.style, 'rowLines', '1') != '0',
+			mxUtils.getValue(this.state.style, 'columnLines', '1') != '0');
+
+		for (var i = 0; i < lines.length; i++)
+		{
+			if (lines[i] != null)
 			{
-				var cols = rowData[0].cells;
-				
-				for (var i = 1; i < cols.length; i++)
+				var last = null;
+				c.begin();
+		
+				for (var j = 0; j < lines[i].length; j++)
 				{
-					geo = graph.getCellGeometry(cols[i]);
-					
-					if (geo != null)
+					var curr = lines[i][j];
+		
+					if (curr != null)
 					{
-						c.begin();
-						c.moveTo(x + geo.x + start.x, y + start.y);
-						var th = 0;
-
-						for (var j = 0; j < rowData.length; j++)
+						if (last == null)
 						{
-							var data = rowData[j];
-							var colspan = (i == 1) ? (data.styles[i - 1] != null ?
-								parseInt(data.styles[i - 1]['colspan'] || 1) : 1) :
-								rowData[j].colspans[i - 1];
-							data.colspans[i] = colspan - 1;
-
-							if (data.colspans[i] < 1)
-							{
-								data.colspans[i] = data.styles[i] != null ?
-									parseInt(data.styles[i]['colspan'] || 1 ) : 1;
-								th = data.y;
-							}
-							else
-							{
-								if (th > 0)
-								{
-									c.lineTo(x + geo.x + start.x, y + th - start.height);
-								}
-
-								c.moveTo(x + geo.x + start.x, y + data.y);
-								th = 0;
-							}
+							c.moveTo(curr.x, curr.y);
+						}
+						else if (last != null)
+						{
+							c.lineTo(curr.x, curr.y);
 						}
-
-						c.lineTo(x + geo.x + start.x, y + h - start.height);
-						c.end();
-						c.stroke();
 					}
+		
+					last = curr;
 				}
+		
+				c.end();
+				c.stroke();
 			}
 		}
-	};
-	
+	}
+
 	mxCellRenderer.registerShape('table', TableShape);
 	
 	// Cube Shape, supports size style

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 549 - 550
src/main/webapp/js/viewer-static.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 549 - 550
src/main/webapp/js/viewer.min.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 3 - 3
src/main/webapp/mxgraph/mxClient.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
src/main/webapp/service-worker.js


파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 1 - 1
src/main/webapp/service-worker.js.map