Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/jgraph/drawio into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Feb 1, 2024
2 parents 1e91764 + bfe2276 commit 21b3fc3
Show file tree
Hide file tree
Showing 80 changed files with 2,636 additions and 2,572 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
31-JAN-2024: 23.1.0

- Fixes smoothing configuration for freehand [drawio-3093]
- Fixes loading of uncompressed templates with CORS headers
- [conf cloud] Handles trailing spaces in the diagram name for gliffy import [DID-10460]
- Changes auth paths to use server url prefix
- [conf cloud] Fixed outdated drafts when page is copied [DID-10546]
- [conf cloud] Handles macros with macroId only parameter in gliffy import [DID-10460]

25-JAN-2024: 23.0.2

- Fallback to online resource for embed fonts and images
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
23.0.2
23.1.0
451 changes: 225 additions & 226 deletions src/main/webapp/js/app.min.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions src/main/webapp/js/diagramly/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -1868,12 +1868,12 @@ App.blockedAncestorFrames = function()
}
}

if (hostname.endsWith('embed.diagrams.net') && window.location.ancestorOrigins.length > 0)
{
var img = new Image();
img.src = 'https://log.diagrams.net/images/1x1.png?src=EditorEmbedAncestorFrames' +
'&v=' + encodeURIComponent(EditorUi.VERSION) + '&data=' + encodeURIComponent(message);
}
// if (hostname.endsWith('embed.diagrams.net') && window.location.ancestorOrigins.length > 0)
// {
// var img = new Image();
// img.src = 'https://log.diagrams.net/images/1x1.png?src=EditorEmbedAncestorFrames' +
// '&v=' + encodeURIComponent(EditorUi.VERSION) + '&data=' + encodeURIComponent(message);
// }
}
}
catch (e)
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/js/diagramly/Devel.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if (!mxIsElectron && location.protocol !== 'http:')
'https://*.googleapis.com wss://app.diagrams.net 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://api.onedrive.com ' +
'https://dl.dropboxusercontent.com https://api.openai.com ' +
'https://dl.dropboxusercontent.com https://api.openai.com https://drawio.dev ' +
'https://*.google.com https://fonts.gstatic.com https://fonts.googleapis.com; ' +
// font-src about: is required for MathJax HTML-CSS output with STIX
'img-src * data: blob:; media-src * data:; font-src * about:; ' +
Expand Down
47 changes: 22 additions & 25 deletions src/main/webapp/js/diagramly/Dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -3014,7 +3014,7 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
if (xml != null && mxUtils.isAncestorNode(document.body, elt))
{
var doc = mxUtils.parseXml(xml);
var tempNode = Editor.parseDiagramNode(doc.documentElement);
var tempNode = Editor.parseDiagramNode(doc.documentElement, null, true);
var codec = new mxCodec(tempNode.ownerDocument);
var model = new mxGraphModel();
codec.decode(tempNode, model);
Expand Down Expand Up @@ -3617,9 +3617,10 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
{
realUrl = url;

if (/^https?:\/\//.test(realUrl) && !editorUi.editor.isCorsEnabledForUrl(realUrl))
if (/^https?:\/\//.test(realUrl))
{
realUrl = PROXY_URL + '?url=' + encodeURIComponent(realUrl);
realUrl = editorUi.editor.isCorsEnabledForUrl(realUrl) ? realUrl :
PROXY_URL + '?url=' + encodeURIComponent(realUrl);
}
else
{
Expand Down Expand Up @@ -4298,7 +4299,16 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
{
if (typeof(node.getAttribute) !== 'undefined')
{
if (node.nodeName == 'clibs')
if (node.nodeName == 'parsererror')
{
if (window.console != null)
{
console.log('Parser error in ' +
templateFile + ': ' +
node.textContent);
}
}
else if (node.nodeName == 'clibs')
{
var name = node.getAttribute('name');
var adds = node.getElementsByTagName('add');
Expand Down Expand Up @@ -8671,28 +8681,15 @@ var FreehandWindow = function(editorUi, x, y, w, h, withBrush)

mxEvent.addListener(settings, 'click', mxUtils.bind(this, function(evt)
{
var options = graph.freehand.getOptions();
var dlg = new TextareaDialog(editorUi, mxResources.get('settings'), (options != null) ?
JSON.stringify(options, null, 2) : '',
mxUtils.bind(this, function(newValue)
var smoothing = graph.freehand.getSmoothing();

editorUi.prompt('Smoothing (1-20)', smoothing, function(newValue)
{
if (!isNaN(newValue) && newValue > 0 && newValue <= 20)
{
if (newValue != null && newValue.length > 0)
{
try
{
graph.freehand.setOptions(JSON.parse(newValue));
editorUi.hideDialog();
}
catch (e)
{
editorUi.handleError(e);
}
}
}), null, mxResources.get('close'));

editorUi.showDialog(dlg.container, 660, 480, true, false);
dlg.init();
graph.freehand.setSmoothing(parseInt(newValue));
}
});
}));

mxUtils.br(div);
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/js/diagramly/DriveClient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2006-2020, JGraph Ltd
* Copyright (c) 2006-2020, draw.io AG
* Copyright (c) 2006-2024, JGraph Ltd
* Copyright (c) 2006-2024, draw.io AG
*/

//Add a closure to hide the class private variables without changing the code a lot
Expand Down Expand Up @@ -68,7 +68,7 @@ mxUtils.extend(DriveClient, mxEventSource);
// Extends DrawioClient
mxUtils.extend(DriveClient, DrawioClient);

DriveClient.prototype.redirectUri = window.location.protocol + '//' + window.location.host + '/google';
DriveClient.prototype.redirectUri = window.DRAWIO_SERVER_URL + 'google';
DriveClient.prototype.GDriveBaseUrl = 'https://www.googleapis.com/drive/v2';

/**
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/js/diagramly/DropboxClient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2006-2017, JGraph Ltd
* Copyright (c) 2006-2017, Gaudenz Alder
* Copyright (c) 2006-2024, JGraph Ltd
* Copyright (c) 2006-2024, draw.io AG
*/
//Add a closure to hide the class private variables without changing the code a lot
(function()
Expand Down Expand Up @@ -41,7 +41,7 @@ DropboxClient.prototype.maxRetries = 4;

DropboxClient.prototype.clientId = window.DRAWIO_DROPBOX_ID;

DropboxClient.prototype.redirectUri = window.location.protocol + '//' + window.location.host + '/dropbox';
DropboxClient.prototype.redirectUri = window.DRAWIO_SERVER_URL + 'dropbox';

/**
* Authorizes the client, gets the userId and calls <open>.
Expand Down
11 changes: 9 additions & 2 deletions src/main/webapp/js/diagramly/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@
/**
* Extracts the XML from the compressed or non-compressed text chunk.
*/
Editor.parseDiagramNode = function(diagramNode, checked)
Editor.parseDiagramNode = function(diagramNode, checked, allowRecurse)
{
var text = mxUtils.trim(mxUtils.getTextContent(diagramNode));
var node = null;
Expand All @@ -1584,9 +1584,16 @@

if (temp.length > 0)
{
var tempNode = temp[0];

if (allowRecurse)
{
tempNode = Editor.parseDiagramNode(tempNode, checked, false);
}

// Creates new document for unique IDs within mxGraphModel
var doc = mxUtils.createXmlDocument();
doc.appendChild(doc.importNode(temp[0], true));
doc.appendChild(doc.importNode(tempNode, true));
node = doc.documentElement;
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/main/webapp/js/diagramly/EditorUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@
label = label + '...';
}

status.innerHTML = label;
status.innerHTML = mxUtils.htmlEntities(label);
container.appendChild(status);
spinner.status = status;
}
Expand Down Expand Up @@ -6541,7 +6541,6 @@
{
var div = document.createElement('div');
div.style.whiteSpace = 'nowrap';
var graph = this.editor.graph;

var hd = document.createElement('h3');
mxUtils.write(hd, mxResources.get('html'));
Expand Down Expand Up @@ -15603,9 +15602,10 @@
}
else if (data.action == 'dialog')
{
this.showError((data.titleKey != null) ? mxResources.get(data.titleKey) : data.title,
(data.messageKey != null) ? mxResources.get(data.messageKey) : data.message,
(data.buttonKey != null) ? mxResources.get(data.buttonKey) : data.button);
this.showError((data.titleKey != null) ? mxResources.get(data.titleKey) :
data.title, (data.messageKey != null) ? mxResources.get(data.messageKey) :
mxUtils.htmlEntities(data.message), (data.buttonKey != null) ?
mxResources.get(data.buttonKey) : data.button);

if (data.modified != null)
{
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/js/diagramly/GitHubClient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2006-2017, JGraph Ltd
* Copyright (c) 2006-2017, Gaudenz Alder
* Copyright (c) 2006-2024, JGraph Ltd
* Copyright (c) 2006-2024, draw.io AG
*/
//Add a closure to hide the class private variables without changing the code a lot
(function ()
Expand Down Expand Up @@ -35,7 +35,7 @@ GitHubClient.prototype.baseUrl = DRAWIO_GITHUB_API_URL;

GitHubClient.prototype.baseHostUrl = DRAWIO_GITHUB_URL;

GitHubClient.prototype.redirectUri = window.location.protocol + '//' + window.location.host + '/github2';
GitHubClient.prototype.redirectUri = window.DRAWIO_SERVER_URL + 'github2';

/**
* Maximum file size of the GitHub REST API.
Expand Down
6 changes: 3 additions & 3 deletions src/main/webapp/js/diagramly/GitLabClient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2006-2020, JGraph Ltd
* Copyright (c) 2006-2020, draw.io AG
* Copyright (c) 2006-2024, JGraph Ltd
* Copyright (c) 2006-2024, draw.io AG
*/
//Add a closure to hide the class private variables without changing the code a lot
(function()
Expand Down Expand Up @@ -41,7 +41,7 @@ GitLabClient.prototype.maxFileSize = 10000000 /*10MB*/;
*/
GitLabClient.prototype.authToken = 'Bearer';

GitLabClient.prototype.redirectUri = window.location.protocol + '//' + window.location.host + '/gitlab';
GitLabClient.prototype.redirectUri = window.DRAWIO_SERVER_URL + 'gitlab';

/**
* Authorizes the client, gets the userId and calls <open>.
Expand Down
14 changes: 7 additions & 7 deletions src/main/webapp/js/diagramly/GraphViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -2386,13 +2386,13 @@ GraphViewer.blockedAncestorFrames = function()
{
// do not log *.draw.io domains embedded directly into atlassian.net
}
else if (window.location.ancestorOrigins.length > 0)
{
var img = new Image();
img.src = 'https://log.diagrams.net/images/1x1.png?src=ViewerAncestorFrames' +
((typeof window.EditorUi !== 'undefined') ? '&v=' + encodeURIComponent(EditorUi.VERSION) : '') +
'&data=' + encodeURIComponent(message);
}
// else if (window.location.ancestorOrigins.length > 0)
// {
// var img = new Image();
// img.src = 'https://log.diagrams.net/images/1x1.png?src=ViewerAncestorFrames' +
// ((typeof window.EditorUi !== 'undefined') ? '&v=' + encodeURIComponent(EditorUi.VERSION) : '') +
// '&data=' + encodeURIComponent(message);
// }
}
}
catch (e)
Expand Down
2 changes: 1 addition & 1 deletion src/main/webapp/js/diagramly/Init.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ window.isSvgBrowser = true;
// Base URL defines cases where an absolute URL is needed (eg. embedding)
window.DRAWIO_BASE_URL = window.DRAWIO_BASE_URL || ((/.*\.draw\.io$/.test(window.location.hostname)) || (/.*\.diagrams\.net$/.test(window.location.hostname)) ?
window.location.protocol + '//' + window.location.hostname : 'https://app.diagrams.net');
window.DRAWIO_SERVER_URL = window.DRAWIO_SERVER_URL || (window.location.hostname == 'test.draw.io' ? 'https://ac.draw.io/' : '');
window.DRAWIO_SERVER_URL = window.DRAWIO_SERVER_URL || window.location.href.substring(0, window.location.href.lastIndexOf('/')) + '/';
window.DRAWIO_LIGHTBOX_URL = window.DRAWIO_LIGHTBOX_URL || 'https://viewer.diagrams.net';
window.EXPORT_URL = window.EXPORT_URL || 'https://convert.diagrams.net/node/export';
window.PLANT_URL = window.PLANT_URL || 'https://plant-aws.diagrams.net';
Expand Down
8 changes: 4 additions & 4 deletions src/main/webapp/js/diagramly/OneDriveClient.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
* Copyright (c) 2006-2020, JGraph Ltd
* Copyright (c) 2006-2020, draw.io AG
* Copyright (c) 2006-2024, JGraph Ltd
* Copyright (c) 2006-2024, draw.io AG
*/

//Add a closure to hide the class private variables without changing the code a lot
Expand Down Expand Up @@ -63,8 +63,8 @@ OneDriveClient.prototype.scopes = 'user.read files.readwrite.all sites.read.all'
/**
* OAuth 2.0 scopes for installing Drive Apps.
*/
OneDriveClient.prototype.redirectUri = window.location.protocol + '//' + window.location.host + '/microsoft';
OneDriveClient.prototype.pickerRedirectUri = window.location.protocol + '//' + window.location.host + '/onedrive3.html';
OneDriveClient.prototype.redirectUri = window.DRAWIO_SERVER_URL + 'microsoft';
OneDriveClient.prototype.pickerRedirectUri = window.DRAWIO_SERVER_URL + 'onedrive3.html';

/**
* This is the default endpoint for personal accounts
Expand Down
17 changes: 6 additions & 11 deletions src/main/webapp/js/diagramly/mxFreehand.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,15 @@ function mxFreehand(graph)
selectInserted = value;
};

this.setSmoothing = function(smoothing)//TODO add smoothing settings
this.setSmoothing = function(smoothing)
{
bufferSize = smoothing;
};

this.getSmoothing = function()
{
return bufferSize;
};

this.setPerfectFreehandMode = function(value)
{
Expand All @@ -111,16 +116,6 @@ function mxFreehand(graph)
return perfectFreehandOptions.size;
};

this.setOptions = function(value)
{
perfectFreehandOptions = value;
};

this.getOptions = function()
{
return perfectFreehandOptions;
};

var setEnabled = function(isEnabled)
{
enabled = isEnabled;
Expand Down
Loading

0 comments on commit 21b3fc3

Please sign in to comment.