Browse Source

19.0.0 release

David Benson 3 years ago
parent
commit
e4b64b0341

+ 6 - 0
ChangeLog

@@ -1,3 +1,9 @@
+03-JUN-2022: 19.0.0
+
+- Removes IE 11 support
+- Updates mermaid.js to 9.1.1
+- Fixes updating existing cells in CSV import [2796]
+
 02-JUN-2022: 18.2.1
 
 - Updates JSZip to 3.10.0

+ 1 - 1
VERSION

@@ -1 +1 @@
-18.2.1
+19.0.0

+ 7 - 1
etc/dependencies/package.json

@@ -9,9 +9,15 @@
 	},
 	"homepage": "https://github.com/jgraph/drawio",
 	"dependencies": {
-	  "jsZip": "3.1.3",
+	  "jsZip": "3.10.1",
 	  "perfect-freehand": "1.0.16",
 	  "jquery": "3.3.1",
+	  "mermaid": "9.1.1",
+	  "pako": "2.0.3",
+	  "crypto-js": "3.1.2",
+	  "dompurify": "2.3.6",
+	  "spin.js": "2.0.0",
+	  "roughjs": "4.4.1",
 	  "jscolor": "^3.8.0"
 	}
   }

+ 43 - 33
src/main/webapp/electron.js

@@ -39,6 +39,7 @@ const isWin = process.platform === 'win32'
 let enableSpellCheck = store.get('enableSpellCheck');
 enableSpellCheck = enableSpellCheck != null? enableSpellCheck : isMac;
 let enableStoreBkp = store.get('enableStoreBkp') != null? store.get('enableStoreBkp') : true;
+let dialogOpen = false;
 
 //Read config file
 var queryObj = {
@@ -177,43 +178,43 @@ function createWindow (opt = {})
 
 		if (contents != null)
 		{
-			contents.executeJavaScript('if(typeof window.__emt_isModified === \'function\'){window.__emt_isModified()}', true)
-				.then((isModified) =>
+	        ipcMain.once('isModified-result', (evt, data) =>
+			{
+				if (data.isModified)
 				{
-					if (__DEV__) 
-					{
-						console.log('__emt_isModified', isModified)
-					}
-					
-					if (isModified)
-					{
-						var choice = dialog.showMessageBoxSync(
-							win,
-							{
-								type: 'question',
-								buttons: ['Cancel', 'Discard Changes'],
-								title: 'Confirm',
-								message: 'The document has unsaved changes. Do you really want to quit without saving?' //mxResources.get('allChangesLost')
-							})
-							
-						if (choice === 1)
+					dialog.showMessageBox(
+						win,
 						{
-							//If user chose not to save, remove the draft
-							contents.executeJavaScript('window.__emt_removeDraft()', true);
-							win.destroy()
-						}
-						else
+							type: 'question',
+							buttons: ['Cancel', 'Discard Changes'],
+							title: 'Confirm',
+							message: 'The document has unsaved changes. Do you really want to quit without saving?' //mxResources.get('allChangesLost')
+						}).then( async result =>
 						{
-							cmdQPressed = false
-						}
-					}
-					else
-					{
-						win.destroy()
-					}
-				})
+							if (result.response === 1)
+							{
+								//If user chose not to save, remove the draft
+								if (data.draftPath != null)
+								{
+									await deleteFile(data.draftPath);
+								}
 
-			event.preventDefault()
+								win.destroy();
+							}
+							else
+							{
+								cmdQPressed = false;
+							}
+						});
+				}
+				else
+				{
+					win.destroy();
+				}
+			});
+
+			contents.send('isModified');
+			event.preventDefault();
 		}
 	})
 
@@ -621,6 +622,9 @@ app.on('ready', e =>
     else 
     {
     	app.on('second-instance', (event, commandLine, workingDirectory) => {
+			// Creating a new window while a save/open dialog is open crashes the app
+			if (dialogOpen) return;
+
     		//Create another window
     		let win = createWindow()
 
@@ -843,6 +847,8 @@ app.on('will-finish-launching', function()
 	app.on("open-file", function(event, path) 
 	{
 	    event.preventDefault();
+		// Creating a new window while a save/open dialog is open crashes the app
+		if (dialogOpen) return;
 
 	    if (firstWinLoaded)
 	    {
@@ -2244,10 +2250,14 @@ ipcMain.on("rendererReq", async (event, args) =>
 			ret = await checkFileExists(args.pathParts);
 			break;
 		case 'showOpenDialog':
+			dialogOpen = true;
 			ret = await showOpenDialog(args.defaultPath, args.filters, args.properties);
+			dialogOpen = false;
 			break;
 		case 'showSaveDialog':
+			dialogOpen = true;
 			ret = await showSaveDialog(args.defaultPath, args.filters);
+			dialogOpen = false;
 			break;
 		case 'installPlugin':
 			ret = await installPlugin(args.filePath);

File diff suppressed because it is too large
+ 592 - 592
src/main/webapp/js/app.min.js


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

@@ -689,6 +689,10 @@
 		'#\n' +
 		'# height: auto\n' +
 		'#\n' +
+		'## Collapsed state for vertices. Possible values are true or false. Default is false.\n' +
+		'#\n' +
+		'# collapsed: false\n' +
+		'#\n' +
 		'## Padding for autosize. Default is 0.\n' +
 		'#\n' +
 		'# padding: -12\n' +

+ 33 - 12
src/main/webapp/js/diagramly/EditorUi.js

@@ -13314,6 +13314,7 @@
         		var namespace = '';
         		var width = 'auto';
         		var height = 'auto';
+				var collapsed = false;
         		var left = null;
         		var top = null;
         		var edgespacing = 40;
@@ -13439,6 +13440,10 @@
 		    				else if (key == 'height')
 		    				{
 		    					height = value;
+		    				}
+							else if (key == 'collapsed' && value != '-')
+		    				{
+		    					collapsed = value == 'true';
 		    				}
 		    				else if (key == 'left' && value.length > 0)
 		    				{
@@ -13560,44 +13565,59 @@
     						cell = graph.model.getCell(id);
     					}
     					
-    					var exists = cell != null;
     					var newCell = new mxCell(label, new mxGeometry(x0, y,
 		    				0, 0), style || 'whiteSpace=wrap;html=1;');
-    					newCell.vertex = true;
+						newCell.collapsed = collapsed;
+						newCell.vertex = true;
     					newCell.id = id;
-
-						var targetCell = (cell != null) ? cell : newCell;
+						
+						if (cell != null)
+						{
+							graph.model.setCollapsed(cell, collapsed);
+						}
 						
 						for (var j = 0; j < values.length; j++)
 				    	{
-							graph.setAttributeForCell(targetCell, attribs[j], values[j]);
+							graph.setAttributeForCell(newCell, attribs[j], values[j]);
+
+							if (cell != null)
+							{
+								graph.setAttributeForCell(cell, attribs[j], values[j]);
+							}
 				    	}
 						
 						if (labelname != null && labels != null)
 						{
-							var tempLabel = labels[targetCell.getAttribute(labelname)];
+							var tempLabel = labels[newCell.getAttribute(labelname)];
 							
 							if (tempLabel != null)
 							{
-								graph.labelChanged(targetCell, tempLabel);
+								graph.labelChanged(newCell, tempLabel);
+
+								if (cell != null)
+								{
+									graph.cellLabelChanged(cell, tempLabel);
+								}
 							}
 						}
 
 						if (stylename != null && styles != null)
 						{
-							var tempStyle = styles[targetCell.getAttribute(stylename)];
+							var tempStyle = styles[newCell.getAttribute(stylename)];
 							
 							if (tempStyle != null)
 							{
-								targetCell.style = tempStyle;
+								newCell.style = tempStyle;
 							}
 						}
 
-						graph.setAttributeForCell(targetCell, 'placeholders', '1');
-						targetCell.style = graph.replacePlaceholders(targetCell, targetCell.style, vars);
+						graph.setAttributeForCell(newCell, 'placeholders', '1');
+						newCell.style = graph.replacePlaceholders(newCell, newCell.style, vars);
 
-						if (exists)
+						if (cell != null)
 						{
+							graph.model.setStyle(cell, newCell.style);
+
 							if (mxUtils.indexOf(cells, cell) < 0)
 							{
 								cells.push(cell);
@@ -13610,6 +13630,7 @@
 							graph.fireEvent(new mxEventObject('cellsInserted', 'cells', [newCell]));
 						}
 
+    					var exists = cell != null;
 						cell = newCell;
     					
 						if (!exists)

+ 9 - 15
src/main/webapp/js/diagramly/ElectronApp.js

@@ -310,25 +310,19 @@ mxStencilRegistry.allowEval = false;
 		var editorUi = this;
 		var graph = this.editor.graph;
 		
-		window.__emt_isModified = function()
+		electron.registerMsgListener('isModified', () =>
 		{
-			if (editorUi.getCurrentFile())
-			{
-				return editorUi.getCurrentFile().isModified()
-			}
+			const currentFile = editorUi.getCurrentFile();
+			let reply = {isModified: false, draftPath: null};
 
-			return false
-		};
-		
-		window.__emt_removeDraft = function()
-		{
-			var currentFile = editorUi.getCurrentFile();
-
-			if (currentFile != null && EditorUi.enableDrafts)
+			if (currentFile != null)
 			{
-				currentFile.removeDraft();
+				reply.isModified = currentFile.isModified();
+				reply.draftPath = EditorUi.enableDrafts && currentFile.fileObject? currentFile.fileObject.draftFileName : null;
 			}
-		};
+
+			electron.sendMessage('isModified-result', reply);
+		});
 
 		// Adds support for libraries
 		this.actions.addAction('newLibrary...', mxUtils.bind(this, function()

File diff suppressed because it is too large
+ 3 - 36
src/main/webapp/js/extensions.min.js


File diff suppressed because it is too large
+ 1085 - 1118
src/main/webapp/js/integrate.min.js


+ 0 - 29
src/main/webapp/js/mermaid/README.md

@@ -1,29 +0,0 @@
-# To change mermaid.min.js for IE11
-
-1. Clone Mermaid source from Github
-1. Change the file `webpack.config.base.js`. Look for `const jsRule = {` and replace that block with
-
-```
-const jsRule = {
-  test: /\.js$/,
-  include: [
-    path.resolve(__dirname, './src'),
-    path.resolve(__dirname, './node_modules/dagre-d3-renderer/lib'),
-    path.resolve(__dirname, './node_modules/@braintree/sanitize-url'),
-    path.resolve(__dirname, './node_modules/dagre'),
-    path.resolve(__dirname, './node_modules/graphlib'),
-    path.resolve(__dirname, './node_modules/he'),
-    path.resolve(__dirname, './node_modules/entity-decode'),
-    path.resolve(__dirname, './node_modules/khroma/dist'),
-    path.resolve(__dirname, './node_modules/stylis')
-  ],
-  use: {
-    loader: 'babel-loader'
-  }
-};
-```
-
-The idea is to add any library used in package.json that is not compatible with IE11
-Then polyfill any JS error in IE11 (e.g, version 8.10.1 needs Number.isInteger polyfill such that js loads without errors)
-
-All trials to polyfill other errors failed (using useBuiltIns: 'usage', corejs: {version: '2.0'} or polyfill.io). IE11 has basic support for flowchart, sequence and er only

File diff suppressed because it is too large
+ 3 - 36
src/main/webapp/js/mermaid/mermaid.min.js


File diff suppressed because it is too large
+ 772 - 772
src/main/webapp/js/viewer-static.min.js


File diff suppressed because it is too large
+ 772 - 772
src/main/webapp/js/viewer.min.js


File diff suppressed because it is too large
+ 1 - 1
src/main/webapp/mxgraph/mxClient.js


File diff suppressed because it is too large
+ 1 - 1
src/main/webapp/service-worker.js


File diff suppressed because it is too large
+ 1 - 1
src/main/webapp/service-worker.js.map