Browse Source

13.2.5 release

Gaudenz Alder 5 years ago
parent
commit
f9f6c97197
42 changed files with 8774 additions and 2081 deletions
  1. 7 0
      ChangeLog
  2. 1 1
      VERSION
  3. 12 1
      etc/build/build.xml
  4. 7 7
      etc/mxgraph/mxClient.js
  5. 2 1
      src/main/webapp/connect/att_common/att-editor.js
  6. 45 0
      src/main/webapp/connect/confluence/admin-page.js
  7. 1 47
      src/main/webapp/connect/confluence/admin.html
  8. 0 9
      src/main/webapp/connect/confluence/config.html
  9. 8 0
      src/main/webapp/connect/confluence/config.js
  10. 7 2
      src/main/webapp/connect/confluence/connectUtils-1-4-8.js
  11. 7 122
      src/main/webapp/connect/confluence/includeDiagram.html
  12. 123 1
      src/main/webapp/connect/confluence/includeDiagram.js
  13. 46 0
      src/main/webapp/connect/confluence/init-editor.js
  14. 1 52
      src/main/webapp/connect/confluence/initEditor.html
  15. 83 0
      src/main/webapp/connect/confluence/lucid-import.js
  16. 1 85
      src/main/webapp/connect/confluence/lucidMassImport.html
  17. 174 0
      src/main/webapp/connect/confluence/macro-editor.js
  18. 1 180
      src/main/webapp/connect/confluence/macroEditor-1-4-8.html
  19. 23 0
      src/main/webapp/connect/confluence/splash-editor.js
  20. 1 29
      src/main/webapp/connect/confluence/splashEditor.html
  21. 109 129
      src/main/webapp/connect/confluence/support.html
  22. 17 0
      src/main/webapp/connect/confluence/support.js
  23. 2 58
      src/main/webapp/connect/confluence/viewer-1-4-8.html
  24. 44 0
      src/main/webapp/connect/confluence/viewer-init.js
  25. 10 0
      src/main/webapp/connect/confluence/viewer.js
  26. 1 0
      src/main/webapp/connect/gdrive_common/editor.js
  27. 1 0
      src/main/webapp/connect/gdrive_common/gac.js
  28. 2 8
      src/main/webapp/connect/onedrive_common/editor.js
  29. 0 2
      src/main/webapp/electron.js
  30. 223 218
      src/main/webapp/js/app.min.js
  31. 9 0
      src/main/webapp/js/diagramly/App.js
  32. 20 10
      src/main/webapp/js/diagramly/Devel.js
  33. 16 0
      src/main/webapp/js/diagramly/DrawioFile.js
  34. 9 5
      src/main/webapp/js/diagramly/EditorUi.js
  35. 3 6
      src/main/webapp/js/diagramly/ElectronApp.js
  36. 6 0
      src/main/webapp/js/diagramly/Init.js
  37. 1 0
      src/main/webapp/js/diagramly/Menus.js
  38. 4 3
      src/main/webapp/js/mxgraph/Editor.js
  39. 67 33
      src/main/webapp/js/mxgraph/Graph.js
  40. 11 1
      src/main/webapp/js/mxgraph/Toolbar.js
  41. 6594 0
      src/main/webapp/js/viewer-static.min.js
  42. 1075 1071
      src/main/webapp/js/viewer.min.js

+ 7 - 0
ChangeLog

@@ -1,3 +1,10 @@
+17-JUN-2020: 13.2.5
+
+- Adds embed.diagrams.net for embed mode
+- Adds Alt+Shift to toggle child cells
+- Fixes toggle selection for groups
+- Uses mxGraph 4.2.0 beta 10
+
 13-JUN-2020: 13.2.4
 
 - Uses tables in Misc and ER sidebar

+ 1 - 1
VERSION

@@ -1 +1 @@
-13.2.4
+13.2.5

+ 12 - 1
etc/build/build.xml

@@ -241,7 +241,17 @@
 		
 		<concat destfile="${war.dir}/js/viewer.min.js" fixlastline="yes" append="no">
 			<filelist dir="${basedir}" files="base-viewer.min.js,.tmp2.min.js"/>
-    		</concat>
+    	</concat>
+
+		<echo file="${basedir}/.tmp3.js">
+			// Disables eval for JS (uses shapes.min.js)
+			mxStencilRegistry.allowEval = false;
+		</echo>
+		
+		<concat destfile="${war.dir}/js/viewer-static.min.js" fixlastline="yes" append="no">
+			<filelist dir="${war.dir}/js" files="viewer.min.js,shapes.min.js"/>
+			<filelist dir="${basedir}" files=".tmp3.js"/>
+    	</concat>
 
 		<delete file="${war.dir}/js/extensions.min.js"/>
 		<delete file="${basedir}/.tmp0.js"/>
@@ -249,6 +259,7 @@
 		<delete file="${basedir}/.tmp1.js"/>
 		<delete file="${basedir}/.tmp2.js"/>
 		<delete file="${basedir}/.tmp2.min.js"/>
+		<delete file="${basedir}/.tmp3.js"/>
 		<delete file="${basedir}/.tmp1.xml"/>
 		<delete file="${basedir}/.tmp2.xml"/>
 

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


+ 2 - 1
src/main/webapp/connect/att_common/att-editor.js

@@ -68,12 +68,13 @@ function AttViewerEditor(onSubmit, getFileInfoFn, idSuffix, notStandalone, drawi
 			}
 		}
 		
+		Graph.prototype.shadowId = 'attachmentDropShadow';
 		var viewer = new GraphViewer(container, doc.documentElement,
 				{highlight: '#3572b0', border: 8, 'auto-fit': true,
 				resize: false, nav: true, lightbox: false, title: filename,
 				'toolbar-nohide': true, 'toolbar-position': 'top', toolbar: 'pages layers',
 				pageId: pageId, layerIds: layerIds});
-
+		
 		curViewer = viewer;
 		
 		if (typeof AP != 'undefined')

+ 45 - 0
src/main/webapp/connect/confluence/admin-page.js

@@ -0,0 +1,45 @@
+//Logs uncaught errors
+window.onerror = function(message, url, linenumber, colno, err)
+{
+	message = 'Confluence Cloud Admin: ' + ((message != null) ? message : '');
+	
+	AC.logError(message, url, linenumber, colno, err);
+};
+
+var baseUrl = AC.getBaseUrl();
+
+var script = document.createElement('script');
+
+script.onload = function()
+{
+	AP.sizeToParent(true);
+	
+	setTimeout(function()
+	{
+		AP.sizeToParent(true);
+	}, 5000); //Try resizing again after 5 sec since the first one fails sometimes
+	
+	getAndApplyTranslation(function()
+	{
+		//JQuery is loaded in this page, so we can use it
+		var logDiv = $('#operationLog');
+
+		var importBtn = $('#importBtn');
+		
+		importBtn.attr("disabled", null);
+		
+		importBtn.click(function()
+		{
+			$('#busyIcon').show();
+			
+			GliffyMassImporter(logDiv, function()
+			{
+				$('#busyIcon').hide();
+			});
+		});
+	});
+};
+
+script.src = 'https://connect-cdn.atl-paas.net/all.js';
+script.setAttribute('data-options', 'resize:false;margin:false');
+document.getElementsByTagName('head')[0].appendChild(script);

+ 1 - 47
src/main/webapp/connect/confluence/admin.html

@@ -17,52 +17,6 @@
 			</div>
 			<div id="operationLog"><br></div>
 		</div>
-		<script type="text/javascript">
-			//Logs uncaught errors
-			window.onerror = function(message, url, linenumber, colno, err)
-			{
-				message = 'Confluence Cloud Admin: ' + ((message != null) ? message : '');
-				
-				AC.logError(message, url, linenumber, colno, err);
-			};
-			
-			var baseUrl = AC.getBaseUrl();
-	
-			var script = document.createElement('script');
-	
-			script.onload = function()
-			{
-				AP.sizeToParent(true);
-				
-				setTimeout(function()
-				{
-					AP.sizeToParent(true);
-				}, 5000); //Try resizing again after 5 sec since the first one fails sometimes
-				
-				getAndApplyTranslation(function()
-				{
-					//JQuery is loaded in this page, so we can use it
-					var logDiv = $('#operationLog');
-	
-					var importBtn = $('#importBtn');
-					
-					importBtn.attr("disabled", null);
-					
-					importBtn.click(function()
-					{
-						$('#busyIcon').show();
-						
-						GliffyMassImporter(logDiv, function()
-						{
-							$('#busyIcon').hide();
-						});
-					});
-				});
-			};
-	
-			script.src = 'https://connect-cdn.atl-paas.net/all.js';
-			script.setAttribute('data-options', 'resize:false;margin:false');
-			document.getElementsByTagName('head')[0].appendChild(script);
-		</script>
+		<script src="admin-page.js" type="text/javascript"></script>
 	</body>
 </html>

+ 0 - 9
src/main/webapp/connect/confluence/config.html

@@ -167,14 +167,5 @@
 				<div id="operationLog"><br></div>
 			</div>
 		</div>
-		<script type="text/javascript">
-			//Logs uncaught errors
-			window.onerror = function(message, url, linenumber, colno, err)
-			{
-				message = 'Confluence Cloud Config: ' + ((message != null) ? message : '');
-				
-				AC.logError(message, url, linenumber, colno, err);
-			};
-		</script>
 	</body>
 </html>

+ 8 - 0
src/main/webapp/connect/confluence/config.js

@@ -1,3 +1,11 @@
+//Logs uncaught errors
+window.onerror = function(message, url, linenumber, colno, err)
+{
+	message = 'Confluence Cloud Config: ' + ((message != null) ? message : '');
+	
+	AC.logError(message, url, linenumber, colno, err);
+};
+
 var collectAllPages = function(callback, error)
 {
 	var start = 0, limit = 200;

+ 7 - 2
src/main/webapp/connect/confluence/connectUtils-1-4-8.js

@@ -1,5 +1,10 @@
-// Renamed from ac.js. This is the version used for release 1.4.8-AC onwards
+// Sets base path for mxgraph library
+if (typeof window.mxBasePath === 'undefined')
+{
+	window.mxBasePath = '/mxgraph';
+}
 
+// Renamed from ac.js. This is the version used for release 1.4.8-AC onwards
 var AC = {};
 
 AC.autosaveTimeout = 10000;
@@ -173,7 +178,7 @@ AC.initI18nAsync = function(lang, callback)
 		});
 	};
 	
-	script.src = '/js/viewer.min.js';
+	script.src = '/js/viewer-static.min.js';
 	document.getElementsByTagName('head')[0].appendChild(script);
 };
 

+ 7 - 122
src/main/webapp/connect/confluence/includeDiagram.html

@@ -3,20 +3,14 @@
 <head>
 <meta charset="UTF-8">
 <title>Include draw.io Diagram</title>
-<script type="text/javascript">
-	// To Avoid NPE in connectUtils
-	urlParams = {};
-</script>
 <script src="connectUtils-1-4-8.js" type="text/javascript"></script>
 <script src="../new_common/cac.js" type="text/javascript"></script>
 <script src="../onedrive_common/ac.js" type="text/javascript"></script>
 <script src="../gdrive_common/gac.js" type="text/javascript"></script>
-<script type="text/javascript" src="/js/viewer.min.js"></script>
+<script type="text/javascript" src="/js/viewer-static.min.js"></script>
 <script src="../onedrive_common/editor.js" type="text/javascript"></script>
 <script src="../gdrive_common/editor.js" type="text/javascript"></script>
 <script src="../att_common/att-editor.js" type="text/javascript"></script>
-<script src="includeDiagram.js" type="text/javascript"></script>
-
 <link rel="stylesheet" href="//aui-cdn.atlassian.com/aui-adg/5.9.12/css/aui.min.css" media="all">
 <style type="text/css">
 body {
@@ -169,12 +163,11 @@ body {
 						<label for="useDrawio" style="display:inline-block;">Preview in draw.io</label>
 					</div>
 				</div>
-				<a id="signoutGD" style="position: absolute;bottom: 2px;right: 5px;font-size: 11px;cursor: pointer;" onclick="javascript:void(0);">Sign Out</a>
+				<a id="signoutGD" style="position: absolute;bottom: 2px;right: 5px;font-size: 11px;cursor: pointer;">Sign Out</a>
 			</form>
 		</div>
 		<div id="previewGD" style="bottom:0px;left:351px;position:absolute;top:42px;right:0px;display:inline-block;">
-			<a style="display:block;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);cursor:pointer"
-				onclick="document.getElementById('filePickerGD').click();">Choose a file...</a>
+			<a id="gdAnchor" style="display:block;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);cursor:pointer">Choose a file...</a>
 		</div>
 	</div>
 	
@@ -215,12 +208,11 @@ body {
 						<label for="useDrawioOD" style="display:inline-block;">Preview in draw.io</label>
 					</div>
 				</div>
-				<a id="signoutOD" style="position: absolute;bottom: 2px;right: 5px;font-size: 11px;cursor: pointer;" onclick="javascript:void(0);">Sign Out</a>
+				<a id="signoutOD" style="position: absolute;bottom: 2px;right: 5px;font-size: 11px;cursor: pointer;">Sign Out</a>
 			</form>
 		</div>
 		<div id="previewOD" style="bottom:0px;left:351px;position:absolute;top:42px;right:0px;display:inline-block;">
-			<a style="display:block;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);cursor:pointer"
-				onclick="document.getElementById('filePickerOD').click();">Choose a file...</a>
+			<a id="odAnchor" style="display:block;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);cursor:pointer">Choose a file...</a>
 		</div>
 	</div>
 	
@@ -257,8 +249,7 @@ body {
 			</form>
 		</div>
 		<div id="previewUD" style="bottom:0px;left:351px;position:absolute;top:42px;right:0px;display:inline-block;text-align: center;">
-			<a style="display:block;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);cursor:pointer"
-				onclick="document.getElementById('fileuploadUD').click();">Choose a file...</a>
+			<a id="fileUploadAnchor" style="display:block;text-align:center;position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);cursor:pointer">Choose a file...</a>
 		</div>
 	</div>
 	
@@ -275,112 +266,6 @@ body {
 	<div id="errorMsg">
 		 
 	</div>
-	<script type="text/javascript">
-		//Logs uncaught errors
-		window.onerror = function(message, url, linenumber, colno, err)
-		{
-			message = 'Confluence Cloud Embed Editor: ' + ((message != null) ? message : '');
-			
-			AC.logError(message, url, linenumber, colno, err);
-		};
-		
-		var xdm_e = AC.getSiteUrl();
-		var license = AC.getUrlParam('lic', false);
-		var baseUrl = AC.getBaseUrl(); //TODO FIXME search and recent depends on having baseUrl global 
-		var connectUrl = baseUrl + '/atlassian-connect';
-		var head = document.getElementsByTagName('head')[0];
-		var licenseValid = true;
-		
-		var script = document.createElement('script');
-		script.setAttribute('data-options', 'resize:false;margin:false');
-		
-		if (license != null && xdm_e != null)
-		{
-			if  (license == 'none')
-			{
-				var hostParse = document.createElement('a');
-				hostParse.href = xdm_e;
-				var hostname = hostParse.hostname;
-				
-				if (hostname != null)
-				{
-	 				if (hostname.indexOf('.ngrok.io') > -1)
-					{
-						console.log("License status = ", license);
-					}
-					else
-					{
-						var xhr = new XMLHttpRequest();
-			
-						xhr.onreadystatechange = function()
-						{
-						    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status <= 299)
-						    {
-						        var resp = xhr.responseText;
-			
-								if (resp != null && resp.length > 0)
-								{
-									var lic = JSON.parse(resp);
-									
-									if (lic != null && lic.atlasCloudLic != null)
-									{
-										licenseValid = true;
-									}
-								}
-						    }
-						};
-			
-						xhr.open('POST', '/license?domain=' + hostname, true);
-						xhr.send(null);
-					}
-				}
-			}
-			else
-			{
-				licenseValid = true;
-			}
-		}
-	
-		// Main
-		script.onload = function()
-		{
-			if (!licenseValid)
-			{
-				setTimeout(function()
-				{
-					if (!licenseValid)
-					{
-						alert("Please install a license for the draw.io app");
-						AP.confluence.closeMacroEditor();
-					}
-				}, 3000);
-			}
-			
-			//start the macro editro
-			AP.navigator.getLocation(function (data)
-		    {
-		    	if (data != null && data.context != null)
-		   		{
-		    		var draftPage = (data.target == 'contentcreate');
-		    		var pageId = data.context.contentId;
-		    		
-		    		includeDiagramMain(pageId, draftPage);
-		   		}
-		    	else
-	    		{
-		    		alert('Unexpected Error: Cannot get content id or type.');
-	    		}
-		    });
-		};
-	
-		script.src = 'https://connect-cdn.atl-paas.net/all.js';
-		head.appendChild(script);
-		
-		var link = document.createElement('link');
-		link.type = 'text/css';
-		link.rel = 'stylesheet';
-		link.href = connectUrl + '/all.css';
-		head.appendChild(link);
-	</script>
+	<script src="includeDiagram.js" type="text/javascript"></script>
 </body>
 </html>

+ 123 - 1
src/main/webapp/connect/confluence/includeDiagram.js

@@ -982,4 +982,126 @@ function includeDiagramMain(confPageId, draftPage)
 	AP.events.on('dialog.submit', onSubmit);
 	AP.dialog.getButton('submit').hide();
 	AP.dialog.getButton('submit').disable();
-};
+};
+
+//Logs uncaught errors
+window.onerror = function(message, url, linenumber, colno, err)
+{
+	message = 'Confluence Cloud Embed Editor: ' + ((message != null) ? message : '');
+	
+	AC.logError(message, url, linenumber, colno, err);
+};
+
+var xdm_e = AC.getSiteUrl();
+var license = AC.getUrlParam('lic', false);
+var baseUrl = AC.getBaseUrl(); //TODO FIXME search and recent depends on having baseUrl global 
+var connectUrl = baseUrl + '/atlassian-connect';
+var head = document.getElementsByTagName('head')[0];
+var licenseValid = true;
+
+var script = document.createElement('script');
+script.setAttribute('data-options', 'resize:false;margin:false');
+
+if (license != null && xdm_e != null)
+{
+	if  (license == 'none')
+	{
+		var hostParse = document.createElement('a');
+		hostParse.href = xdm_e;
+		var hostname = hostParse.hostname;
+		
+		if (hostname != null)
+		{
+			if (hostname.indexOf('.ngrok.io') > -1)
+			{
+				console.log("License status = ", license);
+			}
+			else
+			{
+				var xhr = new XMLHttpRequest();
+	
+				xhr.onreadystatechange = function()
+				{
+				    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status <= 299)
+				    {
+				        var resp = xhr.responseText;
+	
+						if (resp != null && resp.length > 0)
+						{
+							var lic = JSON.parse(resp);
+							
+							if (lic != null && lic.atlasCloudLic != null)
+							{
+								licenseValid = true;
+							}
+						}
+				    }
+				};
+	
+				xhr.open('POST', '/license?domain=' + hostname, true);
+				xhr.send(null);
+			}
+		}
+	}
+	else
+	{
+		licenseValid = true;
+	}
+}
+
+// Adds event listeners
+document.getElementById('gdAnchor').onclick = function()
+{
+	document.getElementById('filePickerGD').click();
+};
+
+document.getElementById('odAnchor').onclick = function()
+{
+	document.getElementById('filePickerOD').click();
+};
+
+document.getElementById('fileUploadAnchor').onclick = function()
+{
+	document.getElementById('fileuploadUD').click();
+};
+
+// Main
+script.onload = function()
+{
+	if (!licenseValid)
+	{
+		setTimeout(function()
+		{
+			if (!licenseValid)
+			{
+				alert("Please install a license for the draw.io app");
+				AP.confluence.closeMacroEditor();
+			}
+		}, 3000);
+	}
+	
+	//start the macro editro
+	AP.navigator.getLocation(function (data)
+    {
+    	if (data != null && data.context != null)
+   		{
+    		var draftPage = (data.target == 'contentcreate');
+    		var pageId = data.context.contentId;
+    		
+    		includeDiagramMain(pageId, draftPage);
+   		}
+    	else
+		{
+    		alert('Unexpected Error: Cannot get content id or type.');
+		}
+    });
+};
+
+script.src = 'https://connect-cdn.atl-paas.net/all.js';
+head.appendChild(script);
+
+var link = document.createElement('link');
+link.type = 'text/css';
+link.rel = 'stylesheet';
+link.href = connectUrl + '/all.css';
+head.appendChild(link);

+ 46 - 0
src/main/webapp/connect/confluence/init-editor.js

@@ -0,0 +1,46 @@
+var connectUrl = AC.getBaseUrl() + '/atlassian-connect';
+var head = document.getElementsByTagName('head')[0];
+
+var script = document.createElement('script');
+script.setAttribute('data-options', 'resize:false;margin:false');
+
+// Main
+script.onload = function()
+{
+	// TODO: Try avoid this by using workaround in EditorUi.fileLoaded on line 2200
+	//Firefox has a problem with focusing the can be fixed with a chrome dialog
+	if(navigator.userAgent.indexOf('Firefox/') >= 0)
+	{
+		AP.dialog.create(
+        {
+    		key: 'splashEditor',
+    		header: 'draw.io',
+            chrome: true,
+            width: "50%",
+            height: "50%",
+        }).on("close", function(flags)
+    	{
+        	AP.dialog.close();
+        	AP.confluence.closeMacroEditor();
+		});
+		AP.dialog.getButton('submit').hide();
+		//Confluence refuse to hide cancel button!!!
+		AP.dialog.getButton('cancel').hide();
+	}
+	else
+	{
+		AP.dialog.create(
+        {
+    		key: 'macroEditor',
+    		customData: {},
+            chrome: false,
+            width: "100%",
+            height: "100%",
+        }).on("close", function(flags)
+    	{
+        	AP.confluence.closeMacroEditor();
+		});
+	}
+};
+script.src = 'https://connect-cdn.atl-paas.net/all.js';
+head.appendChild(script);

+ 1 - 52
src/main/webapp/connect/confluence/initEditor.html

@@ -3,10 +3,6 @@
 <head>
 <meta charset="UTF-8">
 <title>draw.io Editor</title>
-<script type="text/javascript">
-	// To Avoid NPE in connectUtils
-	urlParams = {};
-</script>
 <script src="connectUtils-1-4-8.js" type="text/javascript"></script>
 <style type="text/css">
 	html, body {
@@ -27,53 +23,6 @@
 </style>
 </head>
 <body>
-<script type="text/javascript">
-	var connectUrl = AC.getBaseUrl() + '/atlassian-connect';
-	var head = document.getElementsByTagName('head')[0];
-	
-	var script = document.createElement('script');
-	script.setAttribute('data-options', 'resize:false;margin:false');
-	
-	// Main
-	script.onload = function()
-	{
-		// TODO: Try avoid this by using workaround in EditorUi.fileLoaded on line 2200
-		//Firefox has a problem with focusing the can be fixed with a chrome dialog
-		if(navigator.userAgent.indexOf('Firefox/') >= 0)
-		{
-			AP.dialog.create(
-	        {
-	    		key: 'splashEditor',
-	    		header: 'draw.io',
-	            chrome: true,
-	            width: "50%",
-	            height: "50%",
-	        }).on("close", function(flags)
-        	{
-	        	AP.dialog.close();
-	        	AP.confluence.closeMacroEditor();
-    		});
-			AP.dialog.getButton('submit').hide();
-			//Confluence refuse to hide cancel button!!!
-			AP.dialog.getButton('cancel').hide();
-		}
-		else
-		{
-			AP.dialog.create(
-	        {
-	    		key: 'macroEditor',
-	    		customData: {},
-	            chrome: false,
-	            width: "100%",
-	            height: "100%",
-	        }).on("close", function(flags)
-        	{
-	        	AP.confluence.closeMacroEditor();
-    		});
-		}
-	};
-	script.src = 'https://connect-cdn.atl-paas.net/all.js';
-	head.appendChild(script);
-</script>
+<script src="init-editor.js" type="text/javascript"></script>
 </body>
 </html>

+ 83 - 0
src/main/webapp/connect/confluence/lucid-import.js

@@ -0,0 +1,83 @@
+//Logs uncaught errors
+window.onerror = function(message, url, linenumber, colno, err)
+{
+	message = 'Confluence Cloud Lucid Mass Import: ' + ((message != null) ? message : '');
+	
+	AC.logError(message, url, linenumber, colno, err);
+};
+
+var baseUrl = AC.getBaseUrl();
+var script = document.createElement('script');
+
+script.onload = function()
+{
+	var importExtensionId = 'cnoplimhpndhhhnmoigbanpjeghjpohi';
+	var extensionInstallUrl = 'https://chrome.google.com/webstore/detail/diagramsnet-and-drawio-im/cnoplimhpndhhhnmoigbanpjeghjpohi';
+	var logDiv = $('#operationLog');
+
+	AP.sizeToParent(true);
+	
+	setTimeout(function()
+	{
+		AP.sizeToParent(true);
+	}, 5000); //Try resizing again after 5 sec since the first one fails sometimes
+	
+	function prepareImporter(response)
+	{
+		//JQuery is loaded in this page, so we can use it
+		var importBtn = $('#importBtn');
+		
+		if (!response) //Extension is not installed
+		{
+			logDiv.html(mxResources.get('installFirst', ['<a href="' + extensionInstallUrl + '" target="_blank">' + mxResources.get('drawioChromeExt') + '</a>']));
+		}
+		else if (response.error)
+		{
+			if (response.msg == 'LucidNotFound' || response.msg == 'LucidDisconnected')
+			{
+				setTimeout(function()
+				{
+					chrome.runtime.sendMessage(importExtensionId, {msg: 'filesTree', allAsMap: true}, prepareImporter);
+				}, 1000);
+			}
+			else if (response.msg == 'AuthError')
+			{
+				logDiv.html(mxResources.get('loginFirstThen', ['Lucidchart', '<a href="javascript:location.reload();">' + mxResources.get('tryAgain') + '</a>']));
+			}
+			else
+			{
+				logDiv.html('<span style="color:red">' + mxResources.get('errFetchDocList') + '</span>');
+			}
+		}
+		else
+		{
+			importBtn.attr("disabled", null);
+			$('#loadingImg').hide();
+			
+			importBtn.click(function()
+			{
+				$('#loadingImg').show();
+				LucidConnMassImporter(response.filesMap, importExtensionId, logDiv, function()
+				{
+					$('#loadingImg').hide();
+				})
+			});
+		}	
+	};
+	
+	getAndApplyTranslation(function()
+	{
+		if (typeof chrome === 'undefined')
+		{
+			logDiv.html('<span style="color:red">' + mxResources.get('chromeOnly') + '</span>');
+		}
+		else
+		{
+			chrome.runtime.sendMessage(importExtensionId, {msg: 'filesTree', allAsMap: true}, prepareImporter);
+		}
+	});
+};
+
+script.src = 'https://connect-cdn.atl-paas.net/all.js';
+script.setAttribute('data-options', 'resize:false;margin:false');
+document.getElementsByTagName('head')[0].appendChild(script);

+ 1 - 85
src/main/webapp/connect/confluence/lucidMassImport.html

@@ -18,90 +18,6 @@
 			<div style="padding-bottom:4px;"><br><button id="importBtn" disabled="disabled" class="aui-button aui-button-primary" data-i18n="startImport">Start Import</button><img id="loadingImg" src="/images/spin.gif"></div>
 			<div id="operationLog"><br></div>
 		</div>
-		<script type="text/javascript">
-			//Logs uncaught errors
-			window.onerror = function(message, url, linenumber, colno, err)
-			{
-				message = 'Confluence Cloud Lucid Mass Import: ' + ((message != null) ? message : '');
-				
-				AC.logError(message, url, linenumber, colno, err);
-			};
-			
-			var baseUrl = AC.getBaseUrl();
-			var script = document.createElement('script');
-	
-			script.onload = function()
-			{
-				var importExtensionId = 'cnoplimhpndhhhnmoigbanpjeghjpohi';
-				var extensionInstallUrl = 'https://chrome.google.com/webstore/detail/diagramsnet-and-drawio-im/cnoplimhpndhhhnmoigbanpjeghjpohi';
-				var logDiv = $('#operationLog');
-
-				AP.sizeToParent(true);
-				
-				setTimeout(function()
-				{
-					AP.sizeToParent(true);
-				}, 5000); //Try resizing again after 5 sec since the first one fails sometimes
-				
-				function prepareImporter(response)
-				{
-					//JQuery is loaded in this page, so we can use it
-					var importBtn = $('#importBtn');
-					
-					if (!response) //Extension is not installed
-					{
-						logDiv.html(mxResources.get('installFirst', ['<a href="' + extensionInstallUrl + '" target="_blank">' + mxResources.get('drawioChromeExt') + '</a>']));
-					}
-					else if (response.error)
-					{
-						if (response.msg == 'LucidNotFound' || response.msg == 'LucidDisconnected')
-						{
-							setTimeout(function()
-							{
-								chrome.runtime.sendMessage(importExtensionId, {msg: 'filesTree', allAsMap: true}, prepareImporter);
-							}, 1000);
-						}
-						else if (response.msg == 'AuthError')
-						{
-							logDiv.html(mxResources.get('loginFirstThen', ['Lucidchart', '<a href="javascript:location.reload();">' + mxResources.get('tryAgain') + '</a>']));
-						}
-						else
-						{
-							logDiv.html('<span style="color:red">' + mxResources.get('errFetchDocList') + '</span>');
-						}
-					}
-					else
-					{
-						importBtn.attr("disabled", null);
-						$('#loadingImg').hide();
-						
-						importBtn.click(function()
-						{
-							$('#loadingImg').show();
-							LucidConnMassImporter(response.filesMap, importExtensionId, logDiv, function()
-							{
-								$('#loadingImg').hide();
-							})
-						});
-					}	
-				};
-				
-				getAndApplyTranslation(function()
-				{
-					if (typeof chrome === 'undefined')
-					{
-						logDiv.html('<span style="color:red">' + mxResources.get('chromeOnly') + '</span>');
-					}
-					else
-					{
-						chrome.runtime.sendMessage(importExtensionId, {msg: 'filesTree', allAsMap: true}, prepareImporter);
-					}
-				});
-			};
-	
-			script.src = 'https://connect-cdn.atl-paas.net/all.js';
-			script.setAttribute('data-options', 'resize:false;margin:false');
-			document.getElementsByTagName('head')[0].appendChild(script);
-		</script>
+		<script src="lucid-import.js" type="text/javascript"></script>
 	</body>
 </html>

+ 174 - 0
src/main/webapp/connect/confluence/macro-editor.js

@@ -0,0 +1,174 @@
+//Logs uncaught errors
+window.onerror = function(message, url, linenumber, colno, err)
+{
+	message = 'Confluence Cloud Editor: ' + ((message != null) ? message : '');
+	
+	AC.logError(message, url, linenumber, colno, err);
+};
+
+var xdm_e = AC.getSiteUrl();
+var baseUrl = AC.getBaseUrl();
+var license = AC.getUrlParam('lic', false);
+var connectUrl = baseUrl + '/atlassian-connect';
+var head = document.getElementsByTagName('head')[0];
+var licenseValid = true;
+
+var script = document.createElement('script');
+script.setAttribute('data-options', 'resize:false;margin:false');
+
+if (license != null && xdm_e != null)
+{
+	if (license == 'none')
+	{
+		licenseValid = false;
+	}
+	
+	var hostParse = document.createElement('a');
+	hostParse.href = xdm_e;
+	var hostname = hostParse.hostname;
+	
+	if (hostname != null)
+	{
+		var xhr = new XMLHttpRequest();
+	
+		xhr.onreadystatechange = function()
+		{
+		    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status <= 299)
+		    {
+		        var resp = xhr.responseText;
+	
+				if (resp != null && resp.length > 0)
+				{
+					var lic = JSON.parse(resp);
+					
+					if (lic != null && lic.atlasCloudLic != null)
+					{
+						licenseValid = true;
+					}
+				}
+		    }
+		};
+	
+		xhr.open('POST', '/license?domain=' + hostname + '&confLicense=' + license, true);
+		xhr.send(null);
+	}
+}
+
+// Main
+script.onload = function()
+{
+	if (!licenseValid)
+	{
+		setTimeout(function() // XHR call doesn't work inside AP.Request
+		{
+			if (!licenseValid)
+			{
+				alert("Please install a license for the draw.io app");
+				AP.dialog.close();
+			}
+		}, 8000);
+	}
+	
+	AP.resize('100%', '100%');
+	
+	var config = null;
+	var lang = null;
+	var SEN = null;
+	var installedDate = null;
+	var lastUpdated = null;
+	var allDone = 0;
+	
+	var startEditor = function () 
+	{
+		allDone++;
+		
+		if (allDone == 2)
+		{
+			var isCustom = AC.getUrlParam('custom');
+			
+			if (isCustom == "1") 
+			{
+				var contentId = AC.getUrlParam('contentId') || AC.getUrlParam('custContentId');
+				AP.dialog.getCustomData(function (customData) 
+				{
+					AC.initAsync(baseUrl, customData.contentId || customData.custContentId || contentId, customData.macroData, config, lang);
+				});
+			}
+			else
+			{
+				AC.initAsync(baseUrl, null, null, config, lang);
+			}
+		}
+	}
+	
+	AP.user.getLocale(function(locale)
+	{
+		lang = locale;
+		startEditor();
+	});	
+	
+	AP.request({
+	    type: 'GET',
+	    url: '/rest/api/content/search?cql=type%3Dpage%20and%20space%3DDRAWIOCONFIG%20and%20title%3DConfiguration', //type=page and space=DRAWIOCONFIG and title=Configuration. Search doesn't return 404 if not found
+	    contentType: 'application/json;charset=UTF-8',
+	    success: function (resp) 
+	    {
+	        resp = JSON.parse(resp);
+	        
+	        if (resp != null && resp.size == 1)
+	       	{
+	        	var configPageId = resp.results[0].id;
+	        	//load the configuration file
+	    		AP.request({
+	                type: 'GET',
+	    			url: '/download/attachments/' + configPageId + '/configuration.json',
+	                contentType: 'application/json;charset=UTF-8',
+	                success: function (fileContent) 
+	                {
+	                	config = fileContent; 
+	                   	startEditor();
+	    			},
+	    			error: startEditor //if there is an error loading the configuration, just load the editor normally. E.g., 404 when the space doesn't exist
+	    		});
+	        	
+	       	}
+	        else 
+	       	{
+	        	startEditor();
+	       	}
+		},
+		error: startEditor //if there is an error loading the configuration, just load the editor normally. E.g., 404 when the space doesn't exist
+	});
+	
+	AP.request({
+	    type: 'GET',
+	    url: '/rest/atlassian-connect/1/addons/com.mxgraph.confluence.plugins.diagramly',
+	    contentType: 'application/json;charset=UTF-8',
+	    success: function (resp) 
+	    {
+	    	try
+	    	{
+	            resp = JSON.parse(resp);
+	            
+	            if (resp != null && resp.license != null)
+	            {
+	            	var xhr = new XMLHttpRequest();
+	            	xhr.open('POST', '/license?licenseDump=' + encodeURIComponent(JSON.stringify(resp)), true);
+	    			xhr.send(null);
+	            }
+	    	}
+	    	catch (e)
+	    	{
+	    		// just throw away if it breaks, not important
+	        	}
+	        }
+		});
+};
+script.src = 'https://connect-cdn.atl-paas.net/all.js';
+head.appendChild(script);
+
+var link = document.createElement('link');
+link.type = 'text/css';
+link.rel = 'stylesheet';
+link.href = connectUrl + '/all.css';
+head.appendChild(link);

+ 1 - 180
src/main/webapp/connect/confluence/macroEditor-1-4-8.html

@@ -3,10 +3,6 @@
 <head>
 <meta charset="UTF-8">
 <title>draw.io Editor</title>
-<script type="text/javascript">
-	// To Avoid NPE in connectUtils
-	urlParams = {};
-</script>
 <script src="connectUtils-1-4-8.js" type="text/javascript"></script>
 <style type="text/css">
 	html, body {
@@ -27,181 +23,6 @@
 </style>
 </head>
 <body>
-<script type="text/javascript">
-	//Logs uncaught errors
-	window.onerror = function(message, url, linenumber, colno, err)
-	{
-		message = 'Confluence Cloud Editor: ' + ((message != null) ? message : '');
-		
-		AC.logError(message, url, linenumber, colno, err);
-	};
-	
-	var xdm_e = AC.getSiteUrl();
-	var baseUrl = AC.getBaseUrl();
-	var license = AC.getUrlParam('lic', false);
-	var connectUrl = baseUrl + '/atlassian-connect';
-	var head = document.getElementsByTagName('head')[0];
-	var licenseValid = true;
-	
-	var script = document.createElement('script');
-	script.setAttribute('data-options', 'resize:false;margin:false');
-	
-	if (license != null && xdm_e != null)
-	{
-		if (license == 'none')
-		{
-			licenseValid = false;
-		}
-		
-		var hostParse = document.createElement('a');
-		hostParse.href = xdm_e;
-		var hostname = hostParse.hostname;
-		
-		if (hostname != null)
-		{
-			var xhr = new XMLHttpRequest();
-
-			xhr.onreadystatechange = function()
-			{
-			    if (xhr.readyState == XMLHttpRequest.DONE && xhr.status >= 200 && xhr.status <= 299)
-			    {
-			        var resp = xhr.responseText;
-
-					if (resp != null && resp.length > 0)
-					{
-						var lic = JSON.parse(resp);
-						
-						if (lic != null && lic.atlasCloudLic != null)
-						{
-							licenseValid = true;
-						}
-					}
-			    }
-			};
-
-			xhr.open('POST', '/license?domain=' + hostname + '&confLicense=' + license, true);
-			xhr.send(null);
-		}
-	}
-
-	// Main
-	script.onload = function()
-	{
-		if (!licenseValid)
-		{
-			setTimeout(function() // XHR call doesn't work inside AP.Request
-			{
-				if (!licenseValid)
-				{
-					alert("Please install a license for the draw.io app");
-					AP.dialog.close();
-				}
-			}, 8000);
-		}
-
-		AP.resize('100%', '100%');
-
-		var config = null;
-		var lang = null;
-		var SEN = null;
-		var installedDate = null;
-		var lastUpdated = null;
-		var allDone = 0;
-		
-		var startEditor = function () 
-		{
-			allDone++;
-			
-			if (allDone == 2)
-			{
-				var isCustom = AC.getUrlParam('custom');
-				
-				if (isCustom == "1") 
-				{
-					var contentId = AC.getUrlParam('contentId') || AC.getUrlParam('custContentId');
-					AP.dialog.getCustomData(function (customData) 
-					{
-						AC.initAsync(baseUrl, customData.contentId || customData.custContentId || contentId, customData.macroData, config, lang);
-					});
-				}
-				else
-				{
-					AC.initAsync(baseUrl, null, null, config, lang);
-				}
-			}
-		}
-		
-		AP.user.getLocale(function(locale)
-		{
-			lang = locale;
-			startEditor();
-		});	
-		
-		AP.request({
-            type: 'GET',
-            url: '/rest/api/content/search?cql=type%3Dpage%20and%20space%3DDRAWIOCONFIG%20and%20title%3DConfiguration', //type=page and space=DRAWIOCONFIG and title=Configuration. Search doesn't return 404 if not found
-            contentType: 'application/json;charset=UTF-8',
-            success: function (resp) 
-            {
-                resp = JSON.parse(resp);
-                
-                if (resp != null && resp.size == 1)
-               	{
-                	var configPageId = resp.results[0].id;
-                	//load the configuration file
-            		AP.request({
-                        type: 'GET',
-            			url: '/download/attachments/' + configPageId + '/configuration.json',
-                        contentType: 'application/json;charset=UTF-8',
-                        success: function (fileContent) 
-                        {
-                        	config = fileContent; 
-                           	startEditor();
-            			},
-            			error: startEditor //if there is an error loading the configuration, just load the editor normally. E.g., 404 when the space doesn't exist
-            		});
-                	
-               	}
-                else 
-               	{
-                	startEditor();
-               	}
-			},
-			error: startEditor //if there is an error loading the configuration, just load the editor normally. E.g., 404 when the space doesn't exist
-		});
-		
-    	AP.request({
-            type: 'GET',
-            url: '/rest/atlassian-connect/1/addons/com.mxgraph.confluence.plugins.diagramly',
-            contentType: 'application/json;charset=UTF-8',
-            success: function (resp) 
-            {
-            	try
-            	{
-	                resp = JSON.parse(resp);
-	                
-	                if (resp != null && resp.license != null)
-	                {
-	                	var xhr = new XMLHttpRequest();
-	                	xhr.open('POST', '/license?licenseDump=' + encodeURIComponent(JSON.stringify(resp)), true);
-	        			xhr.send(null);
-	                }
-            	}
-            	catch (e)
-            	{
-            		// just throw away if it breaks, not important
-            	}
-            }
-    	});
-	};
-	script.src = 'https://connect-cdn.atl-paas.net/all.js';
-	head.appendChild(script);
-	
-	var link = document.createElement('link');
-	link.type = 'text/css';
-	link.rel = 'stylesheet';
-	link.href = connectUrl + '/all.css';
-	head.appendChild(link);
-</script>
+<script src="macro-editor.js" type="text/javascript"></script>
 </body>
 </html>

+ 23 - 0
src/main/webapp/connect/confluence/splash-editor.js

@@ -0,0 +1,23 @@
+var connectUrl = AC.getBaseUrl() + '/atlassian-connect';
+var head = document.getElementsByTagName('head')[0];
+
+var script = document.createElement('script');
+script.setAttribute('data-options', 'resize:false;margin:false');
+
+// Main
+script.onload = function()
+{
+	AP.dialog.create(
+       {
+   		key: 'macroEditor',
+   		customData: {},
+           chrome: false,
+           width: "100%",
+           height: "100%",
+       }).on("close", function(flags)
+       {
+       	AP.dialog.close();
+	});
+};
+script.src = 'https://connect-cdn.atl-paas.net/all.js';
+head.appendChild(script);

+ 1 - 29
src/main/webapp/connect/confluence/splashEditor.html

@@ -3,10 +3,6 @@
 <head>
 <meta charset="UTF-8">
 <title>draw.io Editor</title>
-<script type="text/javascript">
-	// To Avoid NPE in connectUtils
-	urlParams = {};
-</script>
 <script src="connectUtils-1-4-8.js" type="text/javascript"></script>
 <style type="text/css">
 	html, body {
@@ -27,30 +23,6 @@
 </style>
 </head>
 <body>
-<script type="text/javascript">
-	var connectUrl = AC.getBaseUrl() + '/atlassian-connect';
-	var head = document.getElementsByTagName('head')[0];
-	
-	var script = document.createElement('script');
-	script.setAttribute('data-options', 'resize:false;margin:false');
-	
-	// Main
-	script.onload = function()
-	{
-		AP.dialog.create(
-        {
-    		key: 'macroEditor',
-    		customData: {},
-            chrome: false,
-            width: "100%",
-            height: "100%",
-        }).on("close", function(flags)
-        {
-        	AP.dialog.close();
-		});
-	};
-	script.src = 'https://connect-cdn.atl-paas.net/all.js';
-	head.appendChild(script);
-</script>
+<script src="splash-editor.js" type="text/javascript"></script>
 </body>
 </html>

File diff suppressed because it is too large
+ 109 - 129
src/main/webapp/connect/confluence/support.html


File diff suppressed because it is too large
+ 17 - 0
src/main/webapp/connect/confluence/support.js


+ 2 - 58
src/main/webapp/connect/confluence/viewer-1-4-8.html

@@ -27,64 +27,8 @@ body {
 <script src="../gdrive_common/gac.js" type="text/javascript"></script>
 </head>
 <body>
-<script type="text/javascript">
-// Parses URL parameters
-function getUrlParam(param, treatEmptyAsNull)
-{
-	var result = (new RegExp(param + '=([^&]*)')).exec(window.location.search);
-	
-	if (result != null && result.length > 0)
-	{
-		var val = decodeURIComponent(result[1].replace(/\+/g, '%20'));
-		return treatEmptyAsNull && val != null && val.length == 0 ? null : val;
-	}
-	
-	return null;
-};
-
-function getBaseUrl()
-{
-	var baseUrl = getUrlParam('xdm_e', true) + getUrlParam('cp', true);
-	//Ensure baseUrl belongs to attlasian (*.jira.com and *.atlassian.net)
-	//Since we add cp to xdm_e, we had to ensure that there is a slash after the domain. Since if xdm_e is ok, cp can corrupt is such as cp = '.fakedomain.com' such that baseUrl is atlassian.net.fakedomain.com
-	if (/^https:\/\/([^\.])+\.jira\.com\//.test(baseUrl + '/') || /^https:\/\/([^\.])+\.atlassian\.net\//.test(baseUrl + '/')) 
-	{
-		return baseUrl;
-	}
-	throw 'Invalid baseUrl!';
-};
-
-// Sets global environment variables
-RESOURCE_BASE = '/resources/dia';
-STENCIL_PATH = '/stencils';
-SHAPES_PATH = '/shapes';
-IMAGE_PATH = '/images';
-
-// Absolute for font conversion in lightbox to work
-PROXY_URL = '/proxy';
-
-var lightbox = getUrlParam('lightbox') == '1';
-var customContent = getUrlParam('custom') == '1';
-
-if (lightbox)
-{
-	document.body.style.backgroundImage = 'url(/images/drawlogo-text-bottom.svg)';
-	document.body.style.backgroundPosition = 'center 30%';
-	document.body.style.backgroundSize = '128px';
-}
-</script>
-<script type="text/javascript" src="/js/viewer.min.js"></script>
+<script type="text/javascript" src="viewer-init.js"></script>
+<script type="text/javascript" src="/js/viewer-static.min.js"></script>
 <script type="text/javascript" src="viewer.js"></script>
-<script type="text/javascript">
-// Logs uncaught errors
-EditorUi.enableLogging = true;
-
-window.onerror = function(message, url, linenumber, colno, err)
-{
-	message = 'Confluence Cloud: ' + ((message != null) ? message : '');
-	
-	EditorUi.logError(message, url, linenumber, colno, err);
-};
-</script>
 </body>
 </html>

+ 44 - 0
src/main/webapp/connect/confluence/viewer-init.js

@@ -0,0 +1,44 @@
+// Parses URL parameters
+function getUrlParam(param, treatEmptyAsNull)
+{
+	var result = (new RegExp(param + '=([^&]*)')).exec(window.location.search);
+	
+	if (result != null && result.length > 0)
+	{
+		var val = decodeURIComponent(result[1].replace(/\+/g, '%20'));
+		return treatEmptyAsNull && val != null && val.length == 0 ? null : val;
+	}
+	
+	return null;
+};
+
+function getBaseUrl()
+{
+	var baseUrl = getUrlParam('xdm_e', true) + getUrlParam('cp', true);
+	//Ensure baseUrl belongs to attlasian (*.jira.com and *.atlassian.net)
+	//Since we add cp to xdm_e, we had to ensure that there is a slash after the domain. Since if xdm_e is ok, cp can corrupt is such as cp = '.fakedomain.com' such that baseUrl is atlassian.net.fakedomain.com
+	if (/^https:\/\/([^\.])+\.jira\.com\//.test(baseUrl + '/') || /^https:\/\/([^\.])+\.atlassian\.net\//.test(baseUrl + '/')) 
+	{
+		return baseUrl;
+	}
+	throw 'Invalid baseUrl!';
+};
+
+// Sets global environment variables
+RESOURCE_BASE = '/resources/dia';
+STENCIL_PATH = '/stencils';
+SHAPES_PATH = '/shapes';
+IMAGE_PATH = '/images';
+
+// Absolute for font conversion in lightbox to work
+PROXY_URL = '/proxy';
+
+var lightbox = getUrlParam('lightbox') == '1';
+var customContent = getUrlParam('custom') == '1';
+
+if (lightbox)
+{
+	document.body.style.backgroundImage = 'url(/images/drawlogo-text-bottom.svg)';
+	document.body.style.backgroundPosition = 'center 30%';
+	document.body.style.backgroundSize = '128px';
+}

+ 10 - 0
src/main/webapp/connect/confluence/viewer.js

@@ -1,5 +1,15 @@
 (function()
 {
+	// Logs uncaught errors
+	EditorUi.enableLogging = true;
+	
+	window.onerror = function(message, url, linenumber, colno, err)
+	{
+		message = 'Confluence Cloud: ' + ((message != null) ? message : '');
+		
+		EditorUi.logError(message, url, linenumber, colno, err);
+	};
+
 	var EXPORT_URL = 'https://exp.draw.io/ImageExport4/export';
 	
 	// Enables dynamic loading of shapes and stencils (same domain)

+ 1 - 0
src/main/webapp/connect/gdrive_common/editor.js

@@ -125,6 +125,7 @@ function GDriveEditor(onSubmit, getFileInfoFn, idSuffix, notStandalone, drawioOn
 			}
 		}
 		
+		Graph.prototype.shadowId = 'googleDriveDropShadow';
 		var viewer = new GraphViewer(container, doc.documentElement,
 				{highlight: '#3572b0', border: 8, 'auto-fit': true,
 				resize: false, nav: true, lightbox: false, title: file.title,

+ 1 - 0
src/main/webapp/connect/gdrive_common/gac.js

@@ -416,6 +416,7 @@ GAC.pickFile = function(fn, acceptFolders)
 		{
 			  if (data[google.picker.Response.ACTION] == google.picker.Action.PICKED)
 		      {
+				  	picker.setVisible(false);
 				    var doc = data[google.picker.Response.DOCUMENTS][0];
 				    
 				    GAC.getFileInfo(doc.id, function(fullDoc)

+ 2 - 8
src/main/webapp/connect/onedrive_common/editor.js

@@ -132,6 +132,7 @@ function OneDriveEditor(onSubmit, getFileInfoFn, idSuffix, notStandalone, drawio
 			}
 		}
 		
+		Graph.prototype.shadowId = 'oneDriveDropShadow';
 		var viewer = new GraphViewer(container, doc.documentElement,
 				{highlight: '#3572b0', border: 8, 'auto-fit': true,
 				resize: false, nav: true, lightbox: false, title: filename,
@@ -309,10 +310,7 @@ function OneDriveEditor(onSubmit, getFileInfoFn, idSuffix, notStandalone, drawio
 							}, handleNonDrawFile);
 						}, handleNonDrawFile);
 					}
-					//Handle draw.io potential files (html & xml)
-					else if (useDrawio || mimeType == 'text/html' || mimeType == 'text/xml' || mimeType == 'application/xml' || mimeType == 'image/png' 
-							|| /\.svg$/i.test(file.name) || /\.html$/i.test(file.name) || /\.xml$/i.test(file.name) 
-							|| /\.png$/i.test(file.name) || /\.drawio$/i.test(file.name))
+					else
 					{
 						AC.checkDrawioFile(file, function(doc, cnt)
 						{
@@ -322,10 +320,6 @@ function OneDriveEditor(onSubmit, getFileInfoFn, idSuffix, notStandalone, drawio
 							setAutosize();
 						}, handleNonDrawFile);
 					}
-					else
-					{
-						handleNonDrawFile();
-					}
 				});
 				
 				evt.preventDefault();

+ 0 - 2
src/main/webapp/electron.js

@@ -7,7 +7,6 @@ const ipcMain = electron.ipcMain
 const dialog = electron.dialog
 const app = electron.app
 const BrowserWindow = electron.BrowserWindow
-const globalShortcut = electron.globalShortcut;
 const crc = require('crc');
 const zlib = require('zlib');
 const log = require('electron-log')
@@ -16,7 +15,6 @@ const {autoUpdater} = require("electron-updater")
 const Store = require('electron-store');
 const store = new Store();
 const ProgressBar = require('electron-progressbar');
-const { systemPreferences } = require('electron')
 const disableUpdate = require('./disableUpdate').disableUpdate() || 
 						process.env.DRAWIO_DISABLE_UPDATE === 'true' || 
 						fs.existsSync('/.flatpak-info'); //This file indicates running in flatpak sandbox

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


+ 9 - 0
src/main/webapp/js/diagramly/App.js

@@ -574,6 +574,7 @@ App.main = function(callback, createUi)
 					mxscript('js/shapes.min.js');
 					mxscript('js/stencils.min.js');
 					mxscript('js/extensions.min.js');
+					mxStencilRegistry.allowEval = false;
 		
 					// Use the window load event to keep the page load performant
 					window.addEventListener('load', function()
@@ -1185,6 +1186,14 @@ App.prototype.initializeEmbedMode = function()
 {
 	if (urlParams['embed'] == '1')
 	{
+		if (window.location.hostname == 'app.diagrams.net')
+		{
+			if (window.console != null)
+			{
+				console.warn('[Deprecation] app.diagrams.net will stop working for embed mode. Please use embed.diagrams.net.');
+			}
+		}
+		
 		if (App.embedModePluginsCount > 0 || this.initEmbedDone)
 		{
 			return; //Wait for plugins to load, or this is a duplicate call due to timeout

+ 20 - 10
src/main/webapp/js/diagramly/Devel.js

@@ -12,7 +12,7 @@ if (!mxIsElectron && location.protocol !== 'http:')
 	{
 		var csp = 'default-src \'self\'; ' +
 			// storage.googleapis.com is needed for workbox-service-worker
-			'script-src %dev-script-src% \'self\' https://storage.googleapis.com ' +
+			'script-src %script-src% \'self\' https://storage.googleapis.com ' +
 				'https://apis.google.com https://*.pusher.com https://code.jquery.com '+
 				'https://www.dropbox.com https://api.trello.com ' +
 				// Scripts in index.html (not checked here)
@@ -26,19 +26,29 @@ if (!mxIsElectron && location.protocol !== 'http:')
 			// font-src about: is required for MathJax HTML-CSS output with STIX
 			'img-src * data:; media-src * data:; font-src * about:; ' +
 			// www.draw.io required for browser data migration to app.diagrams.net
-			'frame-src \'self\' https://www.draw.io https://*.google.com; ' +
-			'style-src %dev-style-src% \'self\' \'unsafe-inline\' https://fonts.googleapis.com;';
+			'frame-src %frame-src% \'self\' https://www.draw.io https://*.google.com; ' +
+			'style-src %style-src% \'self\' \'unsafe-inline\' https://fonts.googleapis.com;'
+
 		var devCsp = csp.
-			// Loads common.css from mxgraph
-			replace(/%dev-style-src%/g, 'https://devhost.jgraph.com').
 			// Adds script tags and loads shapes with eval
-			replace(/%dev-script-src%/g, 'https://devhost.jgraph.com \'unsafe-eval\'');
+			replace(/%script-src%/g, 'https://devhost.jgraph.com \'unsafe-eval\'').
+			// Loads common.css from mxgraph
+			replace(/%style-src%/g, 'https://devhost.jgraph.com').
+			replace(/%frame-src%/g, '').
+			replace(/  /g, ' ');
 		mxmeta(null, devCsp, 'Content-Security-Policy');
 
-		console.log('Development', 'Content-Security-Policy', devCsp)
-		console.log('Production', 'Content-Security-Policy',
-			csp.replace(/%dev-style-src%/g, '').
-				replace(/%dev-script-src%/g, '').
+		console.log('Content-Security-Policy')
+		console.log('Development:', devCsp)
+		console.log('app.diagrams.net:',
+			csp.replace(/%script-src%/g, '').
+				replace(/%frame-src%/g, '').
+				replace(/%style-src%/g, '').
+				replace(/  /g, ' '));
+		console.log('confluence.draw.io:',
+			csp.replace(/%script-src%/g, 'https://aui-cdn.atlassian.com https://connect-cdn.atl-paas.net https://ajax.googleapis.com').
+				replace(/%frame-src%/g, 'https://www.lucidchart.com https://app.lucidchart.com').
+				replace(/%style-src%/g, 'https://aui-cdn.atlassian.com https://*.atlassian.net').
 				replace(/  /g, ' '));
 	})();
 }

+ 16 - 0
src/main/webapp/js/diagramly/DrawioFile.js

@@ -110,6 +110,11 @@ DrawioFile.prototype.opened = null;
  */
 DrawioFile.prototype.modified = false;
 
+/**
+ * Stores a shadow of the modified state.
+ */
+DrawioFile.prototype.shadowModified = false;
+
 /**
  * Holds a copy of the current file data.
  */
@@ -951,6 +956,16 @@ DrawioFile.prototype.isModified = function()
 	return this.modified;
 };
 
+DrawioFile.prototype.getShadowModified = function()
+{
+	return this.shadowModified;
+};
+
+DrawioFile.prototype.setShadowModified = function(value)
+{
+	this.shadowModified = value;
+};
+
 /**
  * Translates this point by the given vector.
  * 
@@ -960,6 +975,7 @@ DrawioFile.prototype.isModified = function()
 DrawioFile.prototype.setModified = function(value)
 {
 	this.modified = value;
+	this.shadowModified = value;
 };
 
 /**

+ 9 - 5
src/main/webapp/js/diagramly/EditorUi.js

@@ -9891,20 +9891,24 @@
 						}
 						else if (pasteAsLabel && graph.getSelectionCount() == 1)
 						{
+							var cell = graph.getStartEditingCell(graph.getSelectionCell(), evt);
+							
 							if ((/\.(gif|jpg|jpeg|tiff|png|svg)$/i).test(xml) &&
-								graph.getCurrentCellStyle(graph.getSelectionCell())[mxConstants.STYLE_SHAPE] == 'image')
+								graph.getCurrentCellStyle(cell)[mxConstants.STYLE_SHAPE] == 'image')
 							{
-								graph.setCellStyles(mxConstants.STYLE_IMAGE, xml);
+								graph.setCellStyles(mxConstants.STYLE_IMAGE, xml, [cell]);
 							}
 							else
 							{
-								graph.labelChanged(graph.getSelectionCell(), xml);
+								graph.labelChanged(cell, xml);
 	
 								if (Graph.isLink(xml))
 								{
-									graph.setLinkForCell(graph.getSelectionCell(), xml);
+									graph.setLinkForCell(cell, xml);
 								}
-							} 
+							}
+							
+							graph.setSelectionCell(cell);
 						}
 						else
 						{

+ 3 - 6
src/main/webapp/js/diagramly/ElectronApp.js

@@ -1275,16 +1275,12 @@ mxStencilRegistry.allowEval = false;
 					var savedData = this.data;
 					
 					// Makes sure no changes get lost while the file is saved
-					var prevModified = this.isModified;
-					var modified = this.isModified();
-					this.setModified(false);
+					this.setShadowModified(false);
 					this.savingFile = true;
 					
 					var errorWrapper = mxUtils.bind(this, function(e)
 					{
 						this.savingFile = false;
-						this.isModified = prevModified;
-						this.setModified(modified || this.isModified());
 						
 						if (error != null)
 						{
@@ -1306,8 +1302,9 @@ mxStencilRegistry.allowEval = false;
 						overwrite: overwrite
 					}, mxUtils.bind(this, function(resp)
 					{
+						//No changes during the saving process?
+						this.setModified(this.getShadowModified());
 						this.savingFile = false;
-						this.isModified = prevModified;
 						var lastDesc = this.stat;
 						this.stat = resp.stat;
 						

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

@@ -331,6 +331,12 @@ if (urlParams['offline'] == '1' || urlParams['demo'] == '1' || urlParams['stealt
 	urlParams['tr'] = '0';
 }
 
+// Uses embed mode on embed domain
+if (window.location.hostname == 'embed.diagrams.net')
+{
+	urlParams['embed'] = '1';
+}	
+
 // Disables math in offline mode
 if (urlParams['offline'] == '1' || urlParams['local'] == '1')
 {

+ 1 - 0
src/main/webapp/js/diagramly/Menus.js

@@ -299,6 +299,7 @@
 					if (allPages != this && this.checked)
 					{
 						crop.removeAttribute('disabled');
+						crop.checked = !graph.pageVisible;
 					}
 					else
 					{

+ 4 - 3
src/main/webapp/js/mxgraph/Editor.js

@@ -2692,7 +2692,7 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
 	 * Selects tables before cells and rows.
 	 */
 	var mxGraphHandlerIsPropagateSelectionCell = mxGraphHandler.prototype.isPropagateSelectionCell;
-	mxGraphHandler.prototype.isPropagateSelectionCell = function(cell, immediate)
+	mxGraphHandler.prototype.isPropagateSelectionCell = function(cell, immediate, me)
 	{
 		var result = false;
 		var parent = this.graph.model.getParent(cell)
@@ -2722,8 +2722,9 @@ FilenameDialog.createFileTypes = function(editorUi, nameInput, types)
 				}
 				
 				result = !this.graph.selectionCellsHandler.isHandled(table) ||
-					this.graph.isCellSelected(cell) || (this.graph.isTableCell(cell) &&
-					this.graph.isCellSelected(parent));
+					(this.graph.isCellSelected(table) && this.graph.isToggleEvent(me.getEvent())) ||
+					(this.graph.isCellSelected(cell) && !this.graph.isToggleEvent(me.getEvent())) ||
+					(this.graph.isTableCell(cell) && this.graph.isCellSelected(parent));
 			}
 		}
 		

+ 67 - 33
src/main/webapp/js/mxgraph/Graph.js

@@ -274,6 +274,7 @@ Graph = function(container, model, renderHint, stylesheet, themes, standalone)
 				    				this.model.getChildAt(row, 0) != state.cell) || mxUtils.intersects(box, new mxRectangle(
 			    					state.x + state.width - 1, state.y, 1, state.height)))
 		    					{
+			    					var wasSelected = this.selectionCellsHandler.isHandled(table);
 			    					this.selectCellForEvent(table, me.getEvent());
 					    			handler = this.selectionCellsHandler.getHandler(table);
 		
@@ -284,6 +285,7 @@ Graph = function(container, model, renderHint, stylesheet, themes, standalone)
 					    				if (handle != null)
 					    				{
 					    					handler.start(me.getGraphX(), me.getGraphY(), handle);
+					    					handler.blockDelayedSelection = !wasSelected;
 					    					me.consume();
 					    				}
 					    			}
@@ -1561,7 +1563,46 @@ Graph.prototype.init = function(container)
 	 * Contains the offset.
 	 */
 	Graph.prototype.currentTranslate = new mxPoint(0, 0);
-
+	
+	/**
+	 * Returns the cell for editing the given cell.
+	 */
+	Graph.prototype.getStartEditingCell = function(cell, trigger)
+	{
+		// Redirect editing for tables
+		var style = this.getCellStyle(cell);
+		var size = parseInt(mxUtils.getValue(style, mxConstants.STYLE_STARTSIZE, 0));
+		
+		if (this.isTable(cell) && (!this.isSwimlane(cell) ||
+			size == 0) && this.getLabel(cell) == '' &&
+			this.model.getChildCount(cell) > 0)
+		{
+			cell = this.model.getChildAt(cell, 0);
+			
+			style = this.getCellStyle(cell);
+			size = parseInt(mxUtils.getValue(style, mxConstants.STYLE_STARTSIZE, 0));
+		}
+		
+		// Redirect editing for table rows
+		if (this.isTableRow(cell) && (!this.isSwimlane(cell) ||
+			size == 0) && this.getLabel(cell) == '' &&
+			this.model.getChildCount(cell) > 0)
+		{
+			for (var i = 0; i < this.model.getChildCount(cell); i++)
+			{
+				var temp = this.model.getChildAt(cell, i);
+				
+				if (this.isCellEditable(temp))
+				{
+					cell = temp;
+					break;
+				}
+			}
+		}
+		
+		return cell;
+	};
+	
 	/**
 	 * Returns true if fast zoom preview should be used.
 	 */
@@ -9035,41 +9076,15 @@ if (typeof mxVertexHandler != 'undefined')
 		 * HTML in-place editor
 		 */
 		mxCellEditor.prototype.escapeCancelsEditing = false;
-		
+
+		/**
+		 * Overridden to set CSS classes.
+		 */
 		var mxCellEditorStartEditing = mxCellEditor.prototype.startEditing;
 		mxCellEditor.prototype.startEditing = function(cell, trigger)
 		{
-			// Redirect editing for tables
-			var style = this.graph.getCellStyle(cell);
-			var size = parseInt(mxUtils.getValue(style, mxConstants.STYLE_STARTSIZE, 0));
-			
-			if (this.graph.isTable(cell) && (!this.graph.isSwimlane(cell) ||
-				size == 0) && this.graph.getLabel(cell) == '' &&
-				this.graph.model.getChildCount(cell) > 0)
-			{
-				cell = this.graph.model.getChildAt(cell, 0);
-				
-				style = this.graph.getCellStyle(cell);
-				size = parseInt(mxUtils.getValue(style, mxConstants.STYLE_STARTSIZE, 0));
-			}
-			
-			// Redirect editing for table rows
-			if (this.graph.isTableRow(cell) && (!this.graph.isSwimlane(cell) ||
-				size == 0) && this.graph.getLabel(cell) == '' &&
-				this.graph.model.getChildCount(cell) > 0)
-			{
-				for (var i = 0; i < this.graph.model.getChildCount(cell); i++)
-				{
-					var temp = this.graph.model.getChildAt(cell, i);
-					
-					if (this.graph.isCellEditable(temp))
-					{
-						cell = temp;
-						break;
-					}
-				}
-			}
-			
+			cell = this.graph.getStartEditingCell(cell, trigger);
+
 			mxCellEditorStartEditing.apply(this, arguments);
 			
 			// Overrides class in case of HTML content to add
@@ -9883,6 +9898,7 @@ if (typeof mxVertexHandler != 'undefined')
 				var model = graph.model;
 				var tableState = this.state;
 				var sel = this.selectionBorder;
+				var self = this;
 				
 				if (handles == null)
 				{
@@ -9955,6 +9971,11 @@ if (typeof mxVertexHandler != 'undefined')
 									graph.setTableColumnWidth(this.state.cell,
 										dx, shiftPressed);
 								}
+								else if (!self.blockDelayedSelection)
+								{
+									var temp = graph.getCellAt(me.getGraphX(), me.getGraphY()) || tableState.cell; 
+									graph.selectCellForEvent(temp, me.getEvent());
+								}
 								
 								dx = 0;
 							};
@@ -10012,6 +10033,11 @@ if (typeof mxVertexHandler != 'undefined')
 									graph.setTableRowHeight(this.state.cell, dy,
 										!mxEvent.isShiftDown(me.getEvent()));
 								}
+								else if (!self.blockDelayedSelection)
+								{
+									var temp = graph.getCellAt(me.getGraphX(), me.getGraphY()) || tableState.cell; 
+									graph.selectCellForEvent(temp, me.getEvent());
+								}
 								
 								dy = 0;
 							};
@@ -10946,6 +10972,9 @@ if (typeof mxVertexHandler != 'undefined')
 			{
 				this.linkHint.style.display = '';
 			}
+			
+			// Resets state after gesture
+			this.blockDelayedSelection = null;
 		};
 	
 		var vertexHandlerInit = mxVertexHandler.prototype.init;
@@ -11212,6 +11241,11 @@ if (typeof mxVertexHandler != 'undefined')
 				ch[3].bounds.x = ch[1].bounds.x;
 				ch[3].bounds.y = ch[2].bounds.y;
 				ch[3].redraw();
+				
+				for (var i = 0; i < this.cornerHandles.length; i++)
+				{
+					this.cornerHandles[i].node.style.display = (this.graph.getSelectionCount() == 1) ? '' : 'none';
+				}
 			}
 			
 			// Shows rotation handle only if one vertex is selected

+ 11 - 1
src/main/webapp/js/mxgraph/Toolbar.js

@@ -290,6 +290,17 @@ Toolbar.prototype.addTableDropDown = function()
 		elt.getElementsByTagName('img')[0].style.top = '5px';
 	}
 	
+	// Connects to insert menu enabled state
+	var menu = this.editorUi.menus.get('insert');
+	
+	if (menu != null)
+	{
+		menu.addListener('stateChanged', function()
+		{
+			elt.setEnabled(menu.enabled);
+		});
+	}
+	
 	return elt;
 };
 
@@ -528,7 +539,6 @@ Toolbar.prototype.createTextToolbar = function()
 	
 	this.addSeparator();
 	
-	// FIXME: Uses geButton here and geLabel in main menu
 	var insertMenu = this.addMenuFunction('', mxResources.get('insert'), true, mxUtils.bind(this, function(menu)
 	{
 		menu.addItem(mxResources.get('insertLink'), null, mxUtils.bind(this, function()

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


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