Skip to content

Commit

Permalink
21.1.6 release
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgraph committed Apr 11, 2023
1 parent b8c9e6c commit a117e3d
Show file tree
Hide file tree
Showing 80 changed files with 5,295 additions and 5,104 deletions.
17 changes: 17 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,20 @@
11-APR-2023: 21.1.6

- [conf cloud] Fixes large instances page IDs export and import and using new API [DID-7895]
- Fixes safari bug with embed mode (calling App.main twice) [drawio-nextcloud-37]
- Adds support for links to pages in print preview [drawio-722]
- Blocks direct links to plantUML images generator and from other domains [CSP-1717]
- Fixes OneDrive saving large files with non-Ascii characters [drawio-3481]
- Prevents mermaid insertion errors when mxMermaidToDrawio is not available [drawio-3488]

06-APR-2023: 21.1.5

- Fixes asynchronous MathJax rendering [drawio-2876]
- Added mermaid insertion as draw.io diagram to Atlassian [drawio-3488]
- [conf cloud] Adds support for importing Gliffy macros with no diagram name (only attachment ID) [DID-7470]
- [conf cloud] Fixed space filter search when key has "-" [DID-7470]
- [conf cloud] Added support for Historical revisions of imported pages [DID-7233]

04-APR-2023: 21.1.4

- Remerge and release of dev branch
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
21.1.4
21.1.6
2 changes: 1 addition & 1 deletion src/main/webapp/export3.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@
<script src="js/app.min.js"></script>
<script src="js/export.js"></script>
</head>
<body style="margin:0px;overflow:hidden">
<body style="margin:0px;overflow:hidden;">
</body>
</html>
3,367 changes: 1,685 additions & 1,682 deletions src/main/webapp/js/app.min.js

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions src/main/webapp/js/diagramly/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,14 @@ App.main = function(callback, createUi)
{
try
{
// This function is called only once, so we can set the flag here
// Safari calls window.load event when the location hash is set (e.g, on descriptor change) resulting in calling main twice
if (App.isMainCalled)
{
return;
}

App.isMainCalled = true;
// Handles uncaught errors before the app is loaded
window.onerror = function(message, url, linenumber, colno, err)
{
Expand Down
6 changes: 4 additions & 2 deletions src/main/webapp/js/diagramly/Dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,8 @@ var ParseDialog = function(editorUi, title, defaultType)
var diagramType = lines[k].trim().toLowerCase();
var sp = diagramType.indexOf(' ');
diagramType = diagramType.substring(0, sp > 0 ? sp : diagramType.length);
var inDrawioFormat = type == 'mermaid2drawio' && diagramType != 'gantt' && diagramType != 'pie';
var inDrawioFormat = typeof mxMermaidToDrawio !== 'undefined' &&
type == 'mermaid2drawio' && diagramType != 'gantt' && diagramType != 'pie';

var graph = editorUi.editor.graph;

Expand Down Expand Up @@ -2534,7 +2535,8 @@ var ParseDialog = function(editorUi, title, defaultType)
var typeSelect = document.createElement('select');
typeSelect.className = 'geBtn';

if (defaultType == 'formatSql' || (defaultType == 'mermaid' && editorUi.getServiceName() != 'draw.io'))
if (defaultType == 'formatSql' || (defaultType == 'mermaid' &&
editorUi.getServiceName() != 'draw.io' && editorUi.getServiceName() != 'atlassian'))
{
typeSelect.style.display = 'none';
}
Expand Down
2 changes: 0 additions & 2 deletions src/main/webapp/js/diagramly/DrawioFileSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -1253,8 +1253,6 @@ DrawioFileSync.prototype.merge = function(patches, checksum, desc, success, erro
}
}), mxUtils.bind(this, function()
{
logError(true);

if (error != null)
{
error();
Expand Down
61 changes: 51 additions & 10 deletions src/main/webapp/js/diagramly/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -2515,29 +2515,64 @@
{
src = (src != null) ? src : DRAW_MATH_URL + '/startup.js';
Editor.mathJaxQueue = [];

// Blocks concurrent rendering while
// async rendering is in progress
var rendering = null;

function mathJaxDone()
{
rendering = null;

if (Editor.mathJaxQueue.length > 0)
{
Editor.doMathJaxRender(Editor.mathJaxQueue.shift());
}
else
{
Editor.onMathJaxDone();
}
};

Editor.doMathJaxRender = function(container)
{
try
{
MathJax.typesetClear([container]);
MathJax.typeset([container]);
Editor.onMathJaxDone();
if (rendering == null)
{
MathJax.typesetClear([container]);
MathJax.typeset([container]);
mathJaxDone();
}
else if (rendering != container)
{
Editor.mathJaxQueue.push(container);
}
}
catch (e)
{
MathJax.typesetClear([container]);

if (e.retry != null)
{
rendering = container;

e.retry.then(function()
{
MathJax.typesetPromise([container]).then(Editor.onMathJaxDone);
});
MathJax.typesetPromise([container]).then(mathJaxDone)['catch'](function(e)
{
console.log('Error in MathJax.typesetPromise: ' + e.toString());
mathJaxDone();
});
})['catch'](function(e)
{
console.log('Error in MathJax.retry: ' + e.toString());
mathJaxDone();
});;
}
else if (window.console != null)
{
console.log('Error in MathJax: ' + e.toString());
console.log('Error in MathJax.typeset: ' + e.toString());
}
}
};
Expand Down Expand Up @@ -4339,6 +4374,7 @@

mxCellRenderer.defaultShapes['swimlane'].prototype.customProperties = [
{name: 'arcSize', dispName: 'Arc Size', type: 'float', min:0, defVal: 15},
{name: 'absoluteArcSize', dispName: 'Abs. Arc Size', type: 'bool', defVal: false},
{name: 'startSize', dispName: 'Header Size', type: 'float'},
{name: 'swimlaneHead', dispName: 'Head Border', type: 'bool', defVal: true},
{name: 'swimlaneBody', dispName: 'Body Border', type: 'bool', defVal: true},
Expand Down Expand Up @@ -8206,7 +8242,7 @@
graph.refresh();
}

function printGraph(thisGraph, pv, forcePageBreaks)
function printGraph(thisGraph, pv, forcePageBreaks, pageId)
{
// Workaround for CSS transforms affecting the print output
// is to disable during print output and restore after
Expand Down Expand Up @@ -8271,6 +8307,8 @@
{
autoOrigin = true;
}

var anchorId = (pageId != null) ? 'page/id,' + pageId : null;

if (pv == null)
{
Expand Down Expand Up @@ -8384,7 +8422,7 @@
}

// Generates the print output
pv.open(null, null, forcePageBreaks, true);
pv.open(null, null, forcePageBreaks, true, anchorId);

// Restores flowAnimation
graph.enableFlowAnimation = enableFlowAnimation;
Expand All @@ -8409,7 +8447,7 @@

pv.backgroundColor = bg;
pv.autoOrigin = autoOrigin;
pv.appendGraph(thisGraph, scale, x0, y0, forcePageBreaks, true);
pv.appendGraph(thisGraph, scale, x0, y0, forcePageBreaks, true, anchorId);

var extFonts = thisGraph.getCustomFonts();

Expand Down Expand Up @@ -8582,7 +8620,7 @@
tempGraph.model.setRoot(page.root);
}

pv = printGraph(tempGraph, pv, i != imax);
pv = printGraph(tempGraph, pv, i != imax, page.getId());

if (tempGraph != graph)
{
Expand Down Expand Up @@ -8617,6 +8655,9 @@
}

pv.closeDocument();

// Rewrites page links to point to internal anchors
Graph.rewritePageLinks(pv.wnd.document);

if (!pv.mathEnabled && print)
{
Expand Down
17 changes: 10 additions & 7 deletions src/main/webapp/js/diagramly/OneDriveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,9 @@ OneDriveClient.prototype.writeLargeFile = function(url, data, success, error, et

if (data != null)
{
var uploadPart = mxUtils.bind(this, function(uploadUrl, index, retryCount)
var dataByteLength = (new TextEncoder().encode(data)).length;

var uploadPart = mxUtils.bind(this, function(uploadUrl, index, byteIndex, retryCount)
{
try
{
Expand All @@ -1009,12 +1011,13 @@ OneDriveClient.prototype.writeLargeFile = function(url, data, success, error, et
}), this.ui.timeout);

var part = data.substr(index, chunkSize);
var partByteLength = (new TextEncoder().encode(part)).length;
var req = new mxXmlRequest(uploadUrl, part, 'PUT');

req.setRequestHeaders = mxUtils.bind(this, function(request, params)
{
request.setRequestHeader('Content-Length', part.length);
request.setRequestHeader('Content-Range', 'bytes ' + index + '-' + (index + part.length - 1) + '/' + data.length);
request.setRequestHeader('Content-Range', 'bytes ' + byteIndex + '-' +
(byteIndex + partByteLength - 1) + '/' + dataByteLength);
});

req.send(mxUtils.bind(this, function(req)
Expand All @@ -1034,13 +1037,13 @@ OneDriveClient.prototype.writeLargeFile = function(url, data, success, error, et
}
else
{
uploadPart(uploadUrl, nextByte, retryCount);
uploadPart(uploadUrl, nextByte, byteIndex + partByteLength, retryCount);
}
}
else if (status >= 500 && status <= 599 && retryCount < 2) //Retry on server errors
{
retryCount++;
uploadPart(uploadUrl, index, retryCount);
uploadPart(uploadUrl, index, byteIndex, retryCount);
}
else
{
Expand Down Expand Up @@ -1105,7 +1108,7 @@ OneDriveClient.prototype.writeLargeFile = function(url, data, success, error, et
if (req.getStatus() >= 200 && req.getStatus() <= 299)
{
var resp = JSON.parse(req.getText());
uploadPart(resp.uploadUrl, 0);
uploadPart(resp.uploadUrl, 0, 0);
}
else if (!failOnAuth && req.getStatus() === 401)
{
Expand Down
35 changes: 24 additions & 11 deletions src/main/webapp/js/export.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@ function render(data)
graph.globalVars = extras.globalVars;
}

/**
* Disables custom links but allows page links.
*/
function isLinkIgnored(graph, link)
{
return link == null || (graph.isCustomLink(link) && !Graph.isPageLink(link));
};

/**
* Disables custom links on shapes.
*/
Expand All @@ -199,8 +207,8 @@ function render(data)
graph.getLinkForCell = function(cell)
{
var link = graphGetLinkForCell.apply(this, arguments);
if (link != null && this.isCustomLink(link))

if (isLinkIgnored(this, link))
{
link = null;
}
Expand All @@ -225,7 +233,7 @@ function render(data)
{
var href = links[i].getAttribute('href');

if (href != null && graph.isCustomLink(href))
if (isLinkIgnored(graph, href))
{
links[i].setAttribute('href', '#');
}
Expand All @@ -251,6 +259,9 @@ function render(data)
//Ensure that all fonts has been loaded, this promise is never rejected
document.fonts.ready.then(function()
{
// Rewrite page links
Graph.rewritePageLinks(document);

var doneDiv = document.createElement("div");
var pageCount = diagrams != null? diagrams.length : 1;
doneDiv.id = 'LoadingComplete';
Expand Down Expand Up @@ -472,7 +483,7 @@ function render(data)
return origAddFont.call(this, name, url, decrementWaitCounter);
};

function renderPage()
function renderPage(currentPageId)
{
// Enables math typesetting
math |= xmlDoc.documentElement.getAttribute('math') == '1';
Expand Down Expand Up @@ -803,6 +814,8 @@ function render(data)
x0 -= layout.x * pf.width;
y0 -= layout.y * pf.height;
}

var anchorId = (currentPageId != null) ? 'page/id,' + currentPageId : null;

if (preview == null)
{
Expand All @@ -811,14 +824,14 @@ function render(data)
preview.autoOrigin = autoOrigin;
preview.backgroundColor = bg;
// Renders print output into this document and removes the graph container
preview.open(null, window);
preview.open(null, window, null, null, anchorId);
graph.container.parentNode.removeChild(graph.container);
}
else
{
preview.backgroundColor = bg;
preview.autoOrigin = autoOrigin;
preview.appendGraph(graph, scale, x0, y0);
preview.appendGraph(graph, scale, x0, y0, null, null, anchorId);
}

// Adds shadow
Expand Down Expand Up @@ -932,7 +945,7 @@ function render(data)
{
if (pageId == null)
{
pageId = diagrams[i].getAttribute('id')
pageId = diagrams[i].getAttribute('id');
}

xmlDoc = Editor.parseDiagramNode(diagrams[i]);
Expand All @@ -944,7 +957,7 @@ function render(data)

graph.getModel().clear();
from = i;
renderPage();
renderPage(diagrams[i].getAttribute('id'));
}
}
}
Expand All @@ -955,9 +968,9 @@ function render(data)

if (fallbackFont)
{
//Add a fallbackFont font to all labels in case the selected font doesn't support the character
//Some systems doesn't have a good fallback fomt that supports all languages
//Use this with a custom font-face in export-fonts.css file
// Add a fallbackFont font to all labels in case the selected font doesn't support the character
// Some systems doesn't have a good fallback fomt that supports all languages
// Use this with a custom font-face in export-fonts.css file
document.querySelectorAll('foreignObject div').forEach(d => d.style.fontFamily = (d.style.fontFamily || '') + ', ' + fallbackFont);
}

Expand Down
Loading

0 comments on commit a117e3d

Please sign in to comment.