Commit 9942b5cc830a7567c2a515ef7b78fa68946ddac5

Authored by xp.Huang
2 parents 12256b8a 2b2a4a02

Merge branch 'ww' into 'main'

feat: 新增组态分享功能

See merge request yunteng/thingskit-scada!59
... ... @@ -8,3 +8,4 @@ yarn.lock
8 8 **/.DS_Store
9 9 **/*.min.js
10 10 dist
  11 +src/main/webapp/js/grapheditor/compiled/Format.js
... ...
No preview for this file type
... ... @@ -57,7 +57,7 @@ public class Xml2Js
57 57 String name = f.getCanonicalPath()
58 58 .substring(basePath.length() + 1);
59 59 result.add(
60   - "f['" + name + "'] = '" + processFile(f) + "';\n");
  60 + "f['" + name.replace("\\", "/") + "'] = '" + processFile(f) + "';\n");
61 61 }
62 62 }
63 63 }
... ...
... ... @@ -22,26 +22,26 @@
22 22 <meta name="mobile-web-app-capable" content="yes">
23 23 <meta name="theme-color" content="#d89000">
24 24
25   - <link rel="stylesheet" href="./js/plugin/layui/css/layui.css?v=1670325027797">
  25 + <link rel="stylesheet" href="./js/plugin/layui/css/layui.css?v=1679478216446">
26 26
27 27 <!-- load configure file -->
28   - <script src="./js/config/config.js?v=1670325027797"></script>
  28 + <script src="./js/config/config.js?v=1679478216446"></script>
29 29
30 30 <!-- crypto-js -->
31   - <script src="./js/plugin/crypto-js/crypto-js.js?v=1670325027797"></script>
  31 + <script src="./js/plugin/crypto-js/crypto-js.js?v=1679478216446"></script>
32 32
33 33 <!-- storage persistent -->
34   - <script src="./js/const/persistentStorage.js?v=1670325027797"></script>
  34 + <script src="./js/const/persistentStorage.js?v=1679478216446"></script>
35 35 <!-- Global const -->
36   - <script src="./js/const/const.js?v=1670325027797"></script>
  36 + <script src="./js/const/const.js?v=1679478216446"></script>
37 37
38 38 <!-- Axios -->
39   - <script src="./js/plugin/axios/axios.min.js?v=1670325027797"></script>
40   - <script src="./js/plugin/axios/DefHttp.js?v=1670325027797"></script>
41   - <script src="./js/api/index.js?v=1670325027797"></script>
  39 + <script src="./js/plugin/axios/axios.min.js?v=1679478216446"></script>
  40 + <script src="./js/plugin/axios/DefHttp.js?v=1679478216446"></script>
  41 + <script src="./js/api/index.js?v=1679478216446"></script>
42 42
43 43 <!-- load script -->
44   - <script src="./js/config/loadScript.js?v=1670325027797"></script>
  44 + <script src="./js/config/loadScript.js?v=1679478216446"></script>
45 45
46 46 <!-- act editor -->
47 47 <!-- <script src="https://oss.yuntengcloud.com/iotdocs/thingskit-scada/ace.js"></script> -->
... ... @@ -54,7 +54,7 @@
54 54 <!-- <script src="https://vjs.zencdn.net/7.10.2/video.min.js"></script> -->
55 55 <!-- <script src="https://oss.yuntengcloud.com/iotdocs/thingskit-scada/video.min.js"></script> -->
56 56
57   - <script src="./js/plugin/layui/layui.js?v=1670325027797"></script>
  57 + <script src="./js/plugin/layui/layui.js?v=1679478216446"></script>
58 58 <!-- <link rel="stylesheet" href="https://cdnjs.loli.net/ajax/libs/layui/2.6.8/css/layui.min.css"
59 59 integrity="sha512-iQBJbsNHXUcgEIgWThd2dr8tOdKPvICwqjPEZYY81z3eMya44A5MiAqfWSCh+Ee1YzNYkdrI982Qhwgr8LEYOQ=="
60 60 crossorigin="anonymous" referrerpolicy="no-referrer" />
... ... @@ -63,7 +63,7 @@
63 63 crossorigin="anonymous" referrerpolicy="no-referrer"></script> -->
64 64
65 65 <!-- 引入修改样式 -->
66   - <link rel="stylesheet" href="./styles/formatChange.css?v=1670325027797">
  66 + <link rel="stylesheet" href="./styles/formatChange.css?v=1679478216446">
67 67
68 68 <script type="text/javascript">
69 69 /**
... ... @@ -306,7 +306,7 @@
306 306 var supportedDomain = (hostName.substring(hostName.length - 8, hostName.length) === '.draw.io') ||
307 307 (hostName.substring(hostName.length - 13, hostName.length) === '.diagrams.net');
308 308
309   - const releaseVersion = '1670325027797'
  309 + const releaseVersion = '1679478216446'
310 310 const appMinSrc = Enable_OSS ? `${OSS_Prefix}app.min.js?v=${releaseVersion}` : `js/app.min.js?v=${releaseVersion}`
311 311 function loadAppJS() {
312 312 mxscript(appMinSrc, function () {
... ...
... ... @@ -65,8 +65,7 @@ App = function (editor, container, lightbox) {
65 65 // Pre-fetches images
66 66 if (mxClient.IS_SVG) {
67 67 mxGraph.prototype.warningImage.src = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAAK/INwWK6QAAABl0RVh0U29mdHdhcmUAQWRvYmUgSW1hZ2VSZWFkeXHJZTwAAAE7SURBVHjaYvz//z8DJQAggBjwGXDuHMP/tWuD/uPTCxBAOA0AaQRK/f/+XeJ/cbHlf1wGAAQQTgPu3QNLgfHSpZo4DQAIIKwGwGyH4e/fFbG6AiQJEEAs2Ew2NFzH8OOHBMO6dT/A/KCg7wxGRh+wuhQggDBcALMdFIAcHBxgDGJjcwVIIUAAYbhAUXEdVos4OO4DXcGBIQ4QQCguQPY7sgtgAYruCpAgQACx4LJdU1OCwctLEcyWlLwPJF+AXQE0EMUBAAEEdwF6yMOiD4RRY0QT7gqQAEAAseDzu6XldYYPH9DD4joQa8L5AAEENgWb7SBcXa0JDQMBrK4AcQACiAlfyOMCEFdAnAYQQEz4FLa0XGf4/v0H0IIPONUABBAjyBmMjIwMS5cK/L927QORbtBkaG29DtYLEGAAH6f7oq3Zc+kAAAAASUVORK5CYII=';
68   - }
69   - else {
  68 + } else {
70 69 var img = new Image();
71 70 img.src = mxGraph.prototype.warningImage.src;
72 71 }
... ... @@ -82,15 +81,13 @@ App = function (editor, container, lightbox) {
82 81
83 82 try {
84 83 wnd = window.open(url);
85   - }
86   - catch (e) {
  84 + } catch (e) {
87 85 // ignore
88 86 }
89 87
90 88 if (wnd == null || wnd === undefined) {
91 89 this.showDialog(new PopupDialog(this, url, pre, fallback).container, 320, 140, true, true);
92   - }
93   - else if (pre != null) {
  90 + } else if (pre != null) {
94 91 pre();
95 92 }
96 93 });
... ... @@ -119,13 +116,11 @@ App = function (editor, container, lightbox) {
119 116 for (var i = 0; i < App.DrawPlugins.length; i++) {
120 117 try {
121 118 App.DrawPlugins[i](this);
122   - }
123   - catch (e) {
  119 + } catch (e) {
124 120 if (window.console != null) {
125 121 console.log('Plugin Error:', e, App.DrawPlugins[i]);
126 122 }
127   - }
128   - finally {
  123 + } finally {
129 124 App.embedModePluginsCount--;
130 125 this.initializeEmbedMode();
131 126 }
... ... @@ -135,8 +130,7 @@ App = function (editor, container, lightbox) {
135 130 window.Draw.loadPlugin = mxUtils.bind(this, function (callback) {
136 131 try {
137 132 callback(this);
138   - }
139   - finally {
  133 + } finally {
140 134 App.embedModePluginsCount--;
141 135 this.initializeEmbedMode();
142 136 }
... ... @@ -425,8 +419,7 @@ App.getStoredMode = function () {
425 419 // Disables loading of client
426 420 window.DriveClient = null;
427 421 }
428   - }
429   - else {
  422 + } else {
430 423 // Disables loading of client
431 424 window.DriveClient = null;
432 425 }
... ... @@ -444,12 +437,10 @@ App.getStoredMode = function () {
444 437 // Must load this after the dropbox SDK since they use the same namespace
445 438 mxscript(App.DROPINS_URL, null, 'dropboxjs', App.DROPBOX_APPKEY, true);
446 439 });
447   - }
448   - else if (urlParams['chrome'] == '0') {
  440 + } else if (urlParams['chrome'] == '0') {
449 441 window.DropboxClient = null;
450 442 }
451   - }
452   - else {
  443 + } else {
453 444 // Disables loading of client
454 445 window.DropboxClient = null;
455 446 }
... ... @@ -464,12 +455,10 @@ App.getStoredMode = function () {
464 455 window.location.hash.substring(0, 2) == '#W')) {
465 456 //Editor.oneDriveInlinePicker can be set with configuration which is done later, so load it all time
466 457 mxscript(App.ONEDRIVE_URL);
467   - }
468   - else if (urlParams['chrome'] == '0') {
  458 + } else if (urlParams['chrome'] == '0') {
469 459 window.OneDriveClient = null;
470 460 }
471   - }
472   - else {
  461 + } else {
473 462 // Disables loading of client
474 463 window.OneDriveClient = null;
475 464 }
... ... @@ -485,12 +474,10 @@ App.getStoredMode = function () {
485 474 mxscript(App.TRELLO_JQUERY_URL, function () {
486 475 mxscript(App.TRELLO_URL);
487 476 });
488   - }
489   - else if (urlParams['chrome'] == '0') {
  477 + } else if (urlParams['chrome'] == '0') {
490 478 window.TrelloClient = null;
491 479 }
492   - }
493   - else {
  480 + } else {
494 481 // Disables loading of client
495 482 window.TrelloClient = null;
496 483 }
... ... @@ -530,7 +517,7 @@ App.main = function (callback, createUi) {
530 517 // 应用启动入口时创建一个axios实例,供全局使用
531 518 defHttp = createAxios({
532 519 timeout: 10 * 1000,
533   - baseURL: '/api',
  520 + baseURL: '/api'
534 521 })
535 522 // Logs uncaught errors
536 523 window.onerror = function (message, url, linenumber, colno, err) {
... ... @@ -605,13 +592,11 @@ App.main = function (callback, createUi) {
605 592 alert('Cache cleared');
606 593 }
607 594 });
608   - }
609   - else if (Editor.enableServiceWorker) {
  595 + } else if (Editor.enableServiceWorker) {
610 596 // Runs as progressive web app if service workers are supported
611 597 navigator.serviceWorker.register('/service-worker.js');
612 598 }
613   - }
614   - catch (e) {
  599 + } catch (e) {
615 600 if (window.console != null) {
616 601 console.error(e);
617 602 }
... ... @@ -646,8 +631,7 @@ App.main = function (callback, createUi) {
646 631 if (temp != null) {
647 632 plugins = temp.plugins;
648 633 }
649   - }
650   - catch (e) {
  634 + } catch (e) {
651 635 // ignore
652 636 }
653 637 }
... ... @@ -686,8 +670,7 @@ App.main = function (callback, createUi) {
686 670
687 671 mxscript(plugins[i]);
688 672 }
689   - }
690   - catch (e) {
  673 + } catch (e) {
691 674 // ignore
692 675 }
693 676 }
... ... @@ -766,13 +749,11 @@ App.main = function (callback, createUi) {
766 749 }
767 750
768 751 value = config;
769   - }
770   - catch (e) {
  752 + } catch (e) {
771 753 window.location.hash = '';
772 754 alert(e);
773 755 }
774   - }
775   - else {
  756 + } else {
776 757 value = value.merge;
777 758 }
778 759 }
... ... @@ -786,8 +767,7 @@ App.main = function (callback, createUi) {
786 767 }
787 768
788 769 window.location.hash = '';
789   - }
790   - catch (e) {
  770 + } catch (e) {
791 771 window.location.hash = '';
792 772 alert(e);
793 773 }
... ... @@ -877,8 +857,7 @@ App.main = function (callback, createUi) {
877 857 if (urlParams['dev'] == '1' || EditorUi.isElectronApp) //TODO check if we can remove these scripts loading from index.html
878 858 {
879 859 realMain();
880   - }
881   - else {
  860 + } else {
882 861 mxStencilRegistry.allowEval = false;
883 862 let loadScriptList = [
884 863 'js/shapes-14-6-5.min.js',
... ... @@ -926,8 +905,7 @@ App.main = function (callback, createUi) {
926 905 if (!isNaN(val) && val > 0) {
927 906 DrawioFile.prototype.autosaveDelay = val;
928 907 EditorUi.debug('Setting autosaveDelay', val);
929   - }
930   - else {
  908 + } else {
931 909 EditorUi.debug('Invalid autosaveDelay', val);
932 910 }
933 911 }
... ... @@ -938,14 +916,12 @@ App.main = function (callback, createUi) {
938 916 if (!isNaN(val) && val > 0) {
939 917 Graph.prototype.defaultEdgeLength = val;
940 918 EditorUi.debug('Using defaultEdgeLength', val);
941   - }
942   - else {
  919 + } else {
943 920 EditorUi.debug('Invalid defaultEdgeLength', val);
944 921 }
945 922 }
946 923 }
947   - }
948   - catch (e) {
  924 + } catch (e) {
949 925 if (window.console != null) {
950 926 console.error(e);
951 927 }
... ... @@ -986,8 +962,7 @@ App.main = function (callback, createUi) {
986 962 mxSettings.load();
987 963 doMain();
988 964 }
989   - }
990   - catch (e) {
  965 + } catch (e) {
991 966 if (window.console != null) {
992 967 console.log('Error in configure message: ' + e, evt.data);
993 968 }
... ... @@ -998,8 +973,7 @@ App.main = function (callback, createUi) {
998 973 // Receives XML message from opener and puts it into the graph
999 974 mxEvent.addListener(window, 'message', configHandler);
1000 975 op.postMessage(JSON.stringify({ event: 'configure' }), '*');
1001   - }
1002   - else {
  976 + } else {
1003 977 if (Editor.config == null) {
1004 978 // Loads configuration from global scope or local storage
1005 979 if (window.DRAWIO_CONFIG != null) {
... ... @@ -1007,8 +981,7 @@ App.main = function (callback, createUi) {
1007 981 EditorUi.debug('Using global configuration', window.DRAWIO_CONFIG);
1008 982 Editor.configure(window.DRAWIO_CONFIG);
1009 983 mxSettings.load();
1010   - }
1011   - catch (e) {
  984 + } catch (e) {
1012 985 if (window.console != null) {
1013 986 console.error(e);
1014 987 }
... ... @@ -1028,8 +1001,7 @@ App.main = function (callback, createUi) {
1028 1001 Editor.configure(configData);
1029 1002 mxSettings.load();
1030 1003 }
1031   - }
1032   - catch (e) {
  1004 + } catch (e) {
1033 1005 if (window.console != null) {
1034 1006 console.error(e);
1035 1007 }
... ... @@ -1101,8 +1073,7 @@ App.prototype.fullscreenMode = false;
1101 1073 */
1102 1074 if (urlParams['embed'] != '1') {
1103 1075 App.prototype.menubarHeight = 64;
1104   -}
1105   -else {
  1076 +} else {
1106 1077 App.prototype.footerHeight = 0;
1107 1078 }
1108 1079
... ... @@ -1148,26 +1119,21 @@ App.loadPlugins = function (plugins, useInclude) {
1148 1119 if (typeof window.drawDevUrl === 'undefined') {
1149 1120 if (useInclude) {
1150 1121 mxinclude(url);
1151   - }
1152   - else {
  1122 + } else {
1153 1123 mxscript(url);
1154 1124 }
1155   - }
1156   - else {
  1125 + } else {
1157 1126 if (useInclude) {
1158 1127 mxinclude(url);
1159   - }
1160   - else {
  1128 + } else {
1161 1129 mxscript(drawDevUrl + url);
1162 1130 }
1163 1131 }
1164 1132 }
1165   - }
1166   - else if (window.console != null) {
  1133 + } else if (window.console != null) {
1167 1134 console.log('Unknown plugin:', plugins[i]);
1168 1135 }
1169   - }
1170   - catch (e) {
  1136 + } catch (e) {
1171 1137 if (window.console != null) {
1172 1138 console.log('Error loading plugin:', plugins[i], e);
1173 1139 }
... ... @@ -1188,8 +1154,7 @@ App.prototype.initializeEmbedMode = function () {
1188 1154
1189 1155 if (App.embedModePluginsCount > 0 || this.initEmbedDone) {
1190 1156 return; //Wait for plugins to load, or this is a duplicate call due to timeout
1191   - }
1192   - else {
  1157 + } else {
1193 1158 this.initEmbedDone = true;
1194 1159 }
1195 1160
... ... @@ -1212,7 +1177,7 @@ App.prototype.initializeViewerMode = function () {
1212 1177
1213 1178 /**
1214 1179 * Translates this point by the given vector.
1215   - * 原型初始化,所有的原型调用此方法初始化
  1180 + * 原型初始化,所有的原型调用此方法初始化
1216 1181 * @param {number} dx X-coordinate of the translation.
1217 1182 * @param {number} dy Y-coordinate of the translation.
1218 1183 */
... ... @@ -1280,8 +1245,7 @@ App.prototype.init = function () {
1280 1245
1281 1246 // Notifies listeners of new client
1282 1247 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.oneDrive));
1283   - }
1284   - else if (window.DrawOneDriveClientCallback == null) {
  1248 + } else if (window.DrawOneDriveClientCallback == null) {
1285 1249 window.DrawOneDriveClientCallback = initOneDriveClient;
1286 1250 }
1287 1251 });
... ... @@ -1309,14 +1273,12 @@ App.prototype.init = function () {
1309 1273
1310 1274 // Notifies listeners of new client
1311 1275 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.trello));
1312   - }
1313   - catch (e) {
  1276 + } catch (e) {
1314 1277 if (window.console != null) {
1315 1278 console.error(e);
1316 1279 }
1317 1280 }
1318   - }
1319   - else if (window.DrawTrelloClientCallback == null) {
  1281 + } else if (window.DrawTrelloClientCallback == null) {
1320 1282 window.DrawTrelloClientCallback = initTrelloClient;
1321 1283 }
1322 1284 });
... ... @@ -1353,12 +1315,10 @@ App.prototype.init = function () {
1353 1315 * Clears any callbacks.
1354 1316 */
1355 1317 window.DrawGapiClientCallback = null;
1356   - }
1357   - else {
  1318 + } else {
1358 1319 doInit();
1359 1320 }
1360   - }
1361   - else if (window.DrawGapiClientCallback == null) {
  1321 + } else if (window.DrawGapiClientCallback == null) {
1362 1322 window.DrawGapiClientCallback = initDriveClient;
1363 1323 }
1364 1324 });
... ... @@ -1390,14 +1350,12 @@ App.prototype.init = function () {
1390 1350
1391 1351 // Notifies listeners of new client
1392 1352 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.dropbox));
1393   - }
1394   - catch (e) {
  1353 + } catch (e) {
1395 1354 if (window.console != null) {
1396 1355 console.error(e);
1397 1356 }
1398 1357 }
1399   - }
1400   - else if (window.DrawDropboxClientCallback == null) {
  1358 + } else if (window.DrawDropboxClientCallback == null) {
1401 1359 window.DrawDropboxClientCallback = initDropboxClient;
1402 1360 }
1403 1361 });
... ... @@ -1420,8 +1378,7 @@ App.prototype.init = function () {
1420 1378 // Sets the initial mode
1421 1379 if (urlParams['local'] == '1') {
1422 1380 this.setMode(App.MODE_DEVICE);
1423   - }
1424   - else {
  1381 + } else {
1425 1382 this.mode = App.mode;
1426 1383 }
1427 1384
... ... @@ -1445,8 +1402,7 @@ App.prototype.init = function () {
1445 1402 if (urlParams['extAuth'] != '1' && (mode == App.MODE_DEVICE || mode == App.MODE_BROWSER)) {
1446 1403 //关闭桌面弹出广告
1447 1404 //this.showDownloadDesktopBanner();
1448   - }
1449   - else if (urlParams['embed'] != '1' && this.getServiceName() == 'draw.io') {
  1405 + } else if (urlParams['embed'] != '1' && this.getServiceName() == 'draw.io') {
1450 1406 // just app.diagrams.net users
1451 1407 // this.showNameConfBanner();
1452 1408 }
... ... @@ -1485,8 +1441,7 @@ App.prototype.init = function () {
1485 1441 window.clearTimeout(timeoutThread);
1486 1442 }));
1487 1443 }
1488   - }
1489   - else if (this.menubar != null) {
  1444 + } else if (this.menubar != null) {
1490 1445 this.menubar.container.style.paddingTop = '0px';
1491 1446 }
1492 1447
... ... @@ -1823,8 +1778,7 @@ App.prototype.checkLicense = function () {
1823 1778 }
1824 1779 }
1825 1780 }
1826   - }
1827   - catch (e) {
  1781 + } catch (e) {
1828 1782 // ignore
1829 1783 }
1830 1784 }));
... ... @@ -1848,8 +1802,7 @@ App.prototype.getEditBlankXml = function () {
1848 1802
1849 1803 if (file != null && this.editor.isChromelessView() && this.editor.graph.isLightboxView()) {
1850 1804 return file.getData();
1851   - }
1852   - else {
  1805 + } else {
1853 1806 return this.getFileData(true);
1854 1807 }
1855 1808 };
... ... @@ -1872,8 +1825,7 @@ App.prototype.addRecent = function (entry) {
1872 1825
1873 1826 if (recent == null) {
1874 1827 recent = [];
1875   - }
1876   - else {
  1828 + } else {
1877 1829 for (var i = 0; i < recent.length; i++) {
1878 1830 if (recent[i].id == entry.id) {
1879 1831 recent.splice(i, 1);
... ... @@ -1900,8 +1852,7 @@ App.prototype.getRecent = function () {
1900 1852 if (recent != null) {
1901 1853 return JSON.parse(recent);
1902 1854 }
1903   - }
1904   - catch (e) {
  1855 + } catch (e) {
1905 1856 // ignore
1906 1857 }
1907 1858
... ... @@ -1916,8 +1867,7 @@ App.prototype.resetRecent = function (entry) {
1916 1867 if (isLocalStorage && localStorage != null) {
1917 1868 try {
1918 1869 localStorage.removeItem('.recent');
1919   - }
1920   - catch (e) {
  1870 + } catch (e) {
1921 1871 // ignore
1922 1872 }
1923 1873 }
... ... @@ -1929,8 +1879,7 @@ App.prototype.resetRecent = function (entry) {
1929 1879 App.prototype.onBeforeUnload = function () {
1930 1880 if (urlParams['embed'] == '1' && this.editor.modified) {
1931 1881 return mxResources.get('allChangesLost');
1932   - }
1933   - else {
  1882 + } else {
1934 1883 var file = this.getCurrentFile();
1935 1884
1936 1885 if (file != null) {
... ... @@ -1939,11 +1888,9 @@ App.prototype.onBeforeUnload = function () {
1939 1888 urlParams['nowarn'] != '1' && !this.isDiagramEmpty() && urlParams['url'] == null &&
1940 1889 !this.editor.isChromelessView() && file.fileHandle == null) {
1941 1890 return mxResources.get('ensureDataSaved');
1942   - }
1943   - else if (file.isModified()) {
  1891 + } else if (file.isModified()) {
1944 1892 return mxResources.get('allChangesLost');
1945   - }
1946   - else {
  1893 + } else {
1947 1894 file.close(true);
1948 1895 }
1949 1896 }
... ... @@ -2023,8 +1970,7 @@ App.prototype.getThumbnail = function (width, fn) {
2023 1970
2024 1971 if (this.currentPage == page) {
2025 1972 graph.setBackgroundImage(bgImg);
2026   - }
2027   - else if (page.viewState != null && page.viewState != null) {
  1973 + } else if (page.viewState != null && page.viewState != null) {
2028 1974 bgImg = page.viewState.backgroundImage;
2029 1975 graph.setBackgroundImage(bgImg);
2030 1976 }
... ... @@ -2032,8 +1978,7 @@ App.prototype.getThumbnail = function (width, fn) {
2032 1978 graph.getGlobalVariable = function (name) {
2033 1979 if (name == 'page') {
2034 1980 return page.getName();
2035   - }
2036   - else if (name == 'pagenumber') {
  1981 + } else if (name == 'pagenumber') {
2037 1982 return 1;
2038 1983 }
2039 1984
... ... @@ -2053,8 +1998,7 @@ App.prototype.getThumbnail = function (width, fn) {
2053 1998 if (graph != this.editor.graph && graph.container.parentNode != null) {
2054 1999 graph.container.parentNode.removeChild(graph.container);
2055 2000 }
2056   - }
2057   - catch (e) {
  2001 + } catch (e) {
2058 2002 canvas = null;
2059 2003 }
2060 2004
... ... @@ -2066,8 +2010,7 @@ App.prototype.getThumbnail = function (width, fn) {
2066 2010 null, 'diagram', null);
2067 2011
2068 2012 result = true;
2069   - }
2070   - else if (this.canvasSupported && this.getCurrentFile() != null) {
  2013 + } else if (this.canvasSupported && this.getCurrentFile() != null) {
2071 2014 var canvas = document.createElement('canvas');
2072 2015 var bounds = graph.getGraphBounds();
2073 2016 var t = graph.view.translate;
... ... @@ -2157,8 +2100,7 @@ App.prototype.getThumbnail = function (width, fn) {
2157 2100 if (graph != this.editor.graph && graph.container.parentNode != null) {
2158 2101 graph.container.parentNode.removeChild(graph.container);
2159 2102 }
2160   - }
2161   - catch (e) {
  2103 + } catch (e) {
2162 2104 canvas = null;
2163 2105 }
2164 2106
... ... @@ -2167,8 +2109,7 @@ App.prototype.getThumbnail = function (width, fn) {
2167 2109
2168 2110 result = true;
2169 2111 }
2170   - }
2171   - catch (e) {
  2112 + } catch (e) {
2172 2113 result = false;
2173 2114
2174 2115 // Removes temporary graph from DOM
... ... @@ -2229,16 +2170,13 @@ App.prototype.createBackground = function () {
2229 2170 if (mode == App.MODE_GOOGLE) {
2230 2171 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('googleDrive')]));
2231 2172 this.appIcon.style.cursor = 'pointer';
2232   - }
2233   - else if (mode == App.MODE_DROPBOX) {
  2173 + } else if (mode == App.MODE_DROPBOX) {
2234 2174 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('dropbox')]));
2235 2175 this.appIcon.style.cursor = 'pointer';
2236   - }
2237   - else if (mode == App.MODE_ONEDRIVE) {
  2176 + } else if (mode == App.MODE_ONEDRIVE) {
2238 2177 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('oneDrive')]));
2239 2178 this.appIcon.style.cursor = 'pointer';
2240   - }
2241   - else {
  2179 + } else {
2242 2180 this.appIcon.removeAttribute('title');
2243 2181 this.appIcon.style.cursor = (mode == App.MODE_DEVICE) ? 'pointer' : 'default';
2244 2182 }
... ... @@ -2248,14 +2186,12 @@ App.prototype.createBackground = function () {
2248 2186 try {
2249 2187 if (isLocalStorage) {
2250 2188 localStorage.setItem('.mode', mode);
2251   - }
2252   - else if (typeof (Storage) != 'undefined') {
  2189 + } else if (typeof (Storage) != 'undefined') {
2253 2190 var expiry = new Date();
2254 2191 expiry.setYear(expiry.getFullYear() + 1);
2255 2192 document.cookie = 'MODE=' + mode + '; expires=' + expiry.toUTCString();
2256 2193 }
2257   - }
2258   - catch (e) {
  2194 + } catch (e) {
2259 2195 // ignore possible access denied
2260 2196 }
2261 2197 }
... ... @@ -2270,8 +2206,7 @@ App.prototype.createBackground = function () {
2270 2206 App.prototype.appIconClicked = function (evt) {
2271 2207 if (mxEvent.isAltDown(evt)) {
2272 2208 this.showSplash(true);
2273   - }
2274   - else {
  2209 + } else {
2275 2210 var file = this.getCurrentFile();
2276 2211 var mode = (file != null) ? file.getMode() : null;
2277 2212
... ... @@ -2280,15 +2215,12 @@ App.prototype.appIconClicked = function (evt) {
2280 2215 file.desc.parents.length > 0 && !mxEvent.isShiftDown(evt)) {
2281 2216 // Opens containing folder
2282 2217 this.openLink('https://drive.google.com/drive/folders/' + file.desc.parents[0].id);
2283   - }
2284   - else if (file != null && file.getId() != null) {
  2218 + } else if (file != null && file.getId() != null) {
2285 2219 this.openLink('https://drive.google.com/open?id=' + file.getId());
2286   - }
2287   - else {
  2220 + } else {
2288 2221 this.openLink('https://drive.google.com/?authuser=0');
2289 2222 }
2290   - }
2291   - else if (mode == App.MODE_ONEDRIVE) {
  2223 + } else if (mode == App.MODE_ONEDRIVE) {
2292 2224 if (file != null && file.meta != null && file.meta.webUrl != null) {
2293 2225 var url = file.meta.webUrl;
2294 2226 var name = encodeURIComponent(file.meta.name);
... ... @@ -2298,12 +2230,10 @@ App.prototype.appIconClicked = function (evt) {
2298 2230 }
2299 2231
2300 2232 this.openLink(url);
2301   - }
2302   - else {
  2233 + } else {
2303 2234 this.openLink('https://onedrive.live.com/');
2304 2235 }
2305   - }
2306   - else if (mode == App.MODE_DROPBOX) {
  2236 + } else if (mode == App.MODE_DROPBOX) {
2307 2237 if (file != null && file.stat != null && file.stat.path_display != null) {
2308 2238 var url = 'https://www.dropbox.com/home/Apps/drawio' + file.stat.path_display;
2309 2239
... ... @@ -2312,31 +2242,24 @@ App.prototype.appIconClicked = function (evt) {
2312 2242 }
2313 2243
2314 2244 this.openLink(url);
2315   - }
2316   - else {
  2245 + } else {
2317 2246 this.openLink('https://www.dropbox.com/');
2318 2247 }
2319   - }
2320   - else if (mode == App.MODE_TRELLO) {
  2248 + } else if (mode == App.MODE_TRELLO) {
2321 2249 this.openLink('https://trello.com/');
2322   - }
2323   - else if (mode == App.MODE_GITHUB) {
  2250 + } else if (mode == App.MODE_GITHUB) {
2324 2251 if (file != null && file.constructor == GitHubFile) {
2325 2252 this.openLink(file.meta.html_url);
2326   - }
2327   - else {
  2253 + } else {
2328 2254 this.openLink('https://github.com/');
2329 2255 }
2330   - }
2331   - else if (mode == App.MODE_GITLAB) {
  2256 + } else if (mode == App.MODE_GITLAB) {
2332 2257 if (file != null && file.constructor == GitLabFile) {
2333 2258 this.openLink(file.meta.html_url);
2334   - }
2335   - else {
  2259 + } else {
2336 2260 this.openLink(DRAWIO_GITLAB_URL);
2337 2261 }
2338   - }
2339   - else if (mode == App.MODE_DEVICE) {
  2262 + } else if (mode == App.MODE_DEVICE) {
2340 2263 this.openLink('https://get.draw.io/');
2341 2264 }
2342 2265 }
... ... @@ -2352,8 +2275,7 @@ App.prototype.appIconClicked = function (evt) {
2352 2275 App.prototype.clearMode = function () {
2353 2276 if (isLocalStorage) {
2354 2277 localStorage.removeItem('.mode');
2355   - }
2356   - else if (typeof (Storage) != 'undefined') {
  2278 + } else if (typeof (Storage) != 'undefined') {
2357 2279 var expiry = new Date();
2358 2280 expiry.setYear(expiry.getFullYear() - 1);
2359 2281 document.cookie = 'MODE=; expires=' + expiry.toUTCString();
... ... @@ -2408,8 +2330,7 @@ App.prototype.open = function () {
2408 2330 value.substring(0, 8) != 'https://') {
2409 2331 var doc = mxUtils.parseXml(window.opener[value]);
2410 2332 this.editor.setGraphXml(doc.documentElement);
2411   - }
2412   - else if (window.opener.openFile != null) {
  2333 + } else if (window.opener.openFile != null) {
2413 2334 window.opener.openFile.setConsumer(mxUtils.bind(this, function (xml, filename, temp) {
2414 2335 this.spinner.stop();
2415 2336
... ... @@ -2419,8 +2340,7 @@ App.prototype.open = function () {
2419 2340
2420 2341 if (title != null) {
2421 2342 filename = decodeURIComponent(title);
2422   - }
2423   - else {
  2343 + } else {
2424 2344 filename = this.defaultFilename;
2425 2345 }
2426 2346 }
... ... @@ -2438,8 +2358,7 @@ App.prototype.open = function () {
2438 2358 }));
2439 2359 }
2440 2360 }
2441   - }
2442   - catch (e) {
  2361 + } catch (e) {
2443 2362 // ignore
2444 2363 }
2445 2364 };
... ... @@ -2462,8 +2381,7 @@ App.prototype.load = function () {
2462 2381 if (this.spinner.spin(document.body, mxResources.get('starting'))) {
2463 2382 try {
2464 2383 this.stateArg = (urlParams['state'] != null && this.drive != null) ? JSON.parse(decodeURIComponent(urlParams['state'])) : null;
2465   - }
2466   - catch (e) {
  2384 + } catch (e) {
2467 2385 // ignores invalid state args
2468 2386 }
2469 2387
... ... @@ -2479,8 +2397,7 @@ App.prototype.load = function () {
2479 2397 if (urlParams['fileId'] != null) {
2480 2398 window.location.hash = 'G' + urlParams['fileId'];
2481 2399 window.location.search = this.getSearch(['fileId']);
2482   - }
2483   - else {
  2400 + } else {
2484 2401 // Asynchronous or disabled loading of client
2485 2402 if (this.drive == null) {
2486 2403 if (this.mode == App.MODE_GOOGLE) {
... ... @@ -2488,20 +2405,19 @@ App.prototype.load = function () {
2488 2405 }
2489 2406
2490 2407 this.start();
2491   - }
2492   - else {
  2408 + } else {
2493 2409 this.loadGapi(mxUtils.bind(this, function () {
2494 2410 this.start();
2495 2411 }));
2496 2412 }
2497 2413 }
2498 2414 }
2499   - }
2500   - else {
  2415 + } else {
2501 2416 this.restoreLibraries();
2502 2417
2503 2418 if (urlParams['gapi'] == '1') {
2504   - this.loadGapi(function () { });
  2419 + this.loadGapi(function () {
  2420 + });
2505 2421 }
2506 2422 }
2507 2423 };
... ... @@ -2648,8 +2564,7 @@ App.prototype.start = function () {
2648 2564 (!this.editor.chromeless || this.editor.editable)) {
2649 2565 this.showNameChangeBanner();
2650 2566 }
2651   - }
2652   - catch (e) {
  2567 + } catch (e) {
2653 2568 // ignore
2654 2569 }
2655 2570
... ... @@ -2662,8 +2577,7 @@ App.prototype.start = function () {
2662 2577 if (file == null || file.getHash() != id) {
2663 2578 this.loadFile(id, true);
2664 2579 }
2665   - }
2666   - catch (e) {
  2580 + } catch (e) {
2667 2581 // Workaround for possible scrollWidth of null in Dialog ctor
2668 2582 if (document.body != null) {
2669 2583 this.handleError(e, mxResources.get('errorLoadingFile'), mxUtils.bind(this, function () {
... ... @@ -2682,8 +2596,7 @@ App.prototype.start = function () {
2682 2596 null, mxUtils.bind(this, function (e) {
2683 2597 this.handleError(e, mxResources.get('errorLoadingFile'));
2684 2598 }));
2685   - }
2686   - catch (e) {
  2599 + } catch (e) {
2687 2600 this.handleError(e, mxResources.get('errorLoadingFile'));
2688 2601 }
2689 2602 }
... ... @@ -2708,8 +2621,7 @@ App.prototype.start = function () {
2708 2621
2709 2622 if (title != null) {
2710 2623 title = decodeURIComponent(title);
2711   - }
2712   - else {
  2624 + } else {
2713 2625 title = this.defaultFilename;
2714 2626 }
2715 2627
... ... @@ -2732,14 +2644,12 @@ App.prototype.start = function () {
2732 2644
2733 2645 if (value != null) {
2734 2646 doLoadFile(parent[decodeURIComponent(value)]);
2735   - }
2736   - else {
  2647 + } else {
2737 2648 value = urlParams['data'];
2738 2649
2739 2650 if (value != null) {
2740 2651 doLoadFile(decodeURIComponent(value));
2741   - }
2742   - else {
  2652 + } else {
2743 2653 this.installMessageHandler(mxUtils.bind(this, function (xml, evt) {
2744 2654 // Ignores messages from other windows
2745 2655 if (evt.source == parent) {
... ... @@ -2756,8 +2666,7 @@ App.prototype.start = function () {
2756 2666 var prev = Editor.useLocalStorage;
2757 2667 this.createFile(this.defaultFilename, null, null, null, null, null, null, true);
2758 2668 Editor.useLocalStorage = prev;
2759   - }
2760   - else {
  2669 + } else {
2761 2670 var waiting = false;
2762 2671
2763 2672 // Checks if we're waiting for some asynchronous file to be loaded
... ... @@ -2765,24 +2674,21 @@ App.prototype.start = function () {
2765 2674 // were opened from another domain then this will fail.
2766 2675 try {
2767 2676 waiting = window.opener != null && window.opener.openFile != null;
2768   - }
2769   - catch (e) {
  2677 + } catch (e) {
2770 2678 // ignore
2771 2679 }
2772 2680
2773 2681 if (waiting) {
2774 2682 // Spinner is stopped in App.open
2775 2683 this.spinner.spin(document.body, mxResources.get('loading'))
2776   - }
2777   - else {
  2684 + } else {
2778 2685 var id = this.getDiagramId();
2779 2686
2780 2687 if (EditorUi.enableDrafts && urlParams['mode'] == null &&
2781 2688 this.getServiceName() == 'draw.io' && (id == null || id.length == 0) &&
2782 2689 !this.editor.isChromelessView()) {
2783 2690 this.checkDrafts();
2784   - }
2785   - else if (id != null && id.length > 0) {
  2691 + } else if (id != null && id.length > 0) {
2786 2692 this.loadFile(id, null, null, mxUtils.bind(this, function () {
2787 2693 var temp = decodeURIComponent(urlParams['viewbox'] || '');
2788 2694
... ... @@ -2790,18 +2696,15 @@ App.prototype.start = function () {
2790 2696 try {
2791 2697 var bounds = JSON.parse(temp);
2792 2698 this.editor.graph.fitWindow(bounds, bounds.border);
2793   - }
2794   - catch (e) {
  2699 + } catch (e) {
2795 2700 // Ignore invalid viewport
2796 2701 console.error(e);
2797 2702 }
2798 2703 }
2799 2704 }));
2800   - }
2801   - else if (urlParams['splash'] != '0' || urlParams['mode'] != null) {
  2705 + } else if (urlParams['splash'] != '0' || urlParams['mode'] != null) {
2802 2706 this.loadFile();
2803   - }
2804   - else if (!EditorUi.isElectronApp) {
  2707 + } else if (!EditorUi.isElectronApp) {
2805 2708 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
2806 2709 }
2807 2710 }
... ... @@ -2817,7 +2720,8 @@ App.prototype.start = function () {
2817 2720 // Removes URL parameter and reloads the page
2818 2721 if (this.spinner.spin(document.body, mxResources.get('reconnecting'))) {
2819 2722 window.location.search = this.getSearch(['create', 'title']);
2820   - };
  2723 + }
  2724 + ;
2821 2725 });
2822 2726
2823 2727 var showCreateDialog = mxUtils.bind(this, function (xml) {
... ... @@ -2833,8 +2737,7 @@ App.prototype.start = function () {
2833 2737
2834 2738 if (title != null) {
2835 2739 title = decodeURIComponent(title);
2836   - }
2837   - else {
  2740 + } else {
2838 2741 title = this.defaultFilename;
2839 2742 }
2840 2743
... ... @@ -2853,8 +2756,7 @@ App.prototype.start = function () {
2853 2756 this.createFile((filename.length > 0) ? filename : this.defaultFilename,
2854 2757 this.getFileData(), null, null, null, true, null, true);
2855 2758 Editor.useLocalStorage = prev;
2856   - }
2857   - else {
  2759 + } else {
2858 2760 this.pickFolder(mode, mxUtils.bind(this, function (folderId) {
2859 2761 this.createFile(filename, this.getFileData(true),
2860 2762 null, mode, null, true, folderId);
... ... @@ -2881,24 +2783,20 @@ App.prototype.start = function () {
2881 2783 try {
2882 2784 if (window.opener != null && window.opener[value] != null) {
2883 2785 showCreateDialog(window.opener[value]);
2884   - }
2885   - else {
  2786 + } else {
2886 2787 this.handleError(null, mxResources.get('errorLoadingFile'));
2887 2788 }
2888   - }
2889   - catch (e) {
  2789 + } catch (e) {
2890 2790 this.handleError(e, mxResources.get('errorLoadingFile'));
2891 2791 }
2892   - }
2893   - else {
  2792 + } else {
2894 2793 this.loadTemplate(value, function (text) {
2895 2794 showCreateDialog(text);
2896 2795 }, mxUtils.bind(this, function () {
2897 2796 this.handleError(null, mxResources.get('errorLoadingFile'), reconnect);
2898 2797 }));
2899 2798 }
2900   - }
2901   - else {
  2799 + } else {
2902 2800 // Passes the fileId from the state parameter to the hash tag and reloads
2903 2801 // the page without the state parameter
2904 2802 if ((window.location.hash == null || window.location.hash.length <= 1) &&
... ... @@ -2912,8 +2810,7 @@ App.prototype.start = function () {
2912 2810
2913 2811 window.location.hash = 'G' + this.stateArg.ids[0];
2914 2812 }
2915   - }
2916   - else if ((window.location.hash == null || window.location.hash.length <= 1) &&
  2813 + } else if ((window.location.hash == null || window.location.hash.length <= 1) &&
2917 2814 this.drive != null && this.stateArg != null && this.stateArg.action == 'create') {
2918 2815 if (window.history && window.history.replaceState) {
2919 2816 // Removes state URL parameter without reloading the page
... ... @@ -2927,12 +2824,10 @@ App.prototype.start = function () {
2927 2824 this.createFile((urlParams['title'] != null) ?
2928 2825 decodeURIComponent(urlParams['title']) :
2929 2826 this.defaultFilename);
2930   - }
2931   - else {
  2827 + } else {
2932 2828 this.actions.get('new').funct();
2933 2829 }
2934   - }
2935   - else {
  2830 + } else {
2936 2831 // Removes open URL parameter. Hash is also updated in Init to load client.
2937 2832 if (urlParams['open'] != null && window.history && window.history.replaceState) {
2938 2833
... ... @@ -2945,8 +2840,7 @@ App.prototype.start = function () {
2945 2840 }
2946 2841 }
2947 2842 }
2948   - }
2949   - catch (e) {
  2843 + } catch (e) {
2950 2844 this.handleError(e);
2951 2845 }
2952 2846 };
... ... @@ -2994,16 +2888,14 @@ App.prototype.filterDrafts = function (filePath, guid, callback) {
2994 2888 drafts.push(obj);
2995 2889 }
2996 2890 }
2997   - }
2998   - catch (e) {
  2891 + } catch (e) {
2999 2892 // ignore
3000 2893 }
3001 2894 }
3002 2895
3003 2896 result();
3004 2897 }, result));
3005   - }
3006   - catch (e) {
  2898 + } catch (e) {
3007 2899 result();
3008 2900 }
3009 2901 };
... ... @@ -3025,8 +2917,7 @@ App.prototype.checkDrafts = function () {
3025 2917 this.loadDraft(drafts[0].data, mxUtils.bind(this, function () {
3026 2918 this.removeDatabaseItem(drafts[0].key);
3027 2919 }));
3028   - }
3029   - else if (drafts.length > 1) {
  2920 + } else if (drafts.length > 1) {
3030 2921 var ts = new Date(drafts[0].modified);
3031 2922
3032 2923 var dlg = new DraftDialog(this, (drafts.length > 1) ? mxResources.get('selectDraft') :
... ... @@ -3053,23 +2944,19 @@ App.prototype.checkDrafts = function () {
3053 2944 this.showDialog(dlg.container, 640, 480, true, false, mxUtils.bind(this, function (cancel) {
3054 2945 if (urlParams['splash'] != '0') {
3055 2946 this.loadFile();
3056   - }
3057   - else {
  2947 + } else {
3058 2948 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
3059 2949 }
3060 2950 }));
3061 2951 dlg.init();
3062   - }
3063   - else if (urlParams['splash'] != '0') {
  2952 + } else if (urlParams['splash'] != '0') {
3064 2953 this.loadFile();
3065   - }
3066   - else {
  2954 + } else {
3067 2955 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
3068 2956 }
3069 2957 }));
3070 2958 }), 0);
3071   - }
3072   - catch (e) {
  2959 + } catch (e) {
3073 2960 // ignore
3074 2961 }
3075 2962 };
... ... @@ -3108,8 +2995,7 @@ App.prototype.showSplash = function (force) {
3108 2995 mxResources.get('errorLoadingFile'), mxUtils.bind(this, function () {
3109 2996 this.showSplash();
3110 2997 }));
3111   - }
3112   - else if (!mxClient.IS_CHROMEAPP && (this.mode == null || force)) {
  2998 + } else if (!mxClient.IS_CHROMEAPP && (this.mode == null || force)) {
3113 2999 var rowLimit = (serviceCount == 4) ? 2 : 3;
3114 3000
3115 3001 var dlg = new StorageDialog(this, mxUtils.bind(this, function () {
... ... @@ -3119,8 +3005,7 @@ App.prototype.showSplash = function (force) {
3119 3005
3120 3006 this.showDialog(dlg.container, (rowLimit < 3) ? 200 : 300,
3121 3007 ((serviceCount > 3) ? 320 : 210), true, false);
3122   - }
3123   - else if (urlParams['create'] == null) {
  3008 + } else if (urlParams['create'] == null) {
3124 3009 showSecondDialog();
3125 3010 }
3126 3011 };
... ... @@ -3209,12 +3094,10 @@ App.prototype.loadFileSystemEntry = function (fileHandle, success, error) {
3209 3094 }
3210 3095
3211 3096 success(new LocalFile(this, data, file.name, null, fileHandle, file));
3212   - }
3213   - else {
  3097 + } else {
3214 3098 this.openFileHandle(e.target.result, file.name, file, false, fileHandle);
3215 3099 }
3216   - }
3217   - catch (e) {
  3100 + } catch (e) {
3218 3101 error(e);
3219 3102 }
3220 3103 });
... ... @@ -3225,13 +3108,11 @@ App.prototype.loadFileSystemEntry = function (fileHandle, success, error) {
3225 3108 file.type === 'application/pdf') &&
3226 3109 file.type.substring(0, 9) !== 'image/svg') {
3227 3110 reader.readAsDataURL(file);
3228   - }
3229   - else {
  3111 + } else {
3230 3112 reader.readAsText(file);
3231 3113 }
3232 3114 }), error);
3233   - }
3234   - catch (e) {
  3115 + } catch (e) {
3235 3116 error(e);
3236 3117 }
3237 3118 };
... ... @@ -3261,12 +3142,10 @@ App.prototype.createFileSystemOptions = function (name) {
3261 3142
3262 3143 if (this.editor.diagramFileTypes[i].extension == temp) {
3263 3144 ext.splice(0, 0, obj);
3264   - }
3265   - else {
  3145 + } else {
3266 3146 if (this.editor.diagramFileTypes[i].extension == temp) {
3267 3147 ext.splice(0, 0, obj);
3268   - }
3269   - else {
  3148 + } else {
3270 3149 ext.push(obj);
3271 3150 }
3272 3151 }
... ... @@ -3310,18 +3189,15 @@ App.prototype.pickFile = function (mode) {
3310 3189 if (mode == App.MODE_GOOGLE) {
3311 3190 if (this.drive != null && typeof (google) != 'undefined' && typeof (google.picker) != 'undefined') {
3312 3191 this.drive.pickFile();
3313   - }
3314   - else {
  3192 + } else {
3315 3193 this.openLink('https://drive.google.com');
3316 3194 }
3317   - }
3318   - else {
  3195 + } else {
3319 3196 var peer = this.getPeerForMode(mode);
3320 3197
3321 3198 if (peer != null) {
3322 3199 peer.pickFile();
3323   - }
3324   - else if (mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) {
  3200 + } else if (mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) {
3325 3201 window.showOpenFilePicker().then(mxUtils.bind(this, function (fileHandles) {
3326 3202 if (fileHandles != null && fileHandles.length > 0 &&
3327 3203 this.spinner.spin(document.body, mxResources.get('loading'))) {
... ... @@ -3332,8 +3208,7 @@ App.prototype.pickFile = function (mode) {
3332 3208 this.handleError(e);
3333 3209 }
3334 3210 }));
3335   - }
3336   - else if (mode == App.MODE_DEVICE && Graph.fileSupport) {
  3211 + } else if (mode == App.MODE_DEVICE && Graph.fileSupport) {
3337 3212 if (this.openFileInputElt == null) {
3338 3213 var input = document.createElement('input');
3339 3214 input.setAttribute('type', 'file');
... ... @@ -3356,8 +3231,7 @@ App.prototype.pickFile = function (mode) {
3356 3231 }
3357 3232
3358 3233 this.openFileInputElt.click();
3359   - }
3360   - else {
  3234 + } else {
3361 3235 this.hideDialog();
3362 3236 window.openNew = this.getCurrentFile() != null && !this.isDiagramEmpty();
3363 3237 window.baseUrl = this.getUrl();
... ... @@ -3398,8 +3272,7 @@ App.prototype.pickFile = function (mode) {
3398 3272
3399 3273 if (currentFile == null || !currentFile.isModified()) {
3400 3274 doOpenFile();
3401   - }
3402   - else {
  3275 + } else {
3403 3276 this.confirm(mxResources.get('allChangesLost'), null, doOpenFile,
3404 3277 mxResources.get('cancel'), mxResources.get('discardChanges'));
3405 3278 }
... ... @@ -3419,8 +3292,7 @@ App.prototype.pickFile = function (mode) {
3419 3292 });
3420 3293 }
3421 3294 }
3422   - }
3423   - catch (e) {
  3295 + } catch (e) {
3424 3296 this.handleError(e);
3425 3297 }
3426 3298 };
... ... @@ -3448,20 +3320,17 @@ App.prototype.pickLibrary = function (mode) {
3448 3320 if (optionalFile != null) {
3449 3321 try {
3450 3322 this.loadLibrary(optionalFile);
3451   - }
3452   - catch (e) {
  3323 + } catch (e) {
3453 3324 this.handleError(e, mxResources.get('errorLoadingFile'));
3454 3325 }
3455   - }
3456   - else {
  3326 + } else {
3457 3327 if (this.spinner.spin(document.body, mxResources.get('loading'))) {
3458 3328 peer.getLibrary(id, mxUtils.bind(this, function (file) {
3459 3329 this.spinner.stop();
3460 3330
3461 3331 try {
3462 3332 this.loadLibrary(file);
3463   - }
3464   - catch (e) {
  3333 + } catch (e) {
3465 3334 this.handleError(e, mxResources.get('errorLoadingFile'));
3466 3335 }
3467 3336 }), mxUtils.bind(this, function (resp) {
... ... @@ -3471,8 +3340,7 @@ App.prototype.pickLibrary = function (mode) {
3471 3340 }
3472 3341 }));
3473 3342 }
3474   - }
3475   - else if (mode == App.MODE_DEVICE && Graph.fileSupport) {
  3343 + } else if (mode == App.MODE_DEVICE && Graph.fileSupport) {
3476 3344 if (this.libFileInputElt == null) {
3477 3345 var input = document.createElement('input');
3478 3346 input.setAttribute('type', 'file');
... ... @@ -3486,8 +3354,7 @@ App.prototype.pickLibrary = function (mode) {
3486 3354 reader.onload = mxUtils.bind(this, function (e) {
3487 3355 try {
3488 3356 this.loadLibrary(new LocalLibrary(this, e.target.result, file.name));
3489   - }
3490   - catch (e) {
  3357 + } catch (e) {
3491 3358 this.handleError(e, mxResources.get('errorLoadingFile'));
3492 3359 }
3493 3360 });
... ... @@ -3509,8 +3376,7 @@ App.prototype.pickLibrary = function (mode) {
3509 3376 }
3510 3377
3511 3378 this.libFileInputElt.click();
3512   - }
3513   - else {
  3379 + } else {
3514 3380 window.openNew = false;
3515 3381 window.openKey = 'open';
3516 3382
... ... @@ -3538,8 +3404,7 @@ App.prototype.pickLibrary = function (mode) {
3538 3404 try {
3539 3405 this.loadLibrary((mode == App.MODE_BROWSER) ? new StorageLibrary(this, xml, filename) :
3540 3406 new LocalLibrary(this, xml, filename));
3541   - }
3542   - catch (e) {
  3407 + } catch (e) {
3543 3408 this.handleError(e, mxResources.get('errorLoadingFile'));
3544 3409 }
3545 3410 }));
... ... @@ -3589,43 +3454,37 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload
3589 3454 this.hideDialog(true);
3590 3455 this.libraryLoaded(newFile, images);
3591 3456 }), error, this.drive.libraryMimeType);
3592   - }
3593   - else if (mode == App.MODE_GITHUB && this.gitHub != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3457 + } else if (mode == App.MODE_GITHUB && this.gitHub != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3594 3458 this.gitHub.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3595 3459 this.spinner.stop();
3596 3460 this.hideDialog(true);
3597 3461 this.libraryLoaded(newFile, images);
3598 3462 }), error, folderId);
3599   - }
3600   - else if (mode == App.MODE_GITLAB && this.gitLab != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3463 + } else if (mode == App.MODE_GITLAB && this.gitLab != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3601 3464 this.gitLab.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3602 3465 this.spinner.stop();
3603 3466 this.hideDialog(true);
3604 3467 this.libraryLoaded(newFile, images);
3605 3468 }), error, folderId);
3606   - }
3607   - else if (mode == App.MODE_TRELLO && this.trello != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3469 + } else if (mode == App.MODE_TRELLO && this.trello != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3608 3470 this.trello.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3609 3471 this.spinner.stop();
3610 3472 this.hideDialog(true);
3611 3473 this.libraryLoaded(newFile, images);
3612 3474 }), error, folderId);
3613   - }
3614   - else if (mode == App.MODE_DROPBOX && this.dropbox != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3475 + } else if (mode == App.MODE_DROPBOX && this.dropbox != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3615 3476 this.dropbox.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3616 3477 this.spinner.stop();
3617 3478 this.hideDialog(true);
3618 3479 this.libraryLoaded(newFile, images);
3619 3480 }), error, folderId);
3620   - }
3621   - else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3481 + } else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
3622 3482 this.oneDrive.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
3623 3483 this.spinner.stop();
3624 3484 this.hideDialog(true);
3625 3485 this.libraryLoaded(newFile, images);
3626 3486 }), error, folderId);
3627   - }
3628   - else if (mode == App.MODE_BROWSER) {
  3487 + } else if (mode == App.MODE_BROWSER) {
3629 3488 var fn = mxUtils.bind(this, function () {
3630 3489 var file = new StorageLibrary(this, xml, name);
3631 3490
... ... @@ -3638,17 +3497,14 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload
3638 3497
3639 3498 if (localStorage.getItem(name) == null) {
3640 3499 fn();
3641   - }
3642   - else {
  3500 + } else {
3643 3501 this.confirm(mxResources.get('replaceIt', [name]), fn);
3644 3502 }
3645   - }
3646   - else {
  3503 + } else {
3647 3504 this.handleError({ message: mxResources.get('serviceUnavailableOrBlocked') });
3648 3505 }
3649 3506 }));
3650   - }
3651   - else if (noSpin || this.spinner.spin(document.body, mxResources.get('saving'))) {
  3507 + } else if (noSpin || this.spinner.spin(document.body, mxResources.get('saving'))) {
3652 3508 file.setData(xml);
3653 3509
3654 3510 var doSave = mxUtils.bind(this, function () {
... ... @@ -3683,13 +3539,11 @@ App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload
3683 3539
3684 3540 doSave();
3685 3541 }), error)
3686   - }
3687   - else {
  3542 + } else {
3688 3543 doSave();
3689 3544 }
3690 3545 }
3691   - }
3692   - catch (e) {
  3546 + } catch (e) {
3693 3547 this.handleError(e);
3694 3548 }
3695 3549 };
... ... @@ -3712,8 +3566,7 @@ App.prototype.saveFile = function (forceDialog, success) {
3712 3566 // is to show no saved status for device files
3713 3567 if (file.getMode() != App.MODE_DEVICE) {
3714 3568 this.editor.setStatus(mxUtils.htmlEntities(mxResources.get('allChangesSaved')));
3715   - }
3716   - else {
  3569 + } else {
3717 3570 this.editor.setStatus('');
3718 3571 }
3719 3572 }
... ... @@ -3725,8 +3578,7 @@ App.prototype.saveFile = function (forceDialog, success) {
3725 3578
3726 3579 if (!forceDialog && file.getTitle() != null && file.invalidFileHandle == null && this.mode != null) {
3727 3580 this.save(file.getTitle(), done);
3728   - }
3729   - else if (file != null && file.constructor == LocalFile && file.fileHandle != null) {
  3581 + } else if (file != null && file.constructor == LocalFile && file.fileHandle != null) {
3730 3582 this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) {
3731 3583 file.invalidFileHandle = null;
3732 3584 file.fileHandle = fileHandle;
... ... @@ -3734,8 +3586,7 @@ App.prototype.saveFile = function (forceDialog, success) {
3734 3586 file.desc = desc;
3735 3587 this.save(desc.name, done);
3736 3588 }), null, this.createFileSystemOptions(file.getTitle()));
3737   - }
3738   - else {
  3589 + } else {
3739 3590 var filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename;
3740 3591 var allowTab = !mxClient.IS_IOS || !navigator.standalone;
3741 3592 var prev = this.mode;
... ... @@ -3760,13 +3611,11 @@ App.prototype.saveFile = function (forceDialog, success) {
3760 3611
3761 3612 if (mxClient.IS_GC || mxClient.IS_FF || document.documentMode >= 5) {
3762 3613 input.select();
3763   - }
3764   - else {
  3614 + } else {
3765 3615 document.execCommand('selectAll', false, null);
3766 3616 }
3767 3617 }), mxResources.get('yes'), mxResources.get('no'));
3768   - }
3769   - else {
  3618 + } else {
3770 3619 this.hideDialog();
3771 3620
3772 3621 if (prev == null && mode == App.MODE_DEVICE) {
... ... @@ -3784,17 +3633,14 @@ App.prototype.saveFile = function (forceDialog, success) {
3784 3633 this.handleError(e);
3785 3634 }
3786 3635 }), this.createFileSystemOptions(name));
3787   - }
3788   - else {
  3636 + } else {
3789 3637 this.setMode(App.MODE_DEVICE);
3790 3638 this.save(name, done);
3791 3639 }
3792   - }
3793   - else if (mode == 'download') {
  3640 + } else if (mode == 'download') {
3794 3641 var tmp = new LocalFile(this, null, name);
3795 3642 tmp.save();
3796   - }
3797   - else if (mode == '_blank') {
  3643 + } else if (mode == '_blank') {
3798 3644 window.openFile = new OpenFile(function () {
3799 3645 window.openFile = null;
3800 3646 });
... ... @@ -3802,16 +3648,14 @@ App.prototype.saveFile = function (forceDialog, success) {
3802 3648 // Do not use a filename to use undefined mode
3803 3649 window.openFile.setData(this.getFileData(true));
3804 3650 this.openLink(this.getUrl(window.location.pathname), null, true);
3805   - }
3806   - else if (prev != mode) {
  3651 + } else if (prev != mode) {
3807 3652 this.pickFolder(mode, mxUtils.bind(this, function (folderId) {
3808 3653 this.createFile(name, this.getFileData(/(\.xml)$/i.test(name) ||
3809 3654 name.indexOf('.') < 0 || /(\.drawio)$/i.test(name),
3810 3655 /(\.svg)$/i.test(name), /(\.html)$/i.test(name)),
3811 3656 null, mode, done, this.mode == null, folderId);
3812 3657 }));
3813   - }
3814   - else if (mode != null) {
  3658 + } else if (mode != null) {
3815 3659 this.save(name, done);
3816 3660 }
3817 3661 }
... ... @@ -3857,8 +3701,7 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a
3857 3701 if (!isVisioFilename) {
3858 3702 if (asLibrary) {
3859 3703 filterFn = this.isRemoteVisioData(data) ? 'raw.vss' : 'raw.vssx';
3860   - }
3861   - else {
  3704 + } else {
3862 3705 filterFn = this.isRemoteVisioData(data) ? 'raw.vsd' : 'raw.vsdx';
3863 3706 }
3864 3707 }
... ... @@ -3866,8 +3709,7 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a
3866 3709 this.importVisio(this.base64ToBlob(responseData.substring(responseData.indexOf(',') + 1)), function (xml) {
3867 3710 onload(xml);
3868 3711 }, onerror, filterFn);
3869   - }
3870   - else if (new XMLHttpRequest().upload && this.isRemoteFileFormat(data, filterFn)) {
  3712 + } else if (new XMLHttpRequest().upload && this.isRemoteFileFormat(data, filterFn)) {
3871 3713 if (this.isExternalDataComms()) {
3872 3714 // Asynchronous parsing via server
3873 3715 this.parseFileData(data, mxUtils.bind(this, function (xhr) {
... ... @@ -3876,27 +3718,23 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a
3876 3718 onload(xhr.responseText);
3877 3719 }
3878 3720 }), url);
3879   - }
3880   - else {
  3721 + } else {
3881 3722 this.showError(mxResources.get('error'), mxResources.get('notInOffline'), null, onerror);
3882 3723 }
3883   - }
3884   - else if (this.isLucidChartData(data)) {
  3724 + } else if (this.isLucidChartData(data)) {
3885 3725 this.convertLucidChart(data, mxUtils.bind(this, function (xml) {
3886 3726 onload(xml);
3887 3727 }), mxUtils.bind(this, function (e) {
3888 3728 onerror(e);
3889 3729 }));
3890   - }
3891   - else {
  3730 + } else {
3892 3731 if (/(\.png)($|\?)/i.test(filterFn) || Editor.isPngData(data)) {
3893 3732 data = Editor.extractGraphModelFromPng(responseData);
3894 3733 }
3895 3734
3896 3735 onload(data);
3897 3736 }
3898   - }
3899   - catch (e) {
  3737 + } catch (e) {
3900 3738 onerror(e);
3901 3739 }
3902 3740 }), onerror, /(\.png)($|\?)/i.test(filterFn) || /(\.v(dx|sdx?))($|\?)/i.test(filterFn) ||
... ... @@ -3912,23 +3750,17 @@ App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, a
3912 3750 App.prototype.getPeerForMode = function (mode) {
3913 3751 if (mode == App.MODE_GOOGLE) {
3914 3752 return this.drive;
3915   - }
3916   - else if (mode == App.MODE_GITHUB) {
  3753 + } else if (mode == App.MODE_GITHUB) {
3917 3754 return this.gitHub;
3918   - }
3919   - else if (mode == App.MODE_GITLAB) {
  3755 + } else if (mode == App.MODE_GITLAB) {
3920 3756 return this.gitLab;
3921   - }
3922   - else if (mode == App.MODE_DROPBOX) {
  3757 + } else if (mode == App.MODE_DROPBOX) {
3923 3758 return this.dropbox;
3924   - }
3925   - else if (mode == App.MODE_ONEDRIVE) {
  3759 + } else if (mode == App.MODE_ONEDRIVE) {
3926 3760 return this.oneDrive;
3927   - }
3928   - else if (mode == App.MODE_TRELLO) {
  3761 + } else if (mode == App.MODE_TRELLO) {
3929 3762 return this.trello;
3930   - }
3931   - else {
  3763 + } else {
3932 3764 return null;
3933 3765 }
3934 3766 };
... ... @@ -3954,8 +3786,7 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol
3954 3786
3955 3787 if (resp == null && this.getCurrentFile() == null && this.dialog == null) {
3956 3788 this.showSplash();
3957   - }
3958   - else if (resp != null) {
  3789 + } else if (resp != null) {
3959 3790 this.handleError(resp);
3960 3791 }
3961 3792 });
... ... @@ -3970,44 +3801,37 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol
3970 3801 complete();
3971 3802 this.fileCreated(file, libs, replace, done, clibs);
3972 3803 }), error);
3973   - }
3974   - else if (mode == App.MODE_GITHUB && this.gitHub != null) {
  3804 + } else if (mode == App.MODE_GITHUB && this.gitHub != null) {
3975 3805 this.gitHub.insertFile(title, data, mxUtils.bind(this, function (file) {
3976 3806 complete();
3977 3807 this.fileCreated(file, libs, replace, done, clibs);
3978 3808 }), error, false, folderId);
3979   - }
3980   - else if (mode == App.MODE_GITLAB && this.gitLab != null) {
  3809 + } else if (mode == App.MODE_GITLAB && this.gitLab != null) {
3981 3810 this.gitLab.insertFile(title, data, mxUtils.bind(this, function (file) {
3982 3811 complete();
3983 3812 this.fileCreated(file, libs, replace, done, clibs);
3984 3813 }), error, false, folderId);
3985   - }
3986   - else if (mode == App.MODE_TRELLO && this.trello != null) {
  3814 + } else if (mode == App.MODE_TRELLO && this.trello != null) {
3987 3815 this.trello.insertFile(title, data, mxUtils.bind(this, function (file) {
3988 3816 complete();
3989 3817 this.fileCreated(file, libs, replace, done, clibs);
3990 3818 }), error, false, folderId);
3991   - }
3992   - else if (mode == App.MODE_DROPBOX && this.dropbox != null) {
  3819 + } else if (mode == App.MODE_DROPBOX && this.dropbox != null) {
3993 3820 this.dropbox.insertFile(title, data, mxUtils.bind(this, function (file) {
3994 3821 complete();
3995 3822 this.fileCreated(file, libs, replace, done, clibs);
3996 3823 }), error);
3997   - }
3998   - else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null) {
  3824 + } else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null) {
3999 3825 this.oneDrive.insertFile(title, data, mxUtils.bind(this, function (file) {
4000 3826 complete();
4001 3827 this.fileCreated(file, libs, replace, done, clibs);
4002 3828 }), error, false, folderId);
4003   - }
4004   - else if (mode == App.MODE_BROWSER) {
  3829 + } else if (mode == App.MODE_BROWSER) {
4005 3830 StorageFile.insertFile(this, title, data, mxUtils.bind(this, function (file) {
4006 3831 complete();
4007 3832 this.fileCreated(file, libs, replace, done, clibs);
4008 3833 }), error);
4009   - }
4010   - else if (!tempFile && mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) {
  3834 + } else if (!tempFile && mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) {
4011 3835 complete();
4012 3836
4013 3837 this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) {
... ... @@ -4021,13 +3845,11 @@ App.prototype.createFile = function (title, data, libs, mode, done, replace, fol
4021 3845 error(e);
4022 3846 }
4023 3847 }), this.createFileSystemOptions(title));
4024   - }
4025   - else {
  3848 + } else {
4026 3849 complete();
4027 3850 this.fileCreated(new LocalFile(this, data, title, mode == null), libs, replace, done, clibs);
4028 3851 }
4029   - }
4030   - catch (e) {
  3852 + } catch (e) {
4031 3853 complete();
4032 3854 this.handleError(e);
4033 3855 }
... ... @@ -4121,8 +3943,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) {
4121 3943 var fn2 = mxUtils.bind(this, function () {
4122 3944 if (replace || currentFile == null || !currentFile.isModified()) {
4123 3945 fn3();
4124   - }
4125   - else {
  3946 + } else {
4126 3947 this.confirm(mxResources.get('allChangesLost'), null, fn3,
4127 3948 mxResources.get('cancel'), mxResources.get('discardChanges'));
4128 3949 }
... ... @@ -4148,8 +3969,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) {
4148 3969 }
4149 3970
4150 3971 window.openWindow(url, null, fn2);
4151   - }
4152   - else {
  3972 + } else {
4153 3973 fn2();
4154 3974 }
4155 3975 });
... ... @@ -4157,8 +3977,7 @@ App.prototype.fileCreated = function (file, libs, replace, done, clibs) {
4157 3977 // Updates data in memory for local files
4158 3978 if (file.constructor == LocalFile) {
4159 3979 fn();
4160   - }
4161   - else {
  3980 + } else {
4162 3981 file.saveFile(file.getTitle(), false, mxUtils.bind(this, function () {
4163 3982 fn();
4164 3983 }), mxUtils.bind(this, function (resp) {
... ... @@ -4185,6 +4004,11 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4185 4004 }
4186 4005
4187 4006 function getToken() {
  4007 +
  4008 + /**
  4009 + * @description
  4010 + * @type {{userId: string, dev?: string, share?: string, configuration: string, publicId?: string }}
  4011 + */
4188 4012 const urlParams = (function () {
4189 4013 var result = new Object();
4190 4014 var params = window.location.search.slice(1).split('&');
... ... @@ -4199,8 +4023,11 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4199 4023
4200 4024 return result;
4201 4025 })();
4202   -
  4026 + console.log(urlParams)
4203 4027 if (urlParams.userId) {
  4028 + /**
  4029 + * @description 小程序第三方登录获取token
  4030 + */
4204 4031 axios.get(`/api/yt/third/login/id/${urlParams.userId}`)
4205 4032 .then(res => {
4206 4033 const { token, refreshToken } = res.data || {}
... ... @@ -4209,78 +4036,155 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
4209 4036 getSaveContent()
4210 4037 })
4211 4038 } else {
4212   - getSaveContent()
  4039 + /**
  4040 + * @description 分享页面获取token
  4041 + */
  4042 + if (urlParams.share && urlParams.publicId) {
  4043 + axios.post('/api/auth/login/public', { publicId: urlParams.publicId })
  4044 + .then(res => {
  4045 + const { token, refreshToken } = res.data || {}
  4046 + GLOBAL_TOKEN.token = token
  4047 + GLOBAL_TOKEN.refreshToken = refreshToken
  4048 + getSaveContent()
  4049 + })
  4050 + } else {
  4051 + getSaveContent()
  4052 + }
4213 4053 }
4214 4054 }
4215 4055
4216 4056 getToken()
4217 4057
4218 4058 var updateButtonContainer = this.updateButtonContainer
4219   - // var lockUnlock = this.actions.actions.lockUnlock.funct
4220   - // var selectAll = this.actions.actions.selectAll.funct
4221 4059 function getUserPermission() {
4222 4060 defHttp.get('/yt/role/me/permissions')
4223 4061 .then(res => {
4224 4062 USER_PERMISSION.permission = res
4225 4063 updateButtonContainer()
4226   - // var flag = hasSavePermission()
4227   - // if (!flag) {
4228   - // selectAll()
4229   - // lockUnlock()
4230   - // }
4231 4064 })
4232 4065 }
  4066 +
  4067 + function afterSaveContent(response) {
  4068 + getUserPermission()
  4069 + const { platform } = response || {}
  4070 + const pageSizeControl = PageSetupDialog.getFormats
  4071 + PageSetupDialog.getFormats = function () {
  4072 + if (platform === 'phone') {
  4073 + return [
  4074 + { key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667) },
  4075 + { key: 'iPhone 8 Plus', title: 'iPhone 8 Plus', format: new mxRectangle(0, 0, 415, 737) },
  4076 + { key: 'iPhone X/XS', title: 'iPhone X/XS', format: new mxRectangle(0, 0, 376, 813) },
  4077 + {
  4078 + key: 'iPhone XR/XS Max',
  4079 + title: 'iPhone XR/XS Max',
  4080 + format: new mxRectangle(0, 0, 415, 897)
  4081 + },
  4082 + { key: 'iPad 4', title: 'iPad 4', format: new mxRectangle(0, 0, 709, 1025) },
  4083 + { key: 'Galaxy S9', title: 'Galaxy S9', format: new mxRectangle(0, 0, 361, 741) },
  4084 + { key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741) },
  4085 + { key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741) },
  4086 + { key: 'Galaxy S10/S10+', title: 'Galaxy S10/S10+', format: new mxRectangle(0, 0, 413, 870) },
  4087 + { key: 'Pixel 2', title: 'Pixel 2', format: new mxRectangle(0, 0, 413, 732) },
  4088 + { key: 'Pixel 3', title: 'Pixel 3', format: new mxRectangle(0, 0, 413, 825) },
  4089 + { key: 'Pixel 3', title: 'Pixel 3', format: new mxRectangle(0, 0, 413, 825) },
  4090 + { key: 'Pixel XL', title: 'Pixel XL', format: new mxRectangle(0, 0, 413, 848) },
  4091 + { key: 'custom', title: mxResources.get('custom'), format: null }
  4092 + ]
  4093 + }
  4094 + return pageSizeControl.apply(this, arguments)
  4095 + }
  4096 + Editor.configurationName = response.configurationName + ".drawio";
  4097 + if (response.configurationContentList.length > 0) {
  4098 + response.configurationContentList.forEach((item) => {
  4099 + Editor.configurationContentId = item.id;
  4100 + if (item.content) {
  4101 + Editor.defaultContent = item.content;
  4102 + } else {
  4103 + //默认空白内容
  4104 + Editor.defaultContent = EditorUi.prototype.emptyDiagramXml;
  4105 + }
  4106 + })
  4107 + }
  4108 + if (id == null || id.length == 0) {
  4109 + fn();
  4110 + } else if (currentFile != null && !sameWindow) {
  4111 + this.showDialog(new PopupDialog(this, this.getUrl() + '#' + id,
  4112 + null, fn).container, 320, 140, true, true);
  4113 + } else {
  4114 + fn();
  4115 + }
  4116 +
  4117 + }
  4118 +
4233 4119 var pageFormat = this.editor.graph.pageFormat
4234 4120
4235   - // 调用API,获取保存的内容
4236   - function getSaveContent() {
4237   - defHttp.get('/yt/configuration/center/get_configuration_info/' + Editor.configurationId)
  4121 + function createAccessTokenFormLayer() {
  4122 + var field = 'accessCredentials'
  4123 + var formSubmitFilter = 'formData'
  4124 + var index = layer.open({
  4125 + type: 1,
  4126 + title: '访问令牌',
  4127 + area: ['350px', '200px'],
  4128 + closeBtn: 0,
  4129 + content: `
  4130 + <section style="padding: 20px;display: flex;justify-content: center;align-items: center;flex-direction: column;">
  4131 + <form class="layui-form" action="">
  4132 + <div class="layui-form-item">
  4133 + <label class="layui-form-label" style="width: 60px;padding: 9px 0;">访问令牌</label>
  4134 + <div class="layui-input-block" style="margin-left: 70px;">
  4135 + <input required lay-verify="required" type="text" name="${field}" lay-verify="title" autocomplete="off" placeholder="请输入访问令牌" class="layui-input">
  4136 + </div>
  4137 + </div>
  4138 + <button lay-submit lay-filter="${formSubmitFilter}" type="button" class="layui-btn layui-btn-normal" style="width: 100%; margin-top: 10px;">进入</button>
  4139 + </form>
  4140 + </section>
  4141 + `,
  4142 + });
  4143 + var form = layui.form
  4144 + form.on(`submit(${formSubmitFilter})`, function (data) {
  4145 + var value = data.field.accessCredentials
  4146 + getShareContentData(value, index)
  4147 + })
  4148 + }
  4149 +
  4150 + function getShareContentData(accessCredentials, index) {
  4151 + var id = urlParams.configurationId
  4152 + var share = urlParams.share
  4153 + defHttp.get(`/yt/share/${share}/share_data/${id}${accessCredentials ? `?accessCredentials=${accessCredentials}` : ''}`)
  4154 + .then(function (res) {
  4155 + var layer = layui.layer
  4156 + index && layer.close(index)
  4157 + afterSaveContent(res.data)
  4158 + })
  4159 + .catch(function (error) {
  4160 + var msg = error.response ? (error.response.data || {}).msg || '' : error.message
  4161 + var layer = layui.layer
  4162 + layer.msg(msg, { icon: 5, offset: 't' });
  4163 + })
  4164 + }
  4165 +
  4166 + function checkSharePageNeedAccessToken() {
  4167 + var id = urlParams.configurationId
  4168 + var share = urlParams.share
  4169 + defHttp.get(`/yt/share/check/${share}/${id}`)
4238 4170 .then(function (response) {
4239   - getUserPermission()
4240   - const { platform } = response || {}
4241   - const pageSizeControl = PageSetupDialog.getFormats
4242   - PageSetupDialog.getFormats = function () {
4243   - if (platform === 'phone') {
4244   - return [
4245   - { key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667) },
4246   - { key: 'iPhone 8 Plus', title: 'iPhone 8 Plus', format: new mxRectangle(0, 0, 415, 737) },
4247   - { key: 'iPhone X/XS', title: 'iPhone X/XS', format: new mxRectangle(0, 0, 376, 813) },
4248   - { key: 'iPhone XR/XS Max', title: 'iPhone XR/XS Max', format: new mxRectangle(0, 0, 415, 897) },
4249   - { key: 'iPad 4', title: 'iPad 4', format: new mxRectangle(0, 0, 709, 1025) },
4250   - { key: 'Galaxy S9', title: 'Galaxy S9', format: new mxRectangle(0, 0, 361, 741) },
4251   - { key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741) },
4252   - { key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741) },
4253   - { key: 'Galaxy S10/S10+', title: 'Galaxy S10/S10+', format: new mxRectangle(0, 0, 413, 870) },
4254   - { key: 'Pixel 2', title: 'Pixel 2', format: new mxRectangle(0, 0, 413, 732) },
4255   - { key: 'Pixel 3', title: 'Pixel 3', format: new mxRectangle(0, 0, 413, 825) },
4256   - { key: 'Pixel 3', title: 'Pixel 3', format: new mxRectangle(0, 0, 413, 825) },
4257   - { key: 'Pixel XL', title: 'Pixel XL', format: new mxRectangle(0, 0, 413, 848) },
4258   - { key: 'custom', title: mxResources.get('custom'), format: null }
4259   - ]
4260   - }
4261   - return pageSizeControl.apply(this, arguments)
4262   - }
4263   - Editor.configurationName = response.configurationName + ".drawio";
4264   - if (response.configurationContentList.length > 0) {
4265   - response.configurationContentList.forEach((item) => {
4266   - Editor.configurationContentId = item.id;
4267   - if (item.content) {
4268   - Editor.defaultContent = item.content;
4269   - } else {
4270   - //默认空白内容
4271   - Editor.defaultContent = EditorUi.prototype.emptyDiagramXml;
4272   - }
4273   - })
4274   - }
4275   - if (id == null || id.length == 0) {
4276   - fn();
4277   - } else if (currentFile != null && !sameWindow) {
4278   - this.showDialog(new PopupDialog(this, this.getUrl() + '#' + id,
4279   - null, fn).container, 320, 140, true, true);
  4171 + if (response.data) {
  4172 + createAccessTokenFormLayer()
4280 4173 } else {
4281   - fn();
  4174 + getShareContentData()
4282 4175 }
  4176 + })
  4177 + }
4283 4178
  4179 + // 调用API,获取保存的内容
  4180 + function getSaveContent() {
  4181 + if (urlParams.share) {
  4182 + checkSharePageNeedAccessToken()
  4183 + return
  4184 + }
  4185 + defHttp.get('/yt/configuration/center/get_configuration_info/' + Editor.configurationId)
  4186 + .then(function (response) {
  4187 + afterSaveContent(response)
4284 4188 })
4285 4189 .catch(function (error) {
4286 4190 });
... ... @@ -4710,23 +4614,17 @@ App.prototype.getLibraryStorageHint = function (file) {
4710 4614
4711 4615 if (file.constructor == DriveLibrary) {
4712 4616 tip += ' (' + mxResources.get('googleDrive') + ')';
4713   - }
4714   - else if (file.constructor == GitHubLibrary) {
  4617 + } else if (file.constructor == GitHubLibrary) {
4715 4618 tip += ' (' + mxResources.get('github') + ')';
4716   - }
4717   - else if (file.constructor == TrelloLibrary) {
  4619 + } else if (file.constructor == TrelloLibrary) {
4718 4620 tip += ' (' + mxResources.get('trello') + ')';
4719   - }
4720   - else if (file.constructor == DropboxLibrary) {
  4621 + } else if (file.constructor == DropboxLibrary) {
4721 4622 tip += ' (' + mxResources.get('dropbox') + ')';
4722   - }
4723   - else if (file.constructor == OneDriveLibrary) {
  4623 + } else if (file.constructor == OneDriveLibrary) {
4724 4624 tip += ' (' + mxResources.get('oneDrive') + ')';
4725   - }
4726   - else if (file.constructor == StorageLibrary) {
  4625 + } else if (file.constructor == StorageLibrary) {
4727 4626 tip += ' (' + mxResources.get('browser') + ')';
4728   - }
4729   - else if (file.constructor == LocalLibrary) {
  4627 + } else if (file.constructor == LocalLibrary) {
4730 4628 tip += ' (' + mxResources.get('device') + ')';
4731 4629 }
4732 4630
... ... @@ -4831,19 +4729,16 @@ App.prototype.loadLibraries = function (libs, done) {
4831 4729
4832 4730 if (xml != null) {
4833 4731 onload(new StorageLibrary(this, xml, name));
4834   - }
4835   - else {
  4732 + } else {
4836 4733 onerror();
4837 4734 }
4838 4735 }), onerror);
4839   - }
4840   - catch (e) {
  4736 + } catch (e) {
4841 4737 onerror();
4842 4738 }
4843 4739 }), 0);
4844 4740 }
4845   - }
4846   - else if (service == 'U') {
  4741 + } else if (service == 'U') {
4847 4742 var url = decodeURIComponent(id.substring(1));
4848 4743
4849 4744 if (!this.isOffline()) {
... ... @@ -4851,16 +4746,14 @@ App.prototype.loadLibraries = function (libs, done) {
4851 4746 if (text != null && text.length > 0) {
4852 4747 // LATER: Convert mxfile to mxlibrary using code from libraryLoaded
4853 4748 onload(new UrlLibrary(this, text, url));
4854   - }
4855   - else {
  4749 + } else {
4856 4750 onerror();
4857 4751 }
4858 4752 }), function () {
4859 4753 onerror();
4860 4754 }, null, true);
4861 4755 }
4862   - }
4863   - else if (service == 'R') {
  4756 + } else if (service == 'R') {
4864 4757 var libDesc = decodeURIComponent(id.substring(1));
4865 4758
4866 4759 try {
... ... @@ -4874,52 +4767,43 @@ App.prototype.loadLibraries = function (libs, done) {
4874 4767 this.remoteInvoke('getFileContent', [libObj.downloadUrl], null, mxUtils.bind(this, function (libContent) {
4875 4768 try {
4876 4769 onload(new RemoteLibrary(this, libContent, libObj));
4877   - }
4878   - catch (e) {
  4770 + } catch (e) {
4879 4771 onerror();
4880 4772 }
4881 4773 }), function () {
4882 4774 onerror();
4883 4775 });
4884   - }
4885   - catch (e) {
  4776 + } catch (e) {
4886 4777 onerror();
4887 4778 }
4888   - }
4889   - else if (service == 'S' && this.loadDesktopLib != null) {
  4779 + } else if (service == 'S' && this.loadDesktopLib != null) {
4890 4780 try {
4891 4781 this.loadDesktopLib(decodeURIComponent(id.substring(1)), function (desktopLib) {
4892 4782 onload(desktopLib);
4893 4783 }, onerror);
4894   - }
4895   - catch (e) {
  4784 + } catch (e) {
4896 4785 onerror();
4897 4786 }
4898   - }
4899   - else {
  4787 + } else {
4900 4788 var peer = null;
4901 4789
4902 4790 if (service == 'G') {
4903 4791 if (this.drive != null && this.drive.user != null) {
4904 4792 peer = this.drive;
4905 4793 }
4906   - }
4907   - else if (service == 'H') {
  4794 + } else if (service == 'H') {
4908 4795 if (this.gitHub != null && this.gitHub.getUser() != null) {
4909 4796 peer = this.gitHub;
4910 4797 }
4911   - }
4912   - else if (service == 'T') {
  4798 + } else if (service == 'T') {
4913 4799 if (this.trello != null && this.trello.isAuthorized()) {
4914 4800 peer = this.trello;
4915 4801 }
4916   - }
4917   - else if (service == 'D') {
  4802 + } else if (service == 'D') {
4918 4803 if (this.dropbox != null && this.dropbox.getUser() != null) {
4919 4804 peer = this.dropbox;
4920 4805 }
4921   - }
4922   - else if (service == 'W') {
  4806 + } else if (service == 'W') {
4923 4807 if (this.oneDrive != null && this.oneDrive.getUser() != null) {
4924 4808 peer = this.oneDrive;
4925 4809 }
... ... @@ -4929,15 +4813,13 @@ App.prototype.loadLibraries = function (libs, done) {
4929 4813 peer.getLibrary(decodeURIComponent(id.substring(1)), mxUtils.bind(this, function (file) {
4930 4814 try {
4931 4815 onload(file);
4932   - }
4933   - catch (e) {
  4816 + } catch (e) {
4934 4817 onerror();
4935 4818 }
4936 4819 }), function (resp) {
4937 4820 onerror();
4938 4821 });
4939   - }
4940   - else {
  4822 + } else {
4941 4823 onerror(true);
4942 4824 }
4943 4825 }
... ... @@ -4946,8 +4828,7 @@ App.prototype.loadLibraries = function (libs, done) {
4946 4828 }
4947 4829
4948 4830 checkDone();
4949   - }
4950   - else {
  4831 + } else {
4951 4832 checkDone();
4952 4833 }
4953 4834 }
... ... @@ -4968,8 +4849,7 @@ App.prototype.updateButtonContainer = function () {
4968 4849 this.buttonContainer.style.paddingRight = '12px';
4969 4850 this.buttonContainer.style.paddingTop = '6px';
4970 4851 this.buttonContainer.style.right = urlParams['noLangIcon'] == '1' ? '0' : '25px';
4971   - }
4972   - else if (uiTheme != 'min') {
  4852 + } else if (uiTheme != 'min') {
4973 4853 this.buttonContainer.style.paddingRight = '38px';
4974 4854 this.buttonContainer.style.paddingTop = '6px';
4975 4855 }
... ... @@ -4989,14 +4869,11 @@ App.prototype.updateButtonContainer = function () {
4989 4869 if (uiTheme == 'atlas') {
4990 4870 this.commentButton.style.marginRight = '10px';
4991 4871 this.commentButton.style.marginTop = '-3px';
4992   - }
4993   - else if (uiTheme == 'min') {
  4872 + } else if (uiTheme == 'min') {
4994 4873 this.commentButton.style.marginTop = '1px';
4995   - }
4996   - else if (urlParams['atlas'] == '1') {
  4874 + } else if (urlParams['atlas'] == '1') {
4997 4875 this.commentButton.style.marginTop = '-2px';
4998   - }
4999   - else {
  4876 + } else {
5000 4877 this.commentButton.style.marginTop = '-5px';
5001 4878 }
5002 4879
... ... @@ -5010,8 +4887,7 @@ App.prototype.updateButtonContainer = function () {
5010 4887 this.commentButton.style.filter = 'invert(100%)';
5011 4888 }
5012 4889 }
5013   - }
5014   - else if (this.commentButton != null) {
  4890 + } else if (this.commentButton != null) {
5015 4891 this.commentButton.parentNode.removeChild(this.commentButton);
5016 4892 this.commentButton = null;
5017 4893 }
... ... @@ -5140,8 +5016,7 @@ App.prototype.updateButtonContainer = function () {
5140 5016 this.rightContainer.appendChild(this.saveButton);
5141 5017
5142 5018 }
5143   - }
5144   - else if (this.shareButton != null) {
  5019 + } else if (this.shareButton != null) {
5145 5020 this.shareButton.parentNode.removeChild(this.shareButton);
5146 5021 this.shareButton = null;
5147 5022 this.saveButton.parentNode.removeChild(this.saveButton);
... ... @@ -5160,8 +5035,7 @@ App.prototype.updateButtonContainer = function () {
5160 5035 // TODO thingskit close notify bell
5161 5036 // this.fetchAndShowNotification('online', this.mode);
5162 5037 }
5163   - }
5164   - else if (urlParams['notif'] != null) //Notif for embed mode
  5038 + } else if (urlParams['notif'] != null) //Notif for embed mode
5165 5039 {
5166 5040 // TODO thingskit close notify bell
5167 5041 // this.fetchAndShowNotification(urlParams['notif']);
... ... @@ -5204,8 +5078,8 @@ App.prototype.fetchAndShowNotification = function (target, subtarget) {
5204 5078 if (localStorage != null) {
5205 5079 cachedNotif = JSON.parse(localStorage.getItem(cachedNotifKey));
5206 5080 }
5207   - }
5208   - catch (e) { } //Ignore
  5081 + } catch (e) {
  5082 + } //Ignore
5209 5083
5210 5084 if (cachedNotif == null || cachedNotif.ts + 24 * 60 * 60 * 1000 < Date.now()) //Cache for one day
5211 5085 {
... ... @@ -5228,8 +5102,7 @@ App.prototype.fetchAndShowNotification = function (target, subtarget) {
5228 5102 processNotif(notifs);
5229 5103 }
5230 5104 }));
5231   - }
5232   - else {
  5105 + } else {
5233 5106 processNotif(cachedNotif.notifs);
5234 5107 }
5235 5108 };
... ... @@ -5291,8 +5164,7 @@ App.prototype.showNotification = function (notifs, lsReadFlag) {
5291 5164 if (uiTheme == 'min') {
5292 5165 this.notificationBtn.style.width = '30px';
5293 5166 this.notificationBtn.style.top = '4px';
5294   - }
5295   - else if (urlParams['atlas'] == '1') {
  5167 + } else if (urlParams['atlas'] == '1') {
5296 5168 this.notificationBtn.style.top = '2px';
5297 5169 }
5298 5170
... ... @@ -5353,15 +5225,13 @@ App.prototype.showNotification = function (notifs, lsReadFlag) {
5353 5225 this.notificationWin.style.top = (r.top + this.notificationBtn.clientHeight) + 'px';
5354 5226 this.notificationWin.style.left = (r.right - this.notificationWin.clientWidth) + 'px';
5355 5227 shouldAnimate(0); //Stop animation once notifications are open
5356   - }
5357   - else {
  5228 + } else {
5358 5229 markAllAsRead();
5359 5230 }
5360 5231 }));
5361 5232
5362 5233 mxEvent.addListener(winClose, 'click', markAllAsRead);
5363   - }
5364   - else {
  5234 + } else {
5365 5235 this.notificationBtn.style.display = ''; //In case it was hidden
5366 5236 }
5367 5237
... ... @@ -5370,8 +5240,7 @@ App.prototype.showNotification = function (notifs, lsReadFlag) {
5370 5240
5371 5241 if (notifListEl == null) {
5372 5242 return; //This shouldn't happen and no meaning of continuing
5373   - }
5374   - else {
  5243 + } else {
5375 5244 notifListEl.innerHTML = '<div class="line"></div>';
5376 5245
5377 5246 for (var i = 0; i < notifs.length; i++) {
... ... @@ -5442,14 +5311,12 @@ App.prototype.save = function (name, done) {
5442 5311 try {
5443 5312 if (name == file.getTitle()) {
5444 5313 file.save(true, success, error);
5445   - }
5446   - else {
  5314 + } else {
5447 5315 file.saveAs(name, success, error)
5448 5316 }
5449 5317
5450 5318 console.log('file', file)
5451   - }
5452   - catch (err) {
  5319 + } catch (err) {
5453 5320 error(err);
5454 5321 }
5455 5322 }
... ... @@ -5479,8 +5346,7 @@ App.prototype.pickFolder = function (mode, fn, enabled, direct, force) {
5479 5346 fn(folderId);
5480 5347 }
5481 5348 }), force);
5482   - }
5483   - else if (enabled && mode == App.MODE_ONEDRIVE && this.oneDrive != null) {
  5349 + } else if (enabled && mode == App.MODE_ONEDRIVE && this.oneDrive != null) {
5484 5350 this.oneDrive.pickFolder(mxUtils.bind(this, function (files) {
5485 5351 var folderId = null;
5486 5352 resume();
... ... @@ -5490,26 +5356,22 @@ App.prototype.pickFolder = function (mode, fn, enabled, direct, force) {
5490 5356 fn(folderId);
5491 5357 }
5492 5358 }), direct);
5493   - }
5494   - else if (enabled && mode == App.MODE_GITHUB && this.gitHub != null) {
  5359 + } else if (enabled && mode == App.MODE_GITHUB && this.gitHub != null) {
5495 5360 this.gitHub.pickFolder(mxUtils.bind(this, function (folderPath) {
5496 5361 resume();
5497 5362 fn(folderPath);
5498 5363 }));
5499   - }
5500   - else if (enabled && mode == App.MODE_GITLAB && this.gitLab != null) {
  5364 + } else if (enabled && mode == App.MODE_GITLAB && this.gitLab != null) {
5501 5365 this.gitLab.pickFolder(mxUtils.bind(this, function (folderPath) {
5502 5366 resume();
5503 5367 fn(folderPath);
5504 5368 }));
5505   - }
5506   - else if (enabled && mode == App.MODE_TRELLO && this.trello != null) {
  5369 + } else if (enabled && mode == App.MODE_TRELLO && this.trello != null) {
5507 5370 this.trello.pickFolder(mxUtils.bind(this, function (cardId) {
5508 5371 resume();
5509 5372 fn(cardId);
5510 5373 }));
5511   - }
5512   - else {
  5374 + } else {
5513 5375 EditorUi.prototype.pickFolder.apply(this, arguments);
5514 5376 }
5515 5377 };
... ... @@ -5529,8 +5391,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5529 5391 this.handleError(resp);
5530 5392 }));
5531 5393 }
5532   - }
5533   - else if (mode == App.MODE_GOOGLE) {
  5394 + } else if (mode == App.MODE_GOOGLE) {
5534 5395 if (this.drive != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5535 5396 this.drive.insertFile(filename, data, folderId, mxUtils.bind(this, function (resp) {
5536 5397 // TODO: Add callback with url param for clickable status message
... ... @@ -5563,8 +5424,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5563 5424 this.handleError(resp);
5564 5425 }), mimeType, base64Encoded);
5565 5426 }
5566   - }
5567   - else if (mode == App.MODE_ONEDRIVE) {
  5427 + } else if (mode == App.MODE_ONEDRIVE) {
5568 5428 if (this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5569 5429 // KNOWN: OneDrive does not show .svg extension
5570 5430 this.oneDrive.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) :
... ... @@ -5575,8 +5435,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5575 5435 this.handleError(resp);
5576 5436 }), false, folderId);
5577 5437 }
5578   - }
5579   - else if (mode == App.MODE_GITHUB) {
  5438 + } else if (mode == App.MODE_GITHUB) {
5580 5439 if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5581 5440 // Must insert file as library to force the file to be written
5582 5441 this.gitHub.insertFile(filename, data, mxUtils.bind(this, function () {
... ... @@ -5586,8 +5445,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5586 5445 this.handleError(resp);
5587 5446 }), true, folderId, base64Encoded);
5588 5447 }
5589   - }
5590   - else if (mode == App.MODE_GITLAB) {
  5448 + } else if (mode == App.MODE_GITLAB) {
5591 5449 if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5592 5450 // Must insert file as library to force the file to be written
5593 5451 this.gitLab.insertFile(filename, data, mxUtils.bind(this, function () {
... ... @@ -5597,8 +5455,7 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5597 5455 this.handleError(resp);
5598 5456 }), true, folderId, base64Encoded);
5599 5457 }
5600   - }
5601   - else if (mode == App.MODE_TRELLO) {
  5458 + } else if (mode == App.MODE_TRELLO) {
5602 5459 if (this.trello != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
5603 5460 this.trello.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) :
5604 5461 data, mxUtils.bind(this, function () {
... ... @@ -5608,16 +5465,14 @@ App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mo
5608 5465 this.handleError(resp);
5609 5466 }), false, folderId);
5610 5467 }
5611   - }
5612   - else if (mode == App.MODE_BROWSER) {
  5468 + } else if (mode == App.MODE_BROWSER) {
5613 5469 var fn = mxUtils.bind(this, function () {
5614 5470 localStorage.setItem(filename, data);
5615 5471 });
5616 5472
5617 5473 if (localStorage.getItem(filename) == null) {
5618 5474 fn();
5619   - }
5620   - else {
  5475 + } else {
5621 5476 this.confirm(mxResources.get('replaceIt', [filename]), fn);
5622 5477 }
5623 5478 }
... ... @@ -5657,8 +5512,7 @@ App.prototype.descriptorChanged = function () {
5657 5512
5658 5513 if (newHash.length > 0) {
5659 5514 window.location.hash = newHash;
5660   - }
5661   - else if (window.location.hash.length > 0) {
  5515 + } else if (window.location.hash.length > 0) {
5662 5516 window.location.hash = '';
5663 5517 }
5664 5518 }
... ... @@ -5691,8 +5545,7 @@ App.prototype.showAuthDialog = function (peer, showRememberOption, fn, closeFn)
5691 5545 resume();
5692 5546 }));
5693 5547 }
5694   - }
5695   - catch (e) {
  5548 + } catch (e) {
5696 5549 this.editor.setStatus(mxUtils.htmlEntities(e.message));
5697 5550 }
5698 5551 })).container, 300, (showRememberOption) ? 180 : 140, true, true, mxUtils.bind(this, function (cancel) {
... ... @@ -5748,24 +5601,21 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5748 5601 if (gitHubUrl) {
5749 5602 var file = JSON.parse(req.responseText);
5750 5603 blob = this.base64ToBlob(file.content, 'application/octet-stream');
5751   - }
5752   - else {
  5604 + } else {
5753 5605 blob = new Blob([req.response], { type: 'application/octet-stream' });
5754 5606 }
5755 5607
5756 5608 this.importVisio(blob, mxUtils.bind(this, function (xml) {
5757 5609 success(new LocalFile(this, xml, name, true));
5758 5610 }), error, filename)
5759   - }
5760   - else if (error != null) {
  5611 + } else if (error != null) {
5761 5612 error({ message: mxResources.get('errorLoadingFile') });
5762 5613 }
5763 5614 });
5764 5615
5765 5616 req.onerror = error;
5766 5617 req.send();
5767   - }
5768   - else {
  5618 + } else {
5769 5619 var handleData = mxUtils.bind(this, function (data) {
5770 5620 try {
5771 5621 if (/\.pdf$/i.test(filename)) {
... ... @@ -5774,34 +5624,28 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5774 5624 if (temp != null && temp.length > 0) {
5775 5625 success(new LocalFile(this, temp, name, true));
5776 5626 }
5777   - }
5778   - else if (/\.png$/i.test(filename)) {
  5627 + } else if (/\.png$/i.test(filename)) {
5779 5628 var temp = this.extractGraphModelFromPng(data);
5780 5629
5781 5630 if (temp != null) {
5782 5631 success(new LocalFile(this, temp, name, true));
5783   - }
5784   - else {
  5632 + } else {
5785 5633 success(new LocalFile(this, data, filename, true));
5786 5634 }
5787   - }
5788   - else if (Graph.fileSupport && new XMLHttpRequest().upload && this.isRemoteFileFormat(data, url)) {
  5635 + } else if (Graph.fileSupport && new XMLHttpRequest().upload && this.isRemoteFileFormat(data, url)) {
5789 5636 this.parseFileData(data, mxUtils.bind(this, function (xhr) {
5790 5637 if (xhr.readyState == 4) {
5791 5638 if (xhr.status >= 200 && xhr.status <= 299) {
5792 5639 success(new LocalFile(this, xhr.responseText, name, true));
5793   - }
5794   - else if (error != null) {
  5640 + } else if (error != null) {
5795 5641 error({ message: mxResources.get('errorLoadingFile') });
5796 5642 }
5797 5643 }
5798 5644 }), filename);
5799   - }
5800   - else {
  5645 + } else {
5801 5646 success(new LocalFile(this, data, name, true));
5802 5647 }
5803   - }
5804   - catch (e) {
  5648 + } catch (e) {
5805 5649 if (error != null) {
5806 5650 error(e);
5807 5651 }
... ... @@ -5824,11 +5668,9 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5824 5668 if (file.encoding === 'base64') {
5825 5669 if (/\.png$/i.test(filename)) {
5826 5670 data = 'data:image/png;base64,' + data;
5827   - }
5828   - else if (/\.pdf$/i.test(filename)) {
  5671 + } else if (/\.pdf$/i.test(filename)) {
5829 5672 data = 'data:application/pdf;base64,' + data;
5830   - }
5831   - else {
  5673 + } else {
5832 5674 // Workaround for character encoding issues in IE10/11
5833 5675 data = (window.atob && !mxClient.IS_IE && !mxClient.IS_IE11) ? atob(data) : Base64.decode(data);
5834 5676 }
... ... @@ -5836,8 +5678,7 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5836 5678
5837 5679 handleData(data);
5838 5680 }
5839   - }
5840   - else if (error != null) {
  5681 + } else if (error != null) {
5841 5682 error({ code: App.ERROR_UNKNOWN });
5842 5683 }
5843 5684 }), function () {
... ... @@ -5849,11 +5690,9 @@ App.prototype.convertFile = function (url, filename, mimeType, extension, succes
5849 5690 error({ code: App.ERROR_TIMEOUT, retry: fn });
5850 5691 }
5851 5692 }, headers);
5852   - }
5853   - else if (executeRequest != null) {
  5693 + } else if (executeRequest != null) {
5854 5694 executeRequest(url, handleData, error, binary);
5855   - }
5856   - else {
  5695 + } else {
5857 5696 this.editor.loadUrl(url, handleData, error, binary, null, null, null, headers);
5858 5697 }
5859 5698 }
... ... @@ -5908,24 +5747,19 @@ App.prototype.updateHeader = function () {
5908 5747 if (mode == App.MODE_GOOGLE) {
5909 5748 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/google-drive-logo-white.svg)';
5910 5749 this.appIcon.style.backgroundSize = '70% 70%';
5911   - }
5912   - else if (mode == App.MODE_DROPBOX) {
  5750 + } else if (mode == App.MODE_DROPBOX) {
5913 5751 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/dropbox-logo-white.svg)';
5914 5752 this.appIcon.style.backgroundSize = '70% 70%';
5915   - }
5916   - else if (mode == App.MODE_ONEDRIVE) {
  5753 + } else if (mode == App.MODE_ONEDRIVE) {
5917 5754 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/onedrive-logo-white.svg)';
5918 5755 this.appIcon.style.backgroundSize = '70% 70%';
5919   - }
5920   - else if (mode == App.MODE_GITHUB) {
  5756 + } else if (mode == App.MODE_GITHUB) {
5921 5757 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/github-logo-white.svg)';
5922 5758 this.appIcon.style.backgroundSize = '70% 70%';
5923   - }
5924   - else if (mode == App.MODE_GITLAB) {
  5759 + } else if (mode == App.MODE_GITLAB) {
5925 5760 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/gitlab-logo-white.svg)';
5926 5761 this.appIcon.style.backgroundSize = '100% 100%';
5927   - }
5928   - else if (mode == App.MODE_TRELLO) {
  5762 + } else if (mode == App.MODE_TRELLO) {
5929 5763 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/trello-logo-white-orange.svg)';
5930 5764 this.appIcon.style.backgroundSize = '70% 70%';
5931 5765 }
... ... @@ -6037,8 +5871,7 @@ App.prototype.updateHeader = function () {
6037 5871 var toggleFormatPanel = mxUtils.bind(this, function () {
6038 5872 if (this.formatWidth > 0) {
6039 5873 this.toggleFormatElement.style.backgroundImage = 'url(\'' + this.formatShowImage + '\')';
6040   - }
6041   - else {
  5874 + } else {
6042 5875 this.toggleFormatElement.style.backgroundImage = 'url(\'' + this.formatHideImage + '\')';
6043 5876 }
6044 5877 });
... ... @@ -6180,8 +6013,7 @@ App.prototype.toggleCompactMode = function (visible) {
6180 6013 this.menubarHeight = App.prototype.menubarHeight;
6181 6014 this.refresh();
6182 6015 this.toggleElement.style.backgroundImage = 'url(\'' + this.chevronUpImage + '\')';
6183   - }
6184   - else {
  6016 + } else {
6185 6017 this.menubar.container.style.position = 'relative';
6186 6018 this.menubar.container.style.paddingLeft = '4px';
6187 6019 this.menubar.container.style.paddingTop = '0px';
... ... @@ -6216,8 +6048,7 @@ App.prototype.updateUserElement = function () {
6216 6048 this.userElement.parentNode.removeChild(this.userElement);
6217 6049 this.userElement = null;
6218 6050 }
6219   - }
6220   - else {
  6051 + } else {
6221 6052 if (this.userElement == null) {
6222 6053 this.userElement = document.createElement('a');
6223 6054 this.userElement.className = 'geItem';
... ... @@ -6259,8 +6090,7 @@ App.prototype.updateUserElement = function () {
6259 6090
6260 6091 if (this.userPanel.parentNode != null) {
6261 6092 this.userPanel.parentNode.removeChild(this.userPanel);
6262   - }
6263   - else {
  6093 + } else {
6264 6094 var connected = false;
6265 6095 this.userPanel.innerHTML = '';
6266 6096
... ... @@ -6300,8 +6130,7 @@ App.prototype.updateUserElement = function () {
6300 6130 this.spinner.stop();
6301 6131 callback();
6302 6132 }), 2000);
6303   - }
6304   - else {
  6133 + } else {
6305 6134 callback();
6306 6135 }
6307 6136 });
... ... @@ -6531,13 +6360,11 @@ App.prototype.updateUserElement = function () {
6531 6360
6532 6361 if (!file.isModified()) {
6533 6362 doLogout();
6534   - }
6535   - else {
  6363 + } else {
6536 6364 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6537 6365 mxResources.get('cancel'), mxResources.get('discardChanges'));
6538 6366 }
6539   - }
6540   - else {
  6367 + } else {
6541 6368 this.dropbox.logout();
6542 6369 }
6543 6370 }), mxResources.get('dropbox'));
... ... @@ -6555,13 +6382,11 @@ App.prototype.updateUserElement = function () {
6555 6382
6556 6383 if (!file.isModified()) {
6557 6384 doLogout();
6558   - }
6559   - else {
  6385 + } else {
6560 6386 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6561 6387 mxResources.get('cancel'), mxResources.get('discardChanges'));
6562 6388 }
6563   - }
6564   - else {
  6389 + } else {
6565 6390 this.oneDrive.logout();
6566 6391 }
6567 6392 }), mxResources.get('oneDrive'));
... ... @@ -6579,13 +6404,11 @@ App.prototype.updateUserElement = function () {
6579 6404
6580 6405 if (!file.isModified()) {
6581 6406 doLogout();
6582   - }
6583   - else {
  6407 + } else {
6584 6408 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6585 6409 mxResources.get('cancel'), mxResources.get('discardChanges'));
6586 6410 }
6587   - }
6588   - else {
  6411 + } else {
6589 6412 this.gitHub.logout();
6590 6413 }
6591 6414 }), mxResources.get('github'));
... ... @@ -6603,13 +6426,11 @@ App.prototype.updateUserElement = function () {
6603 6426
6604 6427 if (!file.isModified()) {
6605 6428 doLogout();
6606   - }
6607   - else {
  6429 + } else {
6608 6430 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6609 6431 mxResources.get('cancel'), mxResources.get('discardChanges'));
6610 6432 }
6611   - }
6612   - else {
  6433 + } else {
6613 6434 this.gitLab.logout();
6614 6435 }
6615 6436 }), mxResources.get('gitlab'));
... ... @@ -6628,13 +6449,11 @@ App.prototype.updateUserElement = function () {
6628 6449
6629 6450 if (!file.isModified()) {
6630 6451 doLogout();
6631   - }
6632   - else {
  6452 + } else {
6633 6453 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
6634 6454 mxResources.get('cancel'), mxResources.get('discardChanges'));
6635 6455 }
6636   - }
6637   - else {
  6456 + } else {
6638 6457 this.trello.logout();
6639 6458 }
6640 6459 }), mxResources.get('trello'));
... ... @@ -6672,8 +6491,7 @@ App.prototype.updateUserElement = function () {
6672 6491 div.appendChild(btn);
6673 6492 this.userPanel.appendChild(div);
6674 6493 }
6675   - }
6676   - else {
  6494 + } else {
6677 6495 var btn = mxUtils.button(mxResources.get('close'), mxUtils.bind(this, function () {
6678 6496 if (!mxEvent.isConsumed(evt) && this.userPanel != null && this.userPanel.parentNode != null) {
6679 6497 this.userPanel.parentNode.removeChild(this.userPanel);
... ... @@ -6701,17 +6519,13 @@ App.prototype.updateUserElement = function () {
6701 6519
6702 6520 if (this.drive != null && this.drive.getUser() != null) {
6703 6521 user = this.drive.getUser();
6704   - }
6705   - else if (this.oneDrive != null && this.oneDrive.getUser() != null) {
  6522 + } else if (this.oneDrive != null && this.oneDrive.getUser() != null) {
6706 6523 user = this.oneDrive.getUser();
6707   - }
6708   - else if (this.dropbox != null && this.dropbox.getUser() != null) {
  6524 + } else if (this.dropbox != null && this.dropbox.getUser() != null) {
6709 6525 user = this.dropbox.getUser();
6710   - }
6711   - else if (this.gitHub != null && this.gitHub.getUser() != null) {
  6526 + } else if (this.gitHub != null && this.gitHub.getUser() != null) {
6712 6527 user = this.gitHub.getUser();
6713   - }
6714   - else if (this.gitLab != null && this.gitLab.getUser() != null) {
  6528 + } else if (this.gitLab != null && this.gitLab.getUser() != null) {
6715 6529 user = this.gitLab.getUser();
6716 6530 }
6717 6531 //TODO Trello no user issue
... ... @@ -6723,8 +6537,7 @@ App.prototype.updateUserElement = function () {
6723 6537 mxUtils.write(this.userElement, user.displayName);
6724 6538 this.userElement.style.display = 'block';
6725 6539 }
6726   - }
6727   - else {
  6540 + } else {
6728 6541 this.userElement.style.display = 'none';
6729 6542 }
6730 6543 }
... ... @@ -6736,14 +6549,11 @@ App.prototype.getCurrentUser = function () {
6736 6549
6737 6550 if (this.drive != null && this.drive.getUser() != null) {
6738 6551 user = this.drive.getUser();
6739   - }
6740   - else if (this.oneDrive != null && this.oneDrive.getUser() != null) {
  6552 + } else if (this.oneDrive != null && this.oneDrive.getUser() != null) {
6741 6553 user = this.oneDrive.getUser();
6742   - }
6743   - else if (this.dropbox != null && this.dropbox.getUser() != null) {
  6554 + } else if (this.dropbox != null && this.dropbox.getUser() != null) {
6744 6555 user = this.dropbox.getUser();
6745   - }
6746   - else if (this.gitHub != null && this.gitHub.getUser() != null) {
  6556 + } else if (this.gitHub != null && this.gitHub.getUser() != null) {
6747 6557 user = this.gitHub.getUser();
6748 6558 }
6749 6559 //TODO Trello no user issue
... ...
... ... @@ -26,7 +26,7 @@
26 26 *
27 27 */
28 28 // Sidebar.prototype.defaultEntries = 'component;fan;engine;valve;controller;light;button;conduit;instrument;sewage;air;filters;pumps;factoryFacilities;flowMeter;foodProcessing;heater;industrial;plant;power;processCooling;processHeating;sink;';
29   - Sidebar.prototype.defaultEntries = 'component;fan;engine;valve;control;light;button;conduit;instrument;sewage;factoryFacilities;flowMeter;industrial;sink;';
  29 + Sidebar.prototype.defaultEntries = 'basicComponent;fan;engine;valve;control;light;button;conduit;instrument;sewage;factoryFacilities;flowMeter;industrial;sink;';
30 30
31 31 /**
32 32 * Library definitions
... ... @@ -373,7 +373,7 @@
373 373 Sidebar.prototype.configuration = [
374 374 { id: 'general', libs: ['general', 'misc', 'advanced'] },
375 375 //加入自定义图形ID
376   - { id: 'fan' }, { id: 'engine' }, { id: 'valve' }, { id: 'component' }, { id: 'control' }, { id: 'sewage' }, { id: 'conduit' }, { id: 'light' }, { id: 'instrument' }, { id: 'button' },
  376 + { id: 'fan' }, { id: 'engine' }, { id: 'valve' }, { id: 'basicComponent' }, { id: 'control' }, { id: 'sewage' }, { id: 'conduit' }, { id: 'light' }, { id: 'instrument' }, { id: 'button' },
377 377 { id: 'air' }, { id: 'filters' }, { id: 'pumps' }, { id: 'factoryFacilities' }, { id: 'flowMeter' }, { id: 'foodProcessing' }, { id: 'heater' }, { id: 'industrial' }, { id: 'plant' }, { id: 'power' }, { id: 'processCooling' }, { id: 'processHeating' }, { id: 'sink' },
378 378
379 379
... ... @@ -744,7 +744,7 @@
744 744 { title: "风机", id: 'fan', image: IMAGE_PATH + '/thingskit/风机.png' },
745 745 { title: "发动机", id: 'engine', image: IMAGE_PATH + '/thingskit/发动机.png' },
746 746 { title: "阀门", id: 'valve', image: IMAGE_PATH + '/thingskit/阀门.png' },
747   - { title: "基础组件", id: 'component', image: IMAGE_PATH + '/thingskit/基础元件.png' },
  747 + { title: "基础组件", id: 'basicComponent', image: IMAGE_PATH + '/thingskit/基础元件.png' },
748 748 { title: "污水处理", id: 'sewage', image: IMAGE_PATH + '/thingskit/污水处理.png' },
749 749 { title: "管道", id: 'conduit', image: IMAGE_PATH + '/thingskit/管道.png' },
750 750 { title: "灯", id: 'light', image: IMAGE_PATH + '/thingskit/灯.png' },
... ...
1 1 (function () {
2 2 // Adds Atlassian shapes
3 3 Sidebar.prototype.addBasicComponentsPalette = function () {
4   - this.setCurrentSearchEntryLibrary('component');
5   - const dt = 'basic'
  4 + this.setCurrentSearchEntryLibrary('basicComponent');
  5 + const dt = 'basicComponent'
6 6 const gn = `mxgraph.${dt}`
7 7 const currentDate = getCurrentDate();
8 8 const basicAttr = this.enumCellBasicAttribute
... ... @@ -46,20 +46,20 @@
46 46 })
47 47 return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '实时时间');
48 48 })),
49   - this.addEntry(this.getTagsForStencil('mxgraph.basic', '变量图片', 'basic').join(' '), mxUtils.bind(this, function () {
  49 + this.addEntry(this.getTagsForStencil(gn, '变量图片', 'basic').join(' '), mxUtils.bind(this, function () {
50 50 const cell = new mxCell('', new mxGeometry(0, 0, 194, 95), 'image;image=images/thingskit/img-placeholder.png;imageAspect=0;');
51 51 cell.setVertex(true)
52 52 this.setCellAttributes(cell, { [basicAttr.COMPONENT_TYPE]: componentType.VAR_IMAGE })
53 53 return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '变量图片');
54 54 })),
55   - this.addEntry(this.getTagsForStencil('mxgraph.basic', '视频', 'basic').join(' '), mxUtils.bind(this, function () {
  55 + this.addEntry(this.getTagsForStencil(gn, '视频', 'basic').join(' '), mxUtils.bind(this, function () {
56 56 const template = createVideoTemplate(300, 150)
57 57 const cell = new mxCell(template, new mxGeometry(0, 0, 300, 150), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;');
58 58 cell.setVertex(true)
59 59 this.setCellAttributes(cell, { [basicAttr.COMPONENT_TYPE]: componentType.VIDEO })
60 60 return this.createVertexTemplateFromCells([cell], cell.geometry.width, cell.geometry.height, '视频');
61 61 })),
62   - this.addEntry(this.getTagsForStencil('mxgraph.basic', '图片', 'basic').join(' '), mxUtils.bind(this, function () {
  62 + this.addEntry(this.getTagsForStencil(gn, '图片', 'basic').join(' '), mxUtils.bind(this, function () {
63 63 const cell = new mxCell(`<img class="basic-component__image" src="${Proxy_Prefix}/images/thingskit/img-placeholder.png" />`, new mxGeometry(0, 0, 190, 190), 'text;html=1;strokeColor=none;fillColor=none;align=center;verticalAlign=middle;whiteSpace=wrap;overflow=hidden;');
64 64 cell.setVertex(true)
65 65 this.setCellAttributes(cell, { [basicAttr.COMPONENT_TYPE]: componentType.IMAGE })
... ... @@ -67,7 +67,7 @@
67 67 })),
68 68 ];
69 69
70   - this.addPaletteFunctions('component', '基础元件', true, fns);
  70 + this.addPaletteFunctions(dt, '基础元件', true, fns);
71 71 this.setCurrentSearchEntryLibrary();
72 72 };
73 73
... ...