perf: Upgrade drawio

This commit is contained in:
kuaifan 2024-12-07 01:31:49 +08:00
parent 03cd6e79bb
commit 712f9e07b7
6 changed files with 10456 additions and 9298 deletions

View File

@ -113,7 +113,7 @@ services:
drawio-webapp: drawio-webapp:
container_name: "dootask-drawio-webapp-${APP_ID}" container_name: "dootask-drawio-webapp-${APP_ID}"
image: "jgraph/drawio:20.8.20" image: "jgraph/drawio:24.7.17"
volumes: volumes:
- ./docker/drawio/webapp/index.html:/usr/local/tomcat/webapps/draw/index.html - ./docker/drawio/webapp/index.html:/usr/local/tomcat/webapps/draw/index.html
- ./docker/drawio/webapp/stencils:/usr/local/tomcat/webapps/draw/stencils - ./docker/drawio/webapp/stencils:/usr/local/tomcat/webapps/draw/stencils

View File

@ -1,3 +1,3 @@
# Change # Change
diff https://github.com/jgraph/drawio/tree/1a858166fb4f1330cf23e58941e3fbec1dcd16f8 diff https://github.com/jgraph/drawio/tree/acd938b1e42cff3be3b629e6239cdec9a9baddcc

View File

@ -8,23 +8,23 @@
<meta name="Description" content="draw.io is free online diagram software for making flowcharts, process diagrams, org charts, UML, ER and network diagrams"> <meta name="Description" content="draw.io is free online diagram software for making flowcharts, process diagrams, org charts, UML, ER and network diagrams">
<meta name="Keywords" content="drawio, diagram, online, flow chart, flowchart maker, uml, erd"> <meta name="Keywords" content="drawio, diagram, online, flow chart, flowchart maker, uml, erd">
<meta itemprop="name" content="draw.io - free flowchart maker and diagrams online"> <meta itemprop="name" content="draw.io - free flowchart maker and diagrams online">
<meta itemprop="description" content="draw.io is a free online diagramming application and flowchart maker . You can use it to create UML, entity relationship, <meta itemprop="description" content="draw.io is a free online diagramming application and flowchart maker . You can use it to create UML, entity relationship,
org charts, BPMN and BPM, database schema and networks. Also possible are telecommunication network, workflow, flowcharts, maps overlays and GIS, electronic org charts, BPMN and BPM, database schema and networks. Also possible are telecommunication network, workflow, flowcharts, maps overlays and GIS, electronic
circuit and social network diagrams."> circuit and social network diagrams.">
<meta itemprop="image" content="https://lh4.googleusercontent.com/-cLKEldMbT_E/Tx8qXDuw6eI/AAAAAAAAAAs/Ke0pnlk8Gpg/w500-h344-k/BPMN%2Bdiagram%2Brc2f.png"> <meta itemprop="image" content="https://lh4.googleusercontent.com/-cLKEldMbT_E/Tx8qXDuw6eI/AAAAAAAAAAs/Ke0pnlk8Gpg/w500-h344-k/BPMN%2Bdiagram%2Brc2f.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta name="msapplication-config" content="images/browserconfig.xml"> <meta name="msapplication-config" content="images/browserconfig.xml">
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="#d89000"> <meta name="theme-color" content="#d89000">
<script type="text/javascript"> <script id="geBootstrap" type="text/javascript">
window.EXPORT_URL = window.location.origin + "/drawio/export/"; window.EXPORT_URL = window.location.origin + "/drawio/export/";
window.DRAWIO_LIGHTBOX_URL = window.location.origin + "/drawio/webapp"; window.DRAWIO_LIGHTBOX_URL = window.location.origin + "/drawio/webapp";
setInterval(function() {window.ICONSEARCH_PATH = window.location.origin + "/drawio/iconsearch";}, 1000) setInterval(function() {window.ICONSEARCH_PATH = window.location.origin + "/drawio/iconsearch";}, 1000)
/** /**
* URL Parameters and protocol description are here: * URL Parameters and protocol description are here:
* *
* https://desk.draw.io/support/solutions/articles/16000042546-what-url-parameters-are-supported * https://www.drawio.com/doc/faq/supported-url-parameters
* *
* Parameters for developers: * Parameters for developers:
* *
@ -44,27 +44,27 @@
{ {
var result = new Object(); var result = new Object();
var params = window.location.search.slice(1).split('&'); var params = window.location.search.slice(1).split('&');
for (var i = 0; i < params.length; i++) for (var i = 0; i < params.length; i++)
{ {
var idx = params[i].indexOf('='); var idx = params[i].indexOf('=');
if (idx > 0) if (idx > 0)
{ {
result[params[i].substring(0, idx)] = params[i].substring(idx + 1); result[params[i].substring(0, idx)] = params[i].substring(idx + 1);
} }
} }
return result; return result;
})(); })();
// Forces CDN caches by passing URL parameters via URL hash // Forces CDN caches by passing URL parameters via URL hash
if (window.location.hash != null && window.location.hash.substring(0, 2) == '#P') if (window.location.hash != null && window.location.hash.substring(0, 2) == '#P')
{ {
try try
{ {
urlParams = JSON.parse(decodeURIComponent(window.location.hash.substring(2))); urlParams = JSON.parse(decodeURIComponent(window.location.hash.substring(2)));
if (urlParams.hash != null) if (urlParams.hash != null)
{ {
window.location.hash = urlParams.hash; window.location.hash = urlParams.hash;
@ -75,9 +75,10 @@
// ignore // ignore
} }
} }
// Global variable for desktop // Global variable for desktop
var mxIsElectron = window && window.process && window.process.type; var mxIsElectron = navigator.userAgent != null && navigator.userAgent.toLowerCase().indexOf(' electron/') > -1 &&
navigator.userAgent.indexOf(' draw.io/') > -1;
// Redirects page if required // Redirects page if required
if (urlParams['dev'] != '1') if (urlParams['dev'] != '1')
@ -85,21 +86,21 @@
(function() (function()
{ {
var proto = window.location.protocol; var proto = window.location.protocol;
if (!mxIsElectron) if (!mxIsElectron)
{ {
var host = window.location.host; var host = window.location.host;
// Redirects apex, drive and rt to www // Redirects apex, drive and rt to www
if (host === 'draw.io' || host === 'rt.draw.io' || host === 'drive.draw.io') if (host === 'draw.io' || host === 'rt.draw.io' || host === 'drive.draw.io')
{ {
host = 'www.draw.io'; host = 'www.draw.io';
} }
var href = proto + '//' + host + window.location.href.substring( var href = proto + '//' + host + window.location.href.substring(
window.location.protocol.length + window.location.protocol.length +
window.location.host.length + 2); window.location.host.length + 2);
// Redirects if href changes // Redirects if href changes
if (href != window.location.href) if (href != window.location.href)
{ {
@ -108,7 +109,7 @@
} }
})(); })();
} }
/** /**
* Adds meta tag to the page. * Adds meta tag to the page.
*/ */
@ -117,15 +118,15 @@
try try
{ {
var s = document.createElement('meta'); var s = document.createElement('meta');
if (name != null) if (name != null)
{ {
s.setAttribute('name', name); s.setAttribute('name', name);
} }
s.setAttribute('content', content); s.setAttribute('content', content);
if (httpEquiv != null) if (httpEquiv != null)
{ {
s.setAttribute('http-equiv', httpEquiv); s.setAttribute('http-equiv', httpEquiv);
} }
@ -138,14 +139,14 @@
// ignore // ignore
} }
}; };
/** /**
* Synchronously adds scripts to the page. * Synchronously adds scripts to the page.
*/ */
function mxscript(src, onLoad, id, dataAppKey, noWrite, onError) function mxscript(src, onLoad, id, dataAppKey, noWrite, onError)
{ {
var defer = onLoad == null && !noWrite; var defer = onLoad == null && !noWrite;
if ((urlParams['dev'] != '1' && typeof document.createElement('canvas').getContext === "function") || if ((urlParams['dev'] != '1' && typeof document.createElement('canvas').getContext === "function") ||
onLoad != null || noWrite) onLoad != null || noWrite)
{ {
@ -158,16 +159,16 @@
{ {
s.setAttribute('id', id); s.setAttribute('id', id);
} }
if (dataAppKey != null) if (dataAppKey != null)
{ {
s.setAttribute('data-app-key', dataAppKey); s.setAttribute('data-app-key', dataAppKey);
} }
if (onLoad != null) if (onLoad != null)
{ {
var r = false; var r = false;
s.onload = s.onreadystatechange = function() s.onload = s.onreadystatechange = function()
{ {
if (!r && (!this.readyState || this.readyState == 'complete')) if (!r && (!this.readyState || this.readyState == 'complete'))
@ -185,9 +186,9 @@
onError('Failed to load ' + src, e); onError('Failed to load ' + src, e);
}; };
} }
var t = document.getElementsByTagName('script')[0]; var t = document.getElementsByTagName('script')[0];
if (t != null) if (t != null)
{ {
t.parentNode.insertBefore(s, t); t.parentNode.insertBefore(s, t);
@ -209,11 +210,11 @@
g.type = 'text/javascript'; g.type = 'text/javascript';
g.async = true; g.async = true;
g.src = src; g.src = src;
var s = document.getElementsByTagName('script')[0]; var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(g, s); s.parentNode.insertBefore(g, s);
}; };
/** /**
* Adds meta tags with application name (depends on offline URL parameter) * Adds meta tags with application name (depends on offline URL parameter)
*/ */
@ -225,13 +226,13 @@
if (mxIsElectron) if (mxIsElectron)
{ {
// mxmeta(null, 'default-src \'self\' \'unsafe-inline\'; connect-src \'self\' https://*.draw.io https://fonts.googleapis.com https://fonts.gstatic.com; img-src * data:; media-src *; font-src *; style-src-elem \'self\' \'unsafe-inline\' https://fonts.googleapis.com', 'Content-Security-Policy'); mxmeta(null, 'default-src \'self\'; script-src \'self\' \'sha256-6g514VrT/cZFZltSaKxIVNFF46+MFaTSDTPB8WfYK+c=\'; connect-src \'self\' https://*.draw.io https://*.diagrams.net https://fonts.googleapis.com https://fonts.gstatic.com; img-src * data:; media-src *; font-src *; frame-src \'none\'; style-src \'self\' \'unsafe-inline\' https://fonts.googleapis.com; base-uri \'none\';child-src \'self\';object-src \'none\';', 'Content-Security-Policy');
} }
})(); })();
// Checks for local storage // Checks for local storage
var isLocalStorage = false; var isLocalStorage = false;
try try
{ {
isLocalStorage = urlParams['local'] != '1' && typeof(localStorage) != 'undefined'; isLocalStorage = urlParams['local'] != '1' && typeof(localStorage) != 'undefined';
@ -242,34 +243,30 @@
} }
var mxScriptsLoaded = false, mxWinLoaded = false; var mxScriptsLoaded = false, mxWinLoaded = false;
function checkAllLoaded() function checkAllLoaded()
{ {
if (mxScriptsLoaded && mxWinLoaded) if (mxScriptsLoaded && mxWinLoaded)
{ {
App.main(); App.main();
} }
}; };
var t0 = new Date(); var t0 = new Date();
// Changes paths for local development environment // Changes paths for local development environment
if (urlParams['dev'] == '1') if (urlParams['dev'] == '1')
{ {
// Used to request grapheditor/mxgraph sources in dev mode // Used to request grapheditor/mxgraph sources in dev mode
var mxDevUrl = document.location.protocol + '//devhost.jgraph.com/drawio/src/main'; var mxDevUrl = '';
// Used to request draw.io sources in dev mode // Used to request draw.io sources in dev mode
var drawDevUrl = document.location.protocol + '//devhost.jgraph.com/drawio/src/main/webapp/'; var drawDevUrl = '';
var geBasePath = drawDevUrl + '/js/grapheditor'; var geBasePath = 'js/grapheditor';
var mxBasePath = mxDevUrl + '/mxgraph'; var mxBasePath = 'mxgraph/src';
if (document.location.protocol == 'file:') if (document.location.protocol == 'file:')
{ {
geBasePath = './js/grapheditor';
mxBasePath = './mxgraph';
drawDevUrl = './';
// Forces includes for dev environment in node.js // Forces includes for dev environment in node.js
mxForceIncludes = true; mxForceIncludes = true;
} }
@ -280,19 +277,19 @@
mxscript(drawDevUrl + 'js/diagramly/Init.js'); mxscript(drawDevUrl + 'js/diagramly/Init.js');
mxscript(geBasePath + '/Init.js'); mxscript(geBasePath + '/Init.js');
mxscript(mxBasePath + '/mxClient.js'); mxscript(mxBasePath + '/mxClient.js');
// Adds all JS code that depends on mxClient. This indirection via Devel.js is // Adds all JS code that depends on mxClient. This indirection via Devel.js is
// required in some browsers to make sure mxClient.js (and the files that it // required in some browsers to make sure mxClient.js (and the files that it
// loads asynchronously) are available when the code loaded in Devel.js runs. // loads asynchronously) are available when the code loaded in Devel.js runs.
mxscript(drawDevUrl + 'js/diagramly/Devel.js'); mxscript(drawDevUrl + 'js/diagramly/Devel.js');
// Electron // Electron
if (mxIsElectron) if (mxIsElectron)
{ {
mxscript('js/diagramly/DesktopLibrary.js'); mxscript('js/diagramly/DesktopLibrary.js');
mxscript('js/diagramly/ElectronApp.js'); mxscript('js/diagramly/ElectronApp.js');
} }
mxscript(drawDevUrl + 'js/PostConfig.js'); mxscript(drawDevUrl + 'js/PostConfig.js');
} }
else else
@ -300,18 +297,18 @@
(function() (function()
{ {
var hostName = window.location.hostname; var hostName = window.location.hostname;
// Supported domains are *.draw.io and the packaged version in Quip // Supported domains are *.draw.io and the packaged version in Quip
var supportedDomain = (hostName.substring(hostName.length - 8, hostName.length) === '.draw.io') || var supportedDomain = (hostName.substring(hostName.length - 8, hostName.length) === '.draw.io') ||
(hostName.substring(hostName.length - 13, hostName.length) === '.diagrams.net'); (hostName.substring(hostName.length - 13, hostName.length) === '.diagrams.net');
function loadAppJS() function loadAppJS()
{ {
mxscript('js/app.min.js', function() mxscript('js/app.min.js', function()
{ {
mxScriptsLoaded = true; mxScriptsLoaded = true;
checkAllLoaded(); checkAllLoaded();
// Electron // Electron
if (mxIsElectron) if (mxIsElectron)
{ {
@ -332,14 +329,14 @@
}); });
}); });
} }
else if (!supportedDomain) else if (!supportedDomain || navigator.onLine)
{ {
mxscript('js/PostConfig.js'); mxscript('js/PostConfig.js');
} }
}); });
}; };
if (!supportedDomain || mxIsElectron) if (!supportedDomain || mxIsElectron || navigator.onLine)
{ {
mxscript('js/PreConfig.js', loadAppJS); mxscript('js/PreConfig.js', loadAppJS);
} }
@ -354,19 +351,17 @@
window.onerror = function() window.onerror = function()
{ {
var status = document.getElementById('geStatus'); var status = document.getElementById('geStatus');
if (status != null) if (status != null)
{ {
status.innerHTML = 'Page could not be loaded. Please try refreshing.'; status.innerHTML = 'Page could not be loaded. Please try refreshing.';
} }
}; };
</script> </script>
<link rel="chrome-webstore-item" href="https://chrome.google.com/webstore/detail/plgmlhohecdddhbmmkncjdmlhcmaachm"> <link rel="icon" href="favicon.ico" sizes="any">
<link rel="apple-touch-icon" sizes="180x180" href="images/apple-touch-icon.png"> <link rel="apple-touch-icon" href="images/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="images/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="images/favicon-16x16.png">
<link rel="mask-icon" href="images/safari-pinned-tab.svg" color="#d89000">
<link rel="stylesheet" type="text/css" href="styles/grapheditor.css"> <link rel="stylesheet" type="text/css" href="styles/grapheditor.css">
<link rel="stylesheet" media="(forced-colors: active)" href="styles/high-contrast.css" id="high-contrast-stylesheet">
<link rel="canonical" href="https://app.diagrams.net"> <link rel="canonical" href="https://app.diagrams.net">
<link rel="manifest" href="images/manifest.json"> <link rel="manifest" href="images/manifest.json">
<link rel="shortcut icon" href="favicon.ico"> <link rel="shortcut icon" href="favicon.ico">
@ -378,7 +373,7 @@
color:#606060; color:#606060;
} }
.geBlock { .geBlock {
display: none; display: none;
z-index:-3; z-index:-3;
margin:100px; margin:100px;
margin-top:40px; margin-top:40px;
@ -443,7 +438,7 @@
<div class="geBlock"> <div class="geBlock">
<h1>Flowchart Maker and Online Diagram Software</h1> <h1>Flowchart Maker and Online Diagram Software</h1>
<p> <p>
draw.io is free online diagram software. You can use it as a flowchart maker, network diagram software, to create UML online, as an ER diagram tool, draw.io is free online diagram software. You can use it as a flowchart maker, network diagram software, to create UML online, as an ER diagram tool,
to design database schema, to build BPMN online, as a circuit diagram maker, and more. draw.io can import .vsdx, Gliffy&trade; and Lucidchart&trade; files . to design database schema, to build BPMN online, as a circuit diagram maker, and more. draw.io can import .vsdx, Gliffy&trade; and Lucidchart&trade; files .
</p> </p>
<h2 id="geStatus">Loading...</h2> <h2 id="geStatus">Loading...</h2>
@ -452,7 +447,7 @@
</p> </p>
</div> </div>
</div> </div>
<script type="text/javascript"> <script id="geMain" type="text/javascript">
/** /**
* Main * Main
*/ */

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -1 +1 @@
Subproject commit 1a858166fb4f1330cf23e58941e3fbec1dcd16f8 Subproject commit acd938b1e42cff3be3b629e6239cdec9a9baddcc