David Benson [draw.io] 4 gadi atpakaļ
vecāks
revīzija
d0e7590a97

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+02-SEP-2021: 15.0.6
+
+- Fixes NPE for PDF export with single page https://github.com/jgraph/drawio/issues/2221
+- Fixes padding for buttons in CustomDialog
+- Adds zoomWheel config option https://github.com/jgraph/drawio-desktop/issues/175
+
 01-SEP-2021: 15.0.5
 
 - Adds hover handler for blue arrows

+ 1 - 1
VERSION

@@ -1 +1 @@
-15.0.5
+15.0.6

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 681 - 679
src/main/webapp/js/app.min.js


+ 28 - 13
src/main/webapp/js/diagramly/Dialogs.js

@@ -1545,21 +1545,36 @@ var BackgroundImageDialog = function(editorUi, applyFn, img)
 	var pageSelect = document.createElement('select');
 	pageSelect.style.width = '320px';
 
-	for (var i = 0; i < editorUi.pages.length; i++)
+	if (editorUi.pages != null)
 	{
-		var pageOption = document.createElement('option');
-		mxUtils.write(pageOption, editorUi.pages[i].getName() ||
-			mxResources.get('pageWithNumber', [i + 1]));
-		pageOption.setAttribute('value', 'data:page/id,' +
-			editorUi.pages[i].getId());
-		
-		if (img != null && img.originalSrc == pageOption.getAttribute('value'))
+		for (var i = 0; i < editorUi.pages.length; i++)
 		{
-			pageOption.setAttribute('selected', 'selected');
-			pageFound = true;
+			var pageOption = document.createElement('option');
+			mxUtils.write(pageOption, editorUi.pages[i].getName() ||
+				mxResources.get('pageWithNumber', [i + 1]));
+			pageOption.setAttribute('value', 'data:page/id,' +
+				editorUi.pages[i].getId());
+
+			if (editorUi.pages[i] == editorUi.currentPage)
+			{
+				pageOption.setAttribute('disabled', 'disabled');			
+			}
+			
+			if (img != null && img.originalSrc == pageOption.getAttribute('value'))
+			{
+				pageOption.setAttribute('selected', 'selected');
+				pageFound = true;
+			}
+
+			pageSelect.appendChild(pageOption);
 		}
+	}
 
-		pageSelect.appendChild(pageOption);
+	if (isPageLink || editorUi.pages == null || editorUi.pages.length == 1)
+	{
+		urlRadio.style.display = 'none';
+		pageRadio.style.display = 'none';
+		pageSelect.style.display = 'none';
 	}
 
 	var resetting = false;
@@ -8408,7 +8423,7 @@ var PluginsDialog = function(editorUi, addFn, delFn)
 				refresh();
 			}
 		}), null, null, null, customBtn);
-		editorUi.showDialog(dlg.container, 300, 80, true, true);
+		editorUi.showDialog(dlg.container, 300, 100, true, true);
 	});
 	
 	addBtn.className = 'geBtn';
@@ -9923,7 +9938,7 @@ var CustomDialog = function(editorUi, content, okFn, cancelFn, okButtonText, hel
 	div.appendChild(content);
 	
 	var btns = document.createElement('div');
-	btns.style.marginTop = '16px';
+	btns.style.marginTop = '30px';
 	btns.style.textAlign = 'center';
 	
 	if (buttonsContent != null)

+ 6 - 0
src/main/webapp/js/diagramly/Editor.js

@@ -1887,6 +1887,12 @@
 				Graph.prototype.defaultEdgeStyle = config.defaultEdgeStyle;
 			}
 
+			// Overrides mouse wheel function
+			if (config.zoomWheel != null)
+			{
+				Graph.zoomWheel = config.zoomWheel;
+			}
+
 			// Overrides zoom factor
 			if (config.zoomFactor != null)
 			{

+ 7 - 6
src/main/webapp/js/diagramly/EditorUi.js

@@ -3707,6 +3707,7 @@
 		// Implements the sketch-min UI
 		if (urlParams['sketch'] == '1')
 		{
+			Graph.zoomWheel = true;
 			Graph.prototype.defaultVertexStyle = {'pointerEvents': '0', 'hachureGap': '4'};
 			Graph.prototype.defaultEdgeStyle = {'edgeStyle': 'none', 'rounded': '0', 'curved': '1',
 				'jettySize': 'auto', 'orthogonalLoop': '1', 'endArrow': 'open', 'startSize': '14', 'endSize': '14',
@@ -4014,7 +4015,7 @@
 							{
 								this.loadFile(window.location.hash.substr(1), true);
 							}));
-							this.showDialog(dlg.container, 300, 75, true, true);
+							this.showDialog(dlg.container, 300, 100, true, true);
 						}), mxResources.get('cancel'), mxUtils.bind(this, function()
 						{
 							this.hideDialog();
@@ -5561,7 +5562,7 @@
 				linkSection.getColor(), fit.checked, allPages.checked, layers.checked, lightbox.checked,
 				editSection.getLink());
 		}), null, btnLabel, helpLink);
-		this.showDialog(dlg.container, 340, 384, true, true);
+		this.showDialog(dlg.container, 340, 380, true, true);
 		copyRadio.focus();
 	};
 	
@@ -5718,7 +5719,7 @@
 				layers.checked, (widthInput != null) ? widthInput.value : null,
 				(heightInput != null) ? heightInput.value : null);
 		}), null, mxResources.get('create'), helpLink);
-		this.showDialog(dlg.container, 340, 254 + dy, true, true);
+		this.showDialog(dlg.container, 340, 260 + dy, true, true);
 		
 		if (widthInput != null)
 		{
@@ -5811,7 +5812,7 @@
 		var div = document.createElement('div');
 		div.style.whiteSpace = 'nowrap';
 		var graph = this.editor.graph;
-		var height = (format == 'jpeg') ? 196 : 300;
+		var height = (format == 'jpeg') ? 200 : 280;
 		
 		var hd = document.createElement('h3');
 		mxUtils.write(hd, title);
@@ -6089,7 +6090,7 @@
 			fn(fit.checked, shadow.checked, image.checked, lightbox.checked,
 				editSection.getLink(), layers.checked);
 		}), null, mxResources.get('embed'), helpLink);
-		this.showDialog(dlg.container, 280, 280, true, true);
+		this.showDialog(dlg.container, 280, 290, true, true);
 	};
 
 	/**
@@ -13542,7 +13543,7 @@
 			
 			if (pendingLibs == 0) this.spinner.stop();
 		}), null, null, 'https://www.diagrams.net/doc/faq/custom-libraries-confluence-cloud');
-		this.showDialog(dlg.container, 340, 375, true, true, null, null, null, null, true);
+		this.showDialog(dlg.container, 340, 390, true, true, null, null, null, null, true);
 	};
 	
 	//Remote invokation, currently limited to functions in EditorUi (and its sub objects) for security reasons

+ 1 - 1
src/main/webapp/js/diagramly/ElectronApp.js

@@ -722,7 +722,7 @@ mxStencilRegistry.allowEval = false;
 				{
 	        		callback(App.pluginRegistry[pluginsSelect.value]);
 				}));
-				editorUi.showDialog(dlg.container, 300, 110, true, true);
+				editorUi.showDialog(dlg.container, 300, 120, true, true);
 			},
 			function(plugin)
 			{

+ 1 - 1
src/main/webapp/js/diagramly/GitHubClient.js

@@ -819,7 +819,7 @@ GitHubClient.prototype.showGitHubDialog = function(showFiles, fn)
 	{
 		fn(org + '/' + repo + '/' + encodeURIComponent(ref) + '/' + path);
 	}));
-	this.ui.showDialog(dlg.container, 420, 360, true, true);
+	this.ui.showDialog(dlg.container, 420, 370, true, true);
 	
 	if (showFiles)
 	{

+ 1 - 1
src/main/webapp/js/diagramly/GitLabClient.js

@@ -802,7 +802,7 @@ GitLabClient.prototype.showGitLabDialog = function(showFiles, fn)
 	{
 		fn(org + '/' + repo + '/' + encodeURIComponent(ref) + '/' + path);
 	}));
-	this.ui.showDialog(dlg.container, 420, 360, true, true);
+	this.ui.showDialog(dlg.container, 420, 370, true, true);
 	
 	if (showFiles)
 	{

+ 16 - 11
src/main/webapp/js/diagramly/Menus.js

@@ -330,7 +330,7 @@
 					!selection.checked, noPages || !pages.checked);
 			}), null, mxResources.get('export'));
 			
-			editorUi.showDialog(dlg.container, 300, 180, true, true);
+			editorUi.showDialog(dlg.container, 300, 200, true, true);
 		}));
 		
 		editorUi.actions.put('exportUrl', new Action(mxResources.get('url') + '...', function()
@@ -406,7 +406,7 @@
 					}
 				};
 				
-				var dlgH = 180;
+				var dlgH = 200;
 				var pageCount = 1;
 				var currentPage = null;
 				
@@ -501,7 +501,7 @@
 					editorUi.getServiceName() == 'draw.io';
 
 				var transparentBkg = null, include = null;
-					
+				
 				if (EditorUi.isElectronApp || isDrawioWeb)
 				{
 					include = editorUi.addCheckbox(div, mxResources.get('includeCopyOfMyDiagram'),
@@ -519,12 +519,17 @@
 
 				var dlg = new CustomDialog(editorUi, div, mxUtils.bind(this, function()
 				{
-					var from = parseInt(pagesFromInput.value);
-					var to = parseInt(pagesToInput.value);
-					var pageRange = (!allPages.checked &&
-						(from != currentPage || to != currentPage)) ?
-						{from: Math.max(0, Math.min(pageCount - 1, from - 1)),
-						to: Math.max(0, Math.min(pageCount - 1, to - 1))} : null;
+					var pageRange = null;
+
+					if (!noPages)
+					{
+						var from = parseInt(pagesFromInput.value);
+						var to = parseInt(pagesToInput.value);
+						pageRange = (!allPages.checked &&
+							(from != currentPage || to != currentPage)) ?
+							{from: Math.max(0, Math.min(pageCount - 1, from - 1)),
+							to: Math.max(0, Math.min(pageCount - 1, to - 1))} : null;
+					}
 					
 					editorUi.downloadFile('pdf', null, null, !selection.checked,
 						noPages? true : !allPages.checked && pageRange == null,
@@ -978,7 +983,7 @@
 					editorUi.exportVisio(!pages.checked);
 				}), null, mxResources.get('export'));
 				
-				editorUi.showDialog(dlg.container, 300, 110, true, true);
+				editorUi.showDialog(dlg.container, 300, 130, true, true);
 			}
 		}));
 		
@@ -1393,7 +1398,7 @@
 					doLayout();
 				});
 				
-				editorUi.showDialog(dlg.container, 355, 125, true, true);
+				editorUi.showDialog(dlg.container, 355, 140, true, true);
 			}, parent, null, isGraphEnabled());
 						
 			menu.addSeparator(parent);

+ 0 - 6
src/main/webapp/js/diagramly/Minimal.js

@@ -1378,12 +1378,6 @@ EditorUi.initMinimalTheme = function()
 		if (urlParams['sketch'] == '1')
 		{
 			this.toggleScratchpad();
-			
-			this.editor.graph.isZoomWheelEvent = function(evt)
-			{
-				return !mxEvent.isShiftDown(evt) && !mxEvent.isMetaDown(evt) && !mxEvent.isAltDown(evt) &&
-					(!mxEvent.isControlDown(evt) || mxClient.IS_MAC);
-			};
 		}
 
 		if ((urlParams['sketch'] != '1' && iw >= 1000) || urlParams['clibs'] != null ||

+ 1 - 1
src/main/webapp/js/diagramly/NotionClient.js

@@ -493,7 +493,7 @@ NotionClient.prototype.showNotionDialog = function(showFiles, fn)
 	{
 		fn(itemId);
 	}));
-	this.ui.showDialog(dlg.container, 420, 360, true, true);
+	this.ui.showDialog(dlg.container, 420, 380, true, true);
 	
 	if (showFiles)
 	{

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

@@ -1311,7 +1311,7 @@ OneDriveClient.prototype.createInlinePicker = function(fn, foldersOnly)
 			return mxResources.get('invalidSel', null, 'Invalid selection');
 		}), null, mxResources.get(foldersOnly? 'save' :'open'), null, null, null, null, true);
 		
-		this.ui.showDialog(dlg.container, 550, 485, true, true);
+		this.ui.showDialog(dlg.container, 550, 500, true, true);
 		
 		odPicker = new mxODPicker(div, null, mxUtils.bind(this, function(url, success, error)
 		{

+ 1 - 1
src/main/webapp/js/diagramly/TrelloClient.js

@@ -455,7 +455,7 @@ TrelloClient.prototype.showTrelloDialog = function(showFiles, fn)
 	content.appendChild(div);
 
 	var dlg = new CustomDialog(this.ui, content);
-	this.ui.showDialog(dlg.container, 340, 270, true, true);
+	this.ui.showDialog(dlg.container, 340, 290, true, true);
 	
 	dlg.okButton.parentNode.removeChild(dlg.okButton);
 	

+ 6 - 4
src/main/webapp/js/grapheditor/Editor.js

@@ -2039,10 +2039,11 @@ var FilenameDialog = function(editorUi, filename, buttonText, fn, label, validat
 	row = document.createElement('tr');
 	
 	td = document.createElement('td');
-	td.style.whiteSpace = 'nowrap';
-	td.style.maxWidth = '100px';
 	td.style.textOverflow = 'ellipsis';
+	td.style.textAlign = 'right';
+	td.style.maxWidth = '100px';
 	td.style.fontSize = '10pt';
+	td.style.width = '84px';
 	mxUtils.write(td, (label || mxResources.get('filename')) + ':');
 	
 	row.appendChild(td);
@@ -2159,10 +2160,11 @@ var FilenameDialog = function(editorUi, filename, buttonText, fn, label, validat
 				row = document.createElement('tr');
 		
 				td = document.createElement('td');
-				td.style.whiteSpace = 'nowrap';
-				td.style.maxWidth = '100px';
 				td.style.textOverflow = 'ellipsis';
+				td.style.textAlign = 'right';
+				td.style.maxWidth = '100px';
 				td.style.fontSize = '10pt';
+				td.style.width = '84px';
 				mxUtils.write(td, mxResources.get('type') + ':');
 				row.appendChild(td);
 

+ 8 - 1
src/main/webapp/js/grapheditor/Graph.js

@@ -1273,6 +1273,11 @@ Graph.lineJumpsEnabled = true;
  */
 Graph.defaultJumpSize = 6;
 
+/**
+ * Specifies if the mouse wheel is used for zoom without any modifiers.
+ */
+Graph.zoomWheel = false;
+
 /**
  * Minimum width for table columns.
  */
@@ -3207,7 +3212,9 @@ Graph.prototype.isReplacePlaceholders = function(cell)
  */
 Graph.prototype.isZoomWheelEvent = function(evt)
 {
-	return mxEvent.isAltDown(evt) || mxEvent.isControlDown(evt);
+	return (Graph.zoomWheel && !mxEvent.isShiftDown(evt) && !mxEvent.isMetaDown(evt) && !mxEvent.isAltDown(evt) &&
+		(!mxEvent.isControlDown(evt) || mxClient.IS_MAC)) ||
+		(!Graph.zoomWheel && (mxEvent.isAltDown(evt) || mxEvent.isControlDown(evt)));
 };
 
 /**

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 48 - 47
src/main/webapp/js/viewer-static.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 48 - 47
src/main/webapp/js/viewer.min.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
src/main/webapp/mxgraph/mxClient.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
src/main/webapp/service-worker.js


Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 1 - 1
src/main/webapp/service-worker.js.map