Browse Source

13.7.5 release

Gaudenz Alder 4 years ago
parent
commit
21108c70c7

+ 4 - 0
ChangeLog

@@ -1,3 +1,7 @@
+23-SEP-2020: 13.7.5
+
+- Removes document.write for modern browsers
+
 22-SEP-2020: 13.7.4
 
 - Appends splash dialog libs to configured libs

+ 1 - 1
VERSION

@@ -1 +1 @@
-13.7.4
+13.7.5

+ 19 - 4
src/main/webapp/index.html

@@ -144,13 +144,16 @@
 		 */
 		function mxscript(src, onLoad, id, dataAppKey, noWrite)
 		{
-			if (onLoad != null || noWrite)
+			var defer = onLoad == null && !noWrite;
+			
+			if ((urlParams['dev'] != '1' && typeof document.createElement('canvas').getContext === "function") ||
+				onLoad != null || noWrite)
 			{
 				var s = document.createElement('script');
 				s.setAttribute('type', 'text/javascript');
+				s.setAttribute('defer', 'true');
 				s.setAttribute('src', src);
-				var r = false;
-				
+
 				if (id != null)
 				{
 					s.setAttribute('id', id);
@@ -163,6 +166,8 @@
 				
 				if (onLoad != null)
 				{
+					var r = false;
+				
 					s.onload = s.onreadystatechange = function()
 					{
 						if (!r && (!this.readyState || this.readyState == 'complete'))
@@ -418,7 +423,17 @@ if (navigator.userAgent != null && navigator.userAgent.toLowerCase().
 }
 else
 {
-	App.main();
+	if (urlParams['dev'] != '1' && typeof document.createElement('canvas').getContext === "function")
+	{
+		window.addEventListener('load', function()
+		{
+			App.main();
+		});
+	}
+	else
+	{
+		App.main();
+	}
 }
 </script>
 </body>

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


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

@@ -568,8 +568,9 @@ App.main = function(callback, createUi)
 			{
 				var content = mxUtils.getTextContent(scripts[0]);
 				
-				if (CryptoJS.MD5(content).toString() != '5bf9ec4131db137e247634de78c4ec47')
+				if (CryptoJS.MD5(content).toString() != '9544a60fcc10609bee5e70a56ad52599')
 				{
+					console.log('Updated MD5:', CryptoJS.MD5(content).toString());
 					alert('[Dev] Script change requires update of CSP');
 				}
 			}

+ 4 - 3
src/main/webapp/js/diagramly/Devel.js

@@ -16,10 +16,11 @@ if (!mxIsElectron && location.protocol !== 'http:')
 				'https://apis.google.com https://*.pusher.com https://code.jquery.com ' +
 				// Bootstrap script in index.html (checked for changes in App.main
 				// in dev mode to avoid deployment without updating this SHA)
-				'\'sha256-JqdgAC+ydIDMtmQclZEqgbw94J4IeABIfXAxwEJGDJs=\' ' +
+				'\'sha256-+CrvFhadGyk1VjhHM/t3R88LNSEKManW3TGSZi9fmHQ=\' ' +
 				// App.main script in index.html
-				'\'sha256-4Dg3/NrB8tLC7TUSCbrtUDWD/J6bSLka01GHn+qtNZ0=\'; ' +
-			'connect-src %connect-src% \'self\' https://*.draw.io https://*.diagrams.net https://*.googleapis.com wss://*.pusher.com https://*.pusher.com ' +
+				'\'sha256-dIEi9UhRQPcyoE9/RPfkIPLe2mSS8oQzwabGMLAZzGE=\'; ' +
+			'connect-src %connect-src% \'self\' https://*.draw.io https://*.diagrams.net ' +
+				'https://*.googleapis.com wss://*.pusher.com https://*.pusher.com ' +
 				'https://api.github.com https://raw.githubusercontent.com https://gitlab.com ' +
 				'https://graph.microsoft.com https://*.sharepoint.com  https://*.1drv.com ' +
 				'https://*.google.com https://fonts.gstatic.com https://fonts.googleapis.com; ' +

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

@@ -513,6 +513,11 @@
 		'#\n' +
 		'# styles: -\n' +
 		'#\n' +
+		'## JSON for variables in styles of the form {"name": "value", "name": "value"} where name is a string\n' +
+		'## that will replace a placeholder in a style.\n' +
+		'#\n' +
+		'# vars: -\n' +
+		'#\n' +
 		'## Optional column name that contains a reference to a named label in labels.\n' +
 		'## Default is the current label.\n' +
 		'#\n' +

+ 8 - 3
src/main/webapp/js/diagramly/EditorUi.js

@@ -11824,6 +11824,7 @@
         		var lookups = {};
         		
         		// Default values
+        		var vars = null;
         		var style = null;
         		var styles = null;
         		var stylename = null;
@@ -11937,6 +11938,10 @@
 		    				{
 		    					styles = JSON.parse(value);
 		    				}
+		    				else if (key == 'vars' && value.length > 0 && value != '-')
+		    				{
+		    					vars = JSON.parse(value);
+		    				}
 		    				else if (key == 'identity' && value.length > 0 && value != '-')
 		    				{
 		    					identity = value;
@@ -12109,7 +12114,7 @@
 						}
 
 						graph.setAttributeForCell(newCell, 'placeholders', '1');
-						newCell.style = graph.replacePlaceholders(newCell, newCell.style);
+						newCell.style = graph.replacePlaceholders(newCell, newCell.style, vars);
 
 						if (exists)
 						{
@@ -12185,7 +12190,7 @@
 	    					
 	    					if (parent != null)
 	    					{
-	    						parent.style = graph.replacePlaceholders(parent, parentstyle);
+	    						parent.style = graph.replacePlaceholders(parent, parentstyle, vars);
 	    						graph.addCell(cell, parent);
 	    					}
 	    					else
@@ -12249,7 +12254,7 @@
 				    							var placeholders = ((edge.placeholders == 'target') ==
 				    								!edge.invert) ? ref : realCell;
 				    							var style = (edge.style != null) ?
-				    								graph.replacePlaceholders(placeholders, edge.style) :
+				    								graph.replacePlaceholders(placeholders, edge.style, vars) :
 				    								graph.createCurrentEdgeStyle();
 
 				    							var edgeCell = graph.insertEdge(null, null, label || '', (edge.invert) ?

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

@@ -3746,7 +3746,7 @@ LucidImporter = {};
 			//'TimelineBlock' : cs,
 			//'TimelineMilestoneBlock' : cs,
 			//'TimelineIntervalBlock' : cs,
-			'MinimalTextBlock' : 'strokeColor=none',
+			'MinimalTextBlock' : 'strokeColor=none;fillColor=none',
 //Freehand			
 			'FreehandBlock' : cs
 	};

+ 36 - 27
src/main/webapp/js/diagramly/sidebar/Sidebar.js

@@ -354,43 +354,58 @@
 		
 		return false;
 	};
-	
+
 	/**
 	 * 
 	 */
-	Sidebar.prototype.showEntries = function(stc, remember, force)
+	Sidebar.prototype.showEntries = function(entries, remember, force)
 	{
-		this.libs = [];
+		var all = [];
 		
-		if(stc != null && (force || stc.length > 0))
+		if (remember)
 		{
-			this.libs.push(stc);
+			mxSettings.setLibraries(entries);
+			mxSettings.save();
+		}
+		
+		if (entries != null && (force || entries.length > 0))
+		{
+			all.push(entries);
 		}
 		else 
 		{
-			if(urlParams['libs'] != null && urlParams['libs'].length > 0) 
-			{
-				this.libs.push(decodeURIComponent(urlParams['libs']));
-			}
+			var done = false;
 			
-			if(mxSettings != null && mxSettings.settings != null) 
+			if (urlParams['libs'] != null && urlParams['libs'].length > 0) 
 			{
-				this.libs.push(mxSettings.getLibraries());
+				all.push(decodeURIComponent(urlParams['libs']));
+				done = this.editorUi.getServiceName() == 'draw.io';
 			}
-			else 
+			
+			// Libs parameter overrides configuration for online app so that
+			// links can be created to show just the specifies libraries
+			if (!done)
 			{
-				this.libs.push(this.defaultEntries);
+				if (mxSettings != null && mxSettings.settings != null) 
+				{
+					all.push(mxSettings.getLibraries());
+				}
+				else 
+				{
+					all.push(this.defaultEntries);
+				}
 			}
 		}
 		
-		this.libs = this.libs.join(';');
-
-		var tmp = this.libs.split(';');
+		// Merges array of semicolon separated strings into a single array
+		var temp = all.join(';').split(';');
+		
+		// Resolves aliases and creates lookup
+		var visible = {};
 		
-		// Maps library names via the alias table
-		for (var i = 0; i < tmp.length; i++)
+		for (var i = 0; i < temp.length; i++)
 		{
-			tmp[i] = this.libAliases[tmp[i]] || tmp[i];
+			visible[this.libAliases[temp[i]] || temp[i]] = true; 
 		}
 		
 		for (var i = 0; i < this.configuration.length; i++)
@@ -400,7 +415,7 @@
 			{
 				this.showPalettes(this.configuration[i].prefix || '',
 					this.configuration[i].libs || [this.configuration[i].id],
-					mxUtils.indexOf(tmp, this.configuration[i].id) >= 0);
+					visible[this.configuration[i].id] == true);
 			}
 		}
 		
@@ -423,17 +438,11 @@
 							libs.push(entry.id + '.' + k);
 						}
 						
-						this.showPalettes('', libs, mxUtils.indexOf(tmp, entry.id) >= 0);
+						this.showPalettes('', libs, visible[entry.id]);
 					}
 				}
 			}
 		}
-		
-		if (remember)
-		{
-			mxSettings.setLibraries(stc);
-			mxSettings.save();
-		}
 	};
 
 	/**

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


+ 6 - 1
src/main/webapp/js/mxgraph/Graph.js

@@ -2778,7 +2778,7 @@ Graph.prototype.createLayersDialog = function()
 /**
  * Private helper method.
  */
-Graph.prototype.replacePlaceholders = function(cell, str)
+Graph.prototype.replacePlaceholders = function(cell, str, vars)
 {
 	var result = [];
 	
@@ -2827,6 +2827,11 @@ Graph.prototype.replacePlaceholders = function(cell, str)
 					{
 						tmp = this.getGlobalVariable(name);
 					}
+					
+					if (tmp == null && vars != null)
+					{
+						tmp = vars[name];
+					}
 				}
 	
 				result.push(str.substring(last, match.index) + ((tmp != null) ? tmp : val));

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


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


+ 3 - 3
src/main/webapp/service-worker.js

@@ -6,11 +6,11 @@ if (workbox)
 	workbox.precaching.precacheAndRoute([
   {
     "url": "js/app.min.js",
-    "revision": "d38d8c6197bf84fc384e3d8fab9927db"
+    "revision": "ed5326d7c9733e1c1530bf7a685239c9"
   },
   {
     "url": "js/extensions.min.js",
-    "revision": "b87d013e7a5e514e686d9999aaea23fa"
+    "revision": "dec4ff0126fb9fcca53cddac9b70c1df"
   },
   {
     "url": "js/shapes.min.js",
@@ -22,7 +22,7 @@ if (workbox)
   },
   {
     "url": "index.html",
-    "revision": "9583ae237911326eaba0006e795c4b0b"
+    "revision": "11792102adc802b2687afc6d78554df6"
   },
   {
     "url": "open.html",