Skip to content
Permalink
Browse files

9.3.4 release

  • Loading branch information...
David Benson
David Benson committed Nov 7, 2018
1 parent 94642c3 commit 6fbf5bc048f99af6d3d20ac1ada6b2eaa8a9d79a
Showing with 5,033 additions and 3,463 deletions.
  1. +9 −0 ChangeLog
  2. +1 −1 VERSION
  3. +1 −1 etc/mxgraph/mxClient.js
  4. +1 −1 etc/vsd/README.txt
  5. +2 −1 src/main/java/com/mxgraph/io/gliffy/importer/GliffyDiagramConverter.java
  6. +131 −0 src/main/java/com/mxgraph/io/gliffy/importer/SVGImporterUtils.java
  7. +4 −1 src/main/java/com/mxgraph/io/gliffy/model/GliffyObject.java
  8. BIN src/main/webapp/WEB-INF/lib/mxgraph-core.jar
  9. +1 −1 src/main/webapp/cache.manifest
  10. +113 −1 src/main/webapp/index.html
  11. +858 −822 src/main/webapp/js/app.min.js
  12. +956 −951 src/main/webapp/js/atlas-viewer.min.js
  13. +399 −392 src/main/webapp/js/atlas.min.js
  14. +53 −14 src/main/webapp/js/diagramly/App.js
  15. +178 −36 src/main/webapp/js/diagramly/DistanceGuides.js
  16. +80 −59 src/main/webapp/js/diagramly/DrawioFile.js
  17. +503 −68 src/main/webapp/js/diagramly/DriveClient.js
  18. +429 −38 src/main/webapp/js/diagramly/DriveFile.js
  19. +40 −7 src/main/webapp/js/diagramly/DriveRealtime.js
  20. +25 −1 src/main/webapp/js/diagramly/Editor.js
  21. +46 −3 src/main/webapp/js/diagramly/EditorUi.js
  22. +1 −1 src/main/webapp/js/diagramly/GitHubClient.js
  23. +37 −26 src/main/webapp/js/diagramly/Menus.js
  24. +7 −4 src/main/webapp/js/diagramly/Minimal.js
  25. +5 −3 src/main/webapp/js/diagramly/Pages.js
  26. +8 −8 src/main/webapp/js/diagramly/vsdx/importer.js
  27. +12 −11 src/main/webapp/js/embed-static.min.js
  28. +8 −8 src/main/webapp/js/extensions.min.js
  29. +2 −8 src/main/webapp/js/mxgraph/Dialogs.js
  30. +12 −0 src/main/webapp/js/mxgraph/Graph.js
  31. +12 −11 src/main/webapp/js/reader.min.js
  32. +2 −1 src/main/webapp/js/sanitizer/sanitizer.min.js
  33. +956 −951 src/main/webapp/js/viewer.min.js
  34. +3 −1 src/main/webapp/resources/dia.txt
  35. +3 −1 src/main/webapp/resources/dia_am.txt
  36. +3 −1 src/main/webapp/resources/dia_ar.txt
  37. +2 −0 src/main/webapp/resources/dia_bg.txt
  38. +3 −1 src/main/webapp/resources/dia_bn.txt
  39. +2 −0 src/main/webapp/resources/dia_bs.txt
  40. +2 −0 src/main/webapp/resources/dia_ca.txt
  41. +2 −0 src/main/webapp/resources/dia_cs.txt
  42. +2 −0 src/main/webapp/resources/dia_da.txt
  43. +3 −1 src/main/webapp/resources/dia_de.txt
  44. +2 −0 src/main/webapp/resources/dia_el.txt
  45. +11 −9 src/main/webapp/resources/dia_eo.txt
  46. +2 −0 src/main/webapp/resources/dia_es.txt
  47. +2 −0 src/main/webapp/resources/dia_et.txt
  48. +2 −0 src/main/webapp/resources/dia_fa.txt
  49. +2 −0 src/main/webapp/resources/dia_fi.txt
  50. +2 −0 src/main/webapp/resources/dia_fil.txt
  51. +2 −0 src/main/webapp/resources/dia_fr.txt
  52. +3 −1 src/main/webapp/resources/dia_gu.txt
  53. +2 −0 src/main/webapp/resources/dia_he.txt
  54. +3 −1 src/main/webapp/resources/dia_hi.txt
  55. +3 −1 src/main/webapp/resources/dia_hr.txt
  56. +2 −0 src/main/webapp/resources/dia_hu.txt
  57. +2 −0 src/main/webapp/resources/dia_i18n.txt
  58. +2 −0 src/main/webapp/resources/dia_id.txt
  59. +2 −0 src/main/webapp/resources/dia_it.txt
  60. +2 −0 src/main/webapp/resources/dia_ja.txt
  61. +3 −1 src/main/webapp/resources/dia_kn.txt
  62. +2 −0 src/main/webapp/resources/dia_ko.txt
  63. +3 −1 src/main/webapp/resources/dia_lt.txt
  64. +3 −1 src/main/webapp/resources/dia_lv.txt
  65. +3 −1 src/main/webapp/resources/dia_ml.txt
  66. +3 −1 src/main/webapp/resources/dia_mr.txt
  67. +2 −0 src/main/webapp/resources/dia_ms.txt
  68. +8 −6 src/main/webapp/resources/dia_nl.txt
  69. +2 −0 src/main/webapp/resources/dia_no.txt
  70. +2 −0 src/main/webapp/resources/dia_pl.txt
  71. +2 −0 src/main/webapp/resources/dia_pt-br.txt
  72. +2 −0 src/main/webapp/resources/dia_pt.txt
  73. +2 −0 src/main/webapp/resources/dia_ro.txt
  74. +2 −0 src/main/webapp/resources/dia_ru.txt
  75. +3 −1 src/main/webapp/resources/dia_sk.txt
  76. +3 −1 src/main/webapp/resources/dia_sl.txt
  77. +2 −0 src/main/webapp/resources/dia_sr.txt
  78. +2 −0 src/main/webapp/resources/dia_sv.txt
  79. +3 −1 src/main/webapp/resources/dia_sw.txt
  80. +3 −1 src/main/webapp/resources/dia_ta.txt
  81. +3 −1 src/main/webapp/resources/dia_te.txt
  82. +2 −0 src/main/webapp/resources/dia_th.txt
  83. +2 −0 src/main/webapp/resources/dia_tr.txt
  84. +2 −0 src/main/webapp/resources/dia_uk.txt
  85. +2 −0 src/main/webapp/resources/dia_vi.txt
  86. +2 −0 src/main/webapp/resources/dia_zh-tw.txt
  87. +2 −0 src/main/webapp/resources/dia_zh.txt
@@ -1,3 +1,12 @@
06-NOV-2018: 9.3.4

- Improves sanity check for Google Drive files
- Uses mxGraph 3.9.11 beta 4

02-NOV-2018: 9.3.2

- Adds sanity check for Google Drive files

26-OCT-2018: 9.3.1

- Adds current page index to JSON protocol
@@ -1 +1 @@
9.3.1
9.3.4

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -36,7 +36,7 @@ Running the conversion site without Hyper-V:
========================================
Running the conversion site with Hyper-V:

1- Run VsdConverterApp TCP sever
1- Run VsdConverterApp TCP sever (Also disable QuickEdit Mode: Property > Options > Edit Options > QuickEdit Mode)
2- Deploy VsdConverter to IIS (manually or using Web Deployment Tool).

In details (Ignore Hyper-V steps if it is running directly on the server):
@@ -811,7 +811,8 @@ else if (gliffyObject.isSvg())
cell.setVertex(true);
style.append("shape=image;imageAspect=0;");
Resource res = gliffyDiagram.embeddedResources.get(svg.embeddedResourceId);

SVGImporterUtils svgUtils = new SVGImporterUtils();
res.data = svgUtils.setViewBox(res.data);
style.append("image=data:image/svg+xml,").append(res.getBase64EncodedData()).append(";");
}
}
@@ -0,0 +1,131 @@
package com.mxgraph.io.gliffy.importer;

import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.lang.reflect.Method;
import java.nio.charset.StandardCharsets;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* Class is used to stripe large unused white areas on SVG files and return only important parts.
* For example, if you have centered square of 50x50 size on 200x200 canvas this class will remove
* unused portions of the canvas and return larger square from the center.
*
*/
public class SVGImporterUtils
{

private static final Pattern SVG_PATTERN = Pattern.compile("viewBox=\"(.*?)\"");

private final static Logger LOGGER = Logger.getLogger(SVGImporterUtils.class.getName());

public SVGImporterUtils()
{
}

/**
* This is main method that will return new viewBox value. Then we use this value to update existing SVG string in Gliffy object.
*
* @param svgString original SVG string from Gliffy Object.
* @return recalculated viewBox parameters as a String
*/
public String setViewBox(String svgString)
{
try
{
Matcher m = SVG_PATTERN.matcher(svgString);
while (m.find())
{
String oldViewBox = m.group();
String newViewBox = getNewViewBox(svgString);
if (newViewBox != null)
{
return svgString.replace(oldViewBox, newViewBox);
}
}
}
catch (Throwable exc)
{
//perfectly fine to blow-up, just ignore - original string will be returned if something goes wrong
LOGGER.log(Level.WARNING, "Cannot set viewBox for: " + svgString + " with error " + exc);
}

return svgString;
}

private String getNewViewBox(String svgString) throws Exception
{
String result = null;
Object svg = createSVGDocument(svgString);
buildDocument(svg);
result = getViewBoxString(svg);
return result;
}

private Object createSVGDocument(String svgString) throws Exception
{
InputStream stream = new ByteArrayInputStream(svgString.getBytes(StandardCharsets.UTF_8));
Class<?> myClass = Class.forName("org.apache.batik.dom.svg.SAXSVGDocumentFactory");
Method myMethod = myClass.getDeclaredMethod("createSVGDocument", String.class, InputStream.class);
String param = null;
Object newInstance = myClass.getConstructor(String.class).newInstance(param);
Object o = myMethod.invoke(newInstance, "http://www.w3.org/2000/svg", stream);
return o;
}

private void buildDocument(Object svg) throws Exception
{
Class<?> bridgeContextClass = Class.forName("org.apache.batik.bridge.BridgeContext");
Class<?> userAgentAdapterClass = Class.forName("org.apache.batik.bridge.UserAgentAdapter");
Class<?> userAgentClass = Class.forName("org.apache.batik.bridge.UserAgent");
Class<?> gvtBuilderClass = Class.forName("org.apache.batik.bridge.GVTBuilder");
Class<?> documentClass = Class.forName("org.w3c.dom.Document");

Method myBuildMethod = gvtBuilderClass.getDeclaredMethod("build", bridgeContextClass, documentClass);
Object newBuilderInstance = gvtBuilderClass.getConstructor().newInstance();
Object newUserAgentAdapterInstance = userAgentAdapterClass.getConstructor().newInstance();
Object newBridgeContextClass = bridgeContextClass.getConstructor(userAgentClass).newInstance(newUserAgentAdapterInstance);
myBuildMethod.invoke(newBuilderInstance, newBridgeContextClass, svg);

}

private String getViewBoxString(Object svg) throws Exception
{
Class<?> svgDocumentClass = Class.forName("org.apache.batik.dom.svg.SVGOMDocument");
Class<?> svgSVGElement = Class.forName("org.apache.batik.dom.svg.SVGOMSVGElement");
Class<?> svgRect = Class.forName("org.w3c.dom.svg.SVGRect");

Method getRootElement = svgDocumentClass.getDeclaredMethod("getRootElement");
Method getBBox = svgSVGElement.getDeclaredMethod("getBBox");
Method getX = svgRect.getDeclaredMethod("getX");
Method getY = svgRect.getDeclaredMethod("getY");
Method getHeight = svgRect.getDeclaredMethod("getHeight");
Method getWidth = svgRect.getDeclaredMethod("getWidth");

Object root = getRootElement.invoke(svg);
Object bbox = getBBox.invoke(root);
Object x = getX.invoke(bbox);
Object y = getY.invoke(bbox);
Object height = getHeight.invoke(bbox);
Object width = getWidth.invoke(bbox);

String result = String.format("viewBox=\"%s %s %s %s\"", getIntValue(x.toString()), getIntValue(y.toString()),
getIntValue(width.toString()), getIntValue(height.toString()));
return result;

}

private String getIntValue(String value)
{
int dot = value.indexOf(".");
if (dot > 0)
{
return value.substring(0, dot);
}
return value;
}

}
@@ -284,7 +284,10 @@ private GliffyObject getTextObject(double x, double y)

public String getText()
{
return graphic.getText().getHtml();
GliffyText text = graphic.getText();
//TODO These values are hurestics based on analyzing many files. 6 is a range from 2 to 6 so used the maximum
int widthDiff = "none".equals(text.overflow)? -3 : 6;
return "<div style='width: "+ (width + widthDiff) +"px;height: "+ height +"px;word-break: break-word;'>" + text.getHtml() + "</div>";
}

/**
Binary file not shown.
@@ -1,7 +1,7 @@
CACHE MANIFEST

# THIS FILE WAS GENERATED. DO NOT MODIFY!
# 10/26/2018 05:46 PM
# 11/06/2018 04:33 PM

app.html
index.html?offline=1
@@ -410,7 +410,119 @@ <h2 id="geStatus">Loading...</h2>
/**
* Main
*/
App.main();
App.main(function (ui)
{
// **************************************************
// TESTING JSON TO XML CONVERTER FOR EOL OF GOOGLE RT
// **************************************************
// ui.JSON_CHECK = 'JSON-CHECK7';
// DriveFile.prototype.runCheck = function(json, fileNode, fileData)
// {
// try
// {
// this.debug('JSON Check', this.desc, json);
// if (this.ui.getCurrentFile() == this && !this.isModified())
// {
// // Gets comparable XML structures
// var convert = (json != null) ? this.getComparableFile(this.ui.drive.convertJsonToXml(json, true)) : null;
// var remote = (fileNode != null) ? this.getComparableFile(fileNode) : null;
// var local = this.getComparableFile(this.ui.getXmlFileData());
// // Uses the newer of the two
// var age = this.ui.drive.getRealtimeAge(this.desc, json);
// var relevant = (age < 0 && convert != null) ? convert : remote;
// if (local == null || relevant == null || !local.isEqualNode(relevant))
// {
// this.log('FAIL-REPORT');
// var summary = ((relevant == convert) ? 'Source: Convert' : 'Source: Remote') +
// '\nFile modified: ' + new Date(this.desc.modifiedDate).toUTCString();
// if (json != null)
// {
// var mod = (json.value != null && json.value.modifiedDate != null) ? json.value.modifiedDate.json : null;
// if (mod != null)
// {
// summary += '\nJson modified: ' + new Date(mod).toUTCString();
// }
// var bak = (json.value != null && json.value.backupDate != null) ? json.value.backupDate.json : null;
// if (bak != null)
// {
// summary += '\nJson backedup: ' + new Date(bak).toUTCString();
// }
// }
// if (local != null)
// {
// if (convert != null)
// {
// summary += '\nConvert-Equals-Local: ' + convert.isEqualNode(local);
// }
// if (remote != null)
// {
// summary += '\nRemote-Equals-Local: ' + remote.isEqualNode(local);
// }
// }
// this.report('Realtime Error Report ' + new Date() +
// '\n\nDescription: ' + JSON.stringify({version: this.ui.JSON_CHECK,
// realtimeAge: age, title: this.desc.title, editable: this.desc.editable,
// copyable: this.desc.copyable, labels: this.desc.labels, id: this.desc.id,
// userPermission: this.desc.userPermission, fileSize: this.desc.fileSize,
// fileExtension: this.desc.fileExtension, modifiedDate: this.desc.modifiedDate,
// mimeType: this.desc.mimeType}) +
// '\n\nSummary:\n' + summary +
// '\n\nLocal:\n' + this.getAnonymizedXml(local) +
// '\n\nRemote:\n' + this.getAnonymizedXml(remote) +
// ((remote == null) ? ('\n\nData:\n' + fileData) : '') +
// '\n\nConvert:\n' + this.getAnonymizedXml(convert) +
// '\n\nJSON:\n' + this.getAnonymizedJson(json));
// }
// else
// {
// this.log('OK-age.' + age + '.');
// }
// }
// }
// catch (e)
// {
// this.log('CATCH-RUNCHECK-' + e.stack, true);
// this.debug(e);
// }
// };
// ui.editor.addListener('fileLoaded', mxUtils.bind(this, function()
// {
// try
// {
// var file = ui.getCurrentFile();
// if (file != null && file.constructor == DriveFile && file.realtime != null)
// {
// // With a 30% probability
// if (urlParams['json-check'] != '0' && (urlParams['json-check'] == '1' ||
// (Math.random() > 0.3 && urlParams['dev'] != '1')))
// {
// file.checkConvert();
// }
// }
// }
// catch (e)
// {
// // ignore
// }
// }));
// ***********
// END OF TEST
// ***********
});
</script>
</body>
</html>
Oops, something went wrong.

0 comments on commit 6fbf5bc

Please sign in to comment.
You can’t perform that action at this time.