Commit 486a83f78b943c1e8e6605429306ec27416f0014

Authored by ww
1 parent e87c8f77

style: format app.js

... ... @@ -11,37 +11,34 @@
11 11 * @param {number} x X-coordinate of the point.
12 12 * @param {number} y Y-coordinate of the point.
13 13 */
14   -App = function(editor, container, lightbox)
15   -{
  14 +App = function (editor, container, lightbox) {
16 15 EditorUi.call(this, editor, container, (lightbox != null) ? lightbox :
17 16 (urlParams['lightbox'] == '1' || (uiTheme == 'min' &&
18   - urlParams['chrome'] != '0')));
  17 + urlParams['chrome'] != '0')));
19 18
20 19 // Logs unloading of window with modifications for Google Drive file
21   - if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp)
22   - {
23   - window.onunload = mxUtils.bind(this, function()
24   - {
  20 + if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp) {
  21 + window.onunload = mxUtils.bind(this, function () {
25 22 var file = this.getCurrentFile();
26 23
27   - if (file != null && file.isModified())
28   - {
29   - var evt = {category: 'DISCARD-FILE-' + file.getHash(),
  24 + if (file != null && file.isModified()) {
  25 + var evt = {
  26 + category: 'DISCARD-FILE-' + file.getHash(),
30 27 action: ((file.savingFile) ? 'saving' : '') +
31   - ((file.savingFile && file.savingFileTime != null) ? '_' +
32   - Math.round((Date.now() - file.savingFileTime.getTime()) / 1000) : '') +
33   - ((file.saveLevel != null) ? ('-sl_' + file.saveLevel) : '') +
34   - '-age_' + ((file.ageStart != null) ? Math.round((Date.now() - file.ageStart.getTime()) / 1000) : 'x') +
35   - ((this.editor.autosave) ? '' : '-nosave') +
36   - ((file.isAutosave()) ? '' : '-noauto') +
37   - '-open_' + ((file.opened != null) ? Math.round((Date.now() - file.opened.getTime()) / 1000) : 'x') +
38   - '-save_' + ((file.lastSaved != null) ? Math.round((Date.now() - file.lastSaved.getTime()) / 1000) : 'x') +
39   - '-change_' + ((file.lastChanged != null) ? Math.round((Date.now() - file.lastChanged.getTime()) / 1000) : 'x') +
40   - '-alive_' + Math.round((Date.now() - App.startTime.getTime()) / 1000),
41   - label: (file.sync != null) ? ('client_' + file.sync.clientId) : 'nosync'};
42   -
43   - if (file.constructor == DriveFile && file.desc != null && this.drive != null)
44   - {
  28 + ((file.savingFile && file.savingFileTime != null) ? '_' +
  29 + Math.round((Date.now() - file.savingFileTime.getTime()) / 1000) : '') +
  30 + ((file.saveLevel != null) ? ('-sl_' + file.saveLevel) : '') +
  31 + '-age_' + ((file.ageStart != null) ? Math.round((Date.now() - file.ageStart.getTime()) / 1000) : 'x') +
  32 + ((this.editor.autosave) ? '' : '-nosave') +
  33 + ((file.isAutosave()) ? '' : '-noauto') +
  34 + '-open_' + ((file.opened != null) ? Math.round((Date.now() - file.opened.getTime()) / 1000) : 'x') +
  35 + '-save_' + ((file.lastSaved != null) ? Math.round((Date.now() - file.lastSaved.getTime()) / 1000) : 'x') +
  36 + '-change_' + ((file.lastChanged != null) ? Math.round((Date.now() - file.lastChanged.getTime()) / 1000) : 'x') +
  37 + '-alive_' + Math.round((Date.now() - App.startTime.getTime()) / 1000),
  38 + label: (file.sync != null) ? ('client_' + file.sync.clientId) : 'nosync'
  39 + };
  40 +
  41 + if (file.constructor == DriveFile && file.desc != null && this.drive != null) {
45 42 evt.label += ((this.drive.user != null) ? ('-user_' + this.drive.user.id) : '-nouser') + '-rev_' +
46 43 file.desc.headRevisionId + '-mod_' + file.desc.modifiedDate + '-size_' + file.getSize() +
47 44 '-mime_' + file.desc.mimeType;
... ... @@ -53,55 +50,47 @@ App = function(editor, container, lightbox)
53 50 }
54 51
55 52 // Logs changes to autosave
56   - this.editor.addListener('autosaveChanged', mxUtils.bind(this, function()
57   - {
  53 + this.editor.addListener('autosaveChanged', mxUtils.bind(this, function () {
58 54 var file = this.getCurrentFile();
59 55
60   - if (file != null)
61   - {
62   - EditorUi.logEvent({category: ((this.editor.autosave) ? 'ON' : 'OFF') +
63   - '-AUTOSAVE-FILE-' + file.getHash(), action: 'changed',
64   - label: 'autosave_' + ((this.editor.autosave) ? 'on' : 'off')});
  56 + if (file != null) {
  57 + EditorUi.logEvent({
  58 + category: ((this.editor.autosave) ? 'ON' : 'OFF') +
  59 + '-AUTOSAVE-FILE-' + file.getHash(), action: 'changed',
  60 + label: 'autosave_' + ((this.editor.autosave) ? 'on' : 'off')
  61 + });
65 62 }
66 63 }));
67 64
68 65 // Pre-fetches images
69   - if (mxClient.IS_SVG)
70   - {
  66 + if (mxClient.IS_SVG) {
71 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=';
72 68 }
73   - else
74   - {
  69 + else {
75 70 var img = new Image();
76 71 img.src = mxGraph.prototype.warningImage.src;
77 72 }
78 73
79 74 // Global helper method to deal with popup blockers
80   - window.openWindow = mxUtils.bind(this, function(url, pre, fallback)
81   - {
82   - if (urlParams['openInSameWin'] == '1' || navigator.standalone)
83   - {
  75 + window.openWindow = mxUtils.bind(this, function (url, pre, fallback) {
  76 + if (urlParams['openInSameWin'] == '1' || navigator.standalone) {
84 77 fallback();
85 78 return;
86 79 }
87 80
88 81 var wnd = null;
89 82
90   - try
91   - {
  83 + try {
92 84 wnd = window.open(url);
93 85 }
94   - catch (e)
95   - {
  86 + catch (e) {
96 87 // ignore
97 88 }
98 89
99   - if (wnd == null || wnd === undefined)
100   - {
  90 + if (wnd == null || wnd === undefined) {
101 91 this.showDialog(new PopupDialog(this, url, pre, fallback).container, 320, 140, true, true);
102 92 }
103   - else if (pre != null)
104   - {
  93 + else if (pre != null) {
105 94 pre();
106 95 }
107 96 });
... ... @@ -111,11 +100,9 @@ App = function(editor, container, lightbox)
111 100 this.updateUi();
112 101
113 102 // Global helper method to display error messages
114   - window.showOpenAlert = mxUtils.bind(this, function(message)
115   - {
  103 + window.showOpenAlert = mxUtils.bind(this, function (message) {
116 104 // Cancel must be called before showing error message
117   - if (window.openFile != null)
118   - {
  105 + if (window.openFile != null) {
119 106 window.openFile.cancel(true);
120 107 }
121 108
... ... @@ -123,54 +110,42 @@ App = function(editor, container, lightbox)
123 110 });
124 111
125 112 // Handles opening files via drag and drop
126   - if (!this.editor.chromeless || this.editor.editable)
127   - {
  113 + if (!this.editor.chromeless || this.editor.editable) {
128 114 this.addFileDropHandler([document]);
129 115 }
130 116
131 117 // Process the queue for waiting plugins
132   - if (App.DrawPlugins != null)
133   - {
134   - for (var i = 0; i < App.DrawPlugins.length; i++)
135   - {
136   - try
137   - {
  118 + if (App.DrawPlugins != null) {
  119 + for (var i = 0; i < App.DrawPlugins.length; i++) {
  120 + try {
138 121 App.DrawPlugins[i](this);
139 122 }
140   - catch (e)
141   - {
142   - if (window.console != null)
143   - {
  123 + catch (e) {
  124 + if (window.console != null) {
144 125 console.log('Plugin Error:', e, App.DrawPlugins[i]);
145 126 }
146 127 }
147   - finally
148   - {
  128 + finally {
149 129 App.embedModePluginsCount--;
150 130 this.initializeEmbedMode();
151 131 }
152 132 }
153 133
154 134 // Installs global callback for plugins
155   - window.Draw.loadPlugin = mxUtils.bind(this, function(callback)
156   - {
157   - try
158   - {
  135 + window.Draw.loadPlugin = mxUtils.bind(this, function (callback) {
  136 + try {
159 137 callback(this);
160 138 }
161   - finally
162   - {
  139 + finally {
163 140 App.embedModePluginsCount--;
164 141 this.initializeEmbedMode();
165 142 }
166 143 });
167 144
168 145 //Set a timeout in case a plugin doesn't load quickly or doesn't load at all
169   - setTimeout(mxUtils.bind(this, function()
170   - {
  146 + setTimeout(mxUtils.bind(this, function () {
171 147 //Force finish loading if its not yet called
172   - if (App.embedModePluginsCount > 0)
173   - {
  148 + if (App.embedModePluginsCount > 0) {
174 149 App.embedModePluginsCount = 0;
175 150 this.initializeEmbedMode();
176 151 }
... ... @@ -253,7 +228,7 @@ App.DROPBOX_APPKEY = window.DRAWIO_DROPBOX_ID;
253 228 /**
254 229 * Sets URL to load the Dropbox SDK from
255 230 */
256   -App.DROPBOX_URL = window.DRAWIO_BASE_URL + Proxy_Prefix + '/js/dropbox/Dropbox-sdk.min.js';
  231 +App.DROPBOX_URL = window.DRAWIO_BASE_URL + Proxy_Prefix + '/js/dropbox/Dropbox-sdk.min.js';
257 232
258 233 /**
259 234 * Sets URL to load the Dropbox dropins JS from.
... ... @@ -266,7 +241,7 @@ App.DROPINS_URL = '';
266 241 * OneDrive Client JS (file/folder picker). This is a slightly modified version to allow using accessTokens
267 242 * But it doesn't work for IE11, so we fallback to the original one
268 243 */
269   -App.ONEDRIVE_URL = mxClient.IS_IE11? 'https://js.live.net/v7.2/OneDrive.js' : window.DRAWIO_BASE_URL + Proxy_Prefix + '/js/onedrive/OneDrive.js';
  244 +App.ONEDRIVE_URL = mxClient.IS_IE11 ? 'https://js.live.net/v7.2/OneDrive.js' : window.DRAWIO_BASE_URL + Proxy_Prefix + '/js/onedrive/OneDrive.js';
270 245
271 246 /**
272 247 * Trello URL
... ... @@ -296,7 +271,7 @@ App.PUSHER_URL = 'https://js.pusher.com/7.0.3/pusher.min.js';
296 271 /**
297 272 * SimplePeer library
298 273 */
299   - App.SIMPLE_PEER_URL = window.DRAWIO_BASE_URL + '/js/simplepeer/simplepeer9.10.0.min.js';
  274 +App.SIMPLE_PEER_URL = window.DRAWIO_BASE_URL + '/js/simplepeer/simplepeer9.10.0.min.js';
300 275
301 276 /**
302 277 * Google APIs to load. The realtime API is needed to notify collaborators of conversion
... ... @@ -315,7 +290,8 @@ App.startTime = new Date();
315 290 * Defines plugin IDs for loading via p URL parameter. Update the table at
316 291 * https://www.diagrams.net/doc/faq/supported-url-parameters
317 292 */
318   -App.pluginRegistry = {'4xAKTrabTpTzahoLthkwPNUn': 'plugins/explore.js',
  293 +App.pluginRegistry = {
  294 + '4xAKTrabTpTzahoLthkwPNUn': 'plugins/explore.js',
319 295 'ex': 'plugins/explore.js', 'p1': 'plugins/p1.js',
320 296 'ac': 'plugins/connect.js', 'acj': 'plugins/connectJira.js',
321 297 'ac148': 'plugins/cConf-1-4-8.js', 'ac148cmnt': 'plugins/cConf-comments.js',
... ... @@ -331,7 +307,8 @@ App.pluginRegistry = {'4xAKTrabTpTzahoLthkwPNUn': 'plugins/explore.js',
331 307 'tickets': 'plugins/tickets.js', 'flow': 'plugins/flow.js',
332 308 'webcola': 'plugins/webcola/webcola.js', 'rnd': 'plugins/random.js',
333 309 'page': 'plugins/page.js', 'gd': 'plugins/googledrive.js',
334   - 'tags': 'plugins/tags.js'};
  310 + 'tags': 'plugins/tags.js'
  311 +};
335 312
336 313 App.publicPlugin = [
337 314 'ex',
... ... @@ -345,13 +322,13 @@ App.publicPlugin = [
345 322 'anim',
346 323 'update',
347 324 'trees',
348   -// 'import',
  325 + // 'import',
349 326 'replay',
350 327 'anon',
351 328 'tickets',
352 329 'flow',
353 330 'webcola',
354   -// 'rnd', 'page', 'gd',
  331 + // 'rnd', 'page', 'gd',
355 332 'tags'
356 333 ];
357 334
... ... @@ -359,16 +336,12 @@ App.publicPlugin = [
359 336 * Loads all given scripts and invokes onload after
360 337 * all scripts have finished loading.
361 338 */
362   -App.loadScripts = function(scripts, onload)
363   -{
  339 +App.loadScripts = function (scripts, onload) {
364 340 var n = scripts.length;
365 341
366   - for (var i = 0; i < scripts.length; i++)
367   - {
368   - mxscript(scripts[i], function()
369   - {
370   - if (--n == 0 && onload != null)
371   - {
  342 + for (var i = 0; i < scripts.length; i++) {
  343 + mxscript(scripts[i], function () {
  344 + if (--n == 0 && onload != null) {
372 345 onload();
373 346 }
374 347 });
... ... @@ -380,33 +353,27 @@ App.loadScripts = function(scripts, onload)
380 353 *
381 354 * Returns the current mode.
382 355 */
383   -App.getStoredMode = function()
384   -{
  356 +App.getStoredMode = function () {
385 357 var mode = null;
386 358
387   - if (mode == null && isLocalStorage)
388   - {
  359 + if (mode == null && isLocalStorage) {
389 360 mode = localStorage.getItem('.mode');
390 361 }
391 362
392   - if (mode == null && typeof(Storage) != 'undefined')
393   - {
  363 + if (mode == null && typeof (Storage) != 'undefined') {
394 364 var cookies = document.cookie.split(";");
395 365
396   - for (var i = 0; i < cookies.length; i++)
397   - {
  366 + for (var i = 0; i < cookies.length; i++) {
398 367 // Removes spaces around cookie
399 368 var cookie = mxUtils.trim(cookies[i]);
400 369
401   - if (cookie.substring(0, 5) == 'MODE=')
402   - {
  370 + if (cookie.substring(0, 5) == 'MODE=') {
403 371 mode = cookie.substring(5);
404 372 break;
405 373 }
406 374 }
407 375
408   - if (mode != null && isLocalStorage)
409   - {
  376 + if (mode != null && isLocalStorage) {
410 377 // Moves to local storage
411 378 var expiry = new Date();
412 379 expiry.setYear(expiry.getFullYear() - 1);
... ... @@ -421,23 +388,18 @@ App.getStoredMode = function()
421 388 /**
422 389 * Static Application initializer executed at load-time.
423 390 */
424   -(function()
425   -{
426   - if (!mxClient.IS_CHROMEAPP)
427   - {
428   - if (urlParams['offline'] != '1')
429   - {
  391 +(function () {
  392 + if (!mxClient.IS_CHROMEAPP) {
  393 + if (urlParams['offline'] != '1') {
430 394 // Switches to dropbox mode for db.draw.io
431   - if (window.location.hostname == 'db.draw.io' && urlParams['mode'] == null)
432   - {
  395 + if (window.location.hostname == 'db.draw.io' && urlParams['mode'] == null) {
433 396 urlParams['mode'] = 'dropbox';
434 397 }
435 398
436 399 App.mode = urlParams['mode'];
437 400 }
438 401
439   - if (App.mode == null)
440   - {
  402 + if (App.mode == null) {
441 403 // Stored mode overrides preferred mode
442 404 App.mode = App.getStoredMode();
443 405 }
... ... @@ -445,33 +407,26 @@ App.getStoredMode = function()
445 407 /**
446 408 * Lazy loading backends.
447 409 */
448   - if (window.mxscript != null)
449   - {
  410 + if (window.mxscript != null) {
450 411 // Loads gapi for all browsers but IE8 and below if not disabled or if enabled and in embed mode
451   - if (urlParams['embed'] != '1')
452   - {
453   - if (typeof window.DriveClient === 'function')
454   - {
  412 + if (urlParams['embed'] != '1') {
  413 + if (typeof window.DriveClient === 'function') {
455 414 if (urlParams['gapi'] != '0' && isSvgBrowser &&
456   - (document.documentMode == null || document.documentMode >= 10))
457   - {
  415 + (document.documentMode == null || document.documentMode >= 10)) {
458 416 // Immediately loads client
459 417 if (App.mode == App.MODE_GOOGLE || (urlParams['state'] != null &&
460 418 window.location.hash == '') || (window.location.hash != null &&
461   - window.location.hash.substring(0, 2) == '#G'))
462   - {
  419 + window.location.hash.substring(0, 2) == '#G')) {
463 420 mxscript('https://apis.google.com/js/api.js');
464 421 }
465 422 // Keeps lazy loading for fallback to authenticated Google file if not public in loadFile
466 423 else if (urlParams['chrome'] == '0' && (window.location.hash == null ||
467   - window.location.hash.substring(0, 45) !== '#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D'))
468   - {
  424 + window.location.hash.substring(0, 45) !== '#Uhttps%3A%2F%2Fdrive.google.com%2Fuc%3Fid%3D')) {
469 425 // Disables loading of client
470 426 window.DriveClient = null;
471 427 }
472 428 }
473   - else
474   - {
  429 + else {
475 430 // Disables loading of client
476 431 window.DriveClient = null;
477 432 }
... ... @@ -479,80 +434,63 @@ App.getStoredMode = function()
479 434
480 435 // Loads dropbox for all browsers but IE8 and below (no CORS) if not disabled or if enabled and in embed mode
481 436 // KNOWN: Picker does not work in IE11 (https://dropbox.zendesk.com/requests/1650781)
482   - if (typeof window.DropboxClient === 'function')
483   - {
  437 + if (typeof window.DropboxClient === 'function') {
484 438 if (urlParams['db'] != '0' && isSvgBrowser &&
485   - (document.documentMode == null || document.documentMode > 9))
486   - {
  439 + (document.documentMode == null || document.documentMode > 9)) {
487 440 // Immediately loads client
488 441 if (App.mode == App.MODE_DROPBOX || (window.location.hash != null &&
489   - window.location.hash.substring(0, 2) == '#D'))
490   - {
491   - mxscript(App.DROPBOX_URL, function()
492   - {
  442 + window.location.hash.substring(0, 2) == '#D')) {
  443 + mxscript(App.DROPBOX_URL, function () {
493 444 // Must load this after the dropbox SDK since they use the same namespace
494 445 mxscript(App.DROPINS_URL, null, 'dropboxjs', App.DROPBOX_APPKEY, true);
495 446 });
496 447 }
497   - else if (urlParams['chrome'] == '0')
498   - {
  448 + else if (urlParams['chrome'] == '0') {
499 449 window.DropboxClient = null;
500 450 }
501 451 }
502   - else
503   - {
  452 + else {
504 453 // Disables loading of client
505 454 window.DropboxClient = null;
506 455 }
507 456 }
508 457
509 458 // Loads OneDrive for all browsers but IE6/IOS if not disabled or if enabled and in embed mode
510   - if (typeof window.OneDriveClient === 'function')
511   - {
  459 + if (typeof window.OneDriveClient === 'function') {
512 460 if (urlParams['od'] != '0' && (navigator.userAgent == null ||
513   - navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10))
514   - {
  461 + navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10)) {
515 462 // Immediately loads client
516 463 if (App.mode == App.MODE_ONEDRIVE || (window.location.hash != null &&
517   - window.location.hash.substring(0, 2) == '#W'))
518   - {
  464 + window.location.hash.substring(0, 2) == '#W')) {
519 465 //Editor.oneDriveInlinePicker can be set with configuration which is done later, so load it all time
520 466 mxscript(App.ONEDRIVE_URL);
521 467 }
522   - else if (urlParams['chrome'] == '0')
523   - {
  468 + else if (urlParams['chrome'] == '0') {
524 469 window.OneDriveClient = null;
525 470 }
526 471 }
527   - else
528   - {
  472 + else {
529 473 // Disables loading of client
530 474 window.OneDriveClient = null;
531 475 }
532 476 }
533 477
534 478 // Loads Trello for all browsers but < IE10 if not disabled or if enabled and in embed mode
535   - if (typeof window.TrelloClient === 'function')
536   - {
  479 + if (typeof window.TrelloClient === 'function') {
537 480 if (urlParams['tr'] == '1' && isSvgBrowser && !mxClient.IS_IE11 &&
538   - (document.documentMode == null || document.documentMode >= 10))
539   - {
  481 + (document.documentMode == null || document.documentMode >= 10)) {
540 482 // Immediately loads client
541 483 if (App.mode == App.MODE_TRELLO || (window.location.hash != null &&
542   - window.location.hash.substring(0, 2) == '#T'))
543   - {
544   - mxscript(App.TRELLO_JQUERY_URL, function()
545   - {
  484 + window.location.hash.substring(0, 2) == '#T')) {
  485 + mxscript(App.TRELLO_JQUERY_URL, function () {
546 486 mxscript(App.TRELLO_URL);
547 487 });
548 488 }
549   - else if (urlParams['chrome'] == '0')
550   - {
  489 + else if (urlParams['chrome'] == '0') {
551 490 window.TrelloClient = null;
552 491 }
553 492 }
554   - else
555   - {
  493 + else {
556 494 // Disables loading of client
557 495 window.TrelloClient = null;
558 496 }
... ... @@ -565,19 +503,14 @@ App.getStoredMode = function()
565 503 /**
566 504 * Clears the PWA cache.
567 505 */
568   -App.clearServiceWorker = function(success)
569   -{
570   - navigator.serviceWorker.getRegistrations().then(function(registrations)
571   - {
572   - if (registrations != null && registrations.length > 0)
573   - {
574   - for (var i = 0; i < registrations.length; i++)
575   - {
  506 +App.clearServiceWorker = function (success) {
  507 + navigator.serviceWorker.getRegistrations().then(function (registrations) {
  508 + if (registrations != null && registrations.length > 0) {
  509 + for (var i = 0; i < registrations.length; i++) {
576 510 registrations[i].unregister();
577 511 }
578 512
579   - if (success != null)
580   - {
  513 + if (success != null) {
581 514 success();
582 515 }
583 516 }
... ... @@ -590,19 +523,17 @@ App.clearServiceWorker = function(success)
590 523 * Optional callback is called with the app instance.
591 524 */
592 525 let defHttp;
593   -App.main = function(callback, createUi)
594   -{
  526 +App.main = function (callback, createUi) {
595 527
596 528 Editor.configurationId = urlParams.configurationId;
597 529 const localStorageInfo = localStorage.getItem(GLOBAL_STORAGE_KEY);
598 530 // 应用启动入口时创建一个axios实例,供全局使用
599 531 defHttp = createAxios({
600   - timeout:10*1000,
601   - baseURL:'/api',
  532 + timeout: 10 * 1000,
  533 + baseURL: '/api',
602 534 })
603 535 // Logs uncaught errors
604   - window.onerror = function(message, url, linenumber, colno, err)
605   - {
  536 + window.onerror = function (message, url, linenumber, colno, err) {
606 537 EditorUi.logError('Global: ' + ((message != null) ? message : ''),
607 538 url, linenumber, colno, err, null, true);
608 539 };
... ... @@ -610,9 +541,8 @@ App.main = function(callback, createUi)
610 541 // Blocks stand-alone mode for certain subdomains
611 542 if (window.top == window.self &&
612 543 (/ac\.draw\.io$/.test(window.location.hostname) ||
613   - /ac-ent\.draw\.io$/.test(window.location.hostname) ||
614   - /aj\.draw\.io$/.test(window.location.hostname)))
615   - {
  544 + /ac-ent\.draw\.io$/.test(window.location.hostname) ||
  545 + /aj\.draw\.io$/.test(window.location.hostname))) {
616 546 document.body.innerHTML = '<div style="margin-top:10%;text-align:center;">Stand-alone mode not allowed for this domain.</div>';
617 547
618 548 return;
... ... @@ -632,71 +562,57 @@ App.main = function(callback, createUi)
632 562
633 563 // Redirects to the latest AWS icons
634 564 if (document.referrer != null && urlParams['libs'] == 'aws3' &&
635   - document.referrer.substring(0, 42) == 'https://aws.amazon.com/architecture/icons/')
636   - {
  565 + document.referrer.substring(0, 42) == 'https://aws.amazon.com/architecture/icons/') {
637 566 urlParams['libs'] = 'aws4';
638 567 }
639 568
640   - if (window.mxscript != null)
641   - {
  569 + if (window.mxscript != null) {
642 570 // Checks for script content changes to avoid CSP errors in production
643 571 if (urlParams['dev'] == '1' && !mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp &&
644   - CryptoJS != null && App.mode != App.MODE_DROPBOX && App.mode != App.MODE_TRELLO)
645   - {
  572 + CryptoJS != null && App.mode != App.MODE_DROPBOX && App.mode != App.MODE_TRELLO) {
646 573 var scripts = document.getElementsByTagName('script');
647 574
648 575 // Checks bootstrap script
649   - if (scripts != null && scripts.length > 0)
650   - {
  576 + if (scripts != null && scripts.length > 0) {
651 577 var content = mxUtils.getTextContent(scripts[0]);
652 578
653 579 //开发模式下检查MD5脚本
654   - if (CryptoJS.MD5(content).toString() != 'd41d8cd98f00b204e9800998ecf8427e')
655   - {
  580 + if (CryptoJS.MD5(content).toString() != 'd41d8cd98f00b204e9800998ecf8427e') {
656 581 console.log('Change bootstrap script MD5 in the previous line:', CryptoJS.MD5(content).toString());
657 582 alert('[Dev] Bootstrap script change requires update of CSP');
658 583 }
659 584 }
660 585
661 586 // Checks main script
662   - if (scripts != null && scripts.length > 1)
663   - {
  587 + if (scripts != null && scripts.length > 1) {
664 588 var content = mxUtils.getTextContent(scripts[scripts.length - 1]);
665 589
666 590 // if (CryptoJS.MD5(content).toString() != 'd53805dd6f0bbba2da4966491ca0a505')
667   - if (CryptoJS.MD5(content).toString() != 'c4cfc8a77f5990a4d86c0fbc4443328b')
668   - {
  591 + if (CryptoJS.MD5(content).toString() != 'c4cfc8a77f5990a4d86c0fbc4443328b') {
669 592 console.log('Change main script MD5 in the previous line:', CryptoJS.MD5(content).toString());
670 593 alert('[Dev] Main script change requires update of CSP');
671 594 }
672 595 }
673 596 }
674 597
675   - try
676   - {
  598 + try {
677 599 // Removes PWA cache on www.draw.io to force use of new domain via redirect
678 600 if (Editor.enableServiceWorker && (urlParams['offline'] == '0' ||
679 601 /www\.draw\.io$/.test(window.location.hostname) ||
680   - (urlParams['offline'] != '1' && urlParams['dev'] == '1')))
681   - {
682   - App.clearServiceWorker(function()
683   - {
684   - if (urlParams['offline'] == '0')
685   - {
  602 + (urlParams['offline'] != '1' && urlParams['dev'] == '1'))) {
  603 + App.clearServiceWorker(function () {
  604 + if (urlParams['offline'] == '0') {
686 605 alert('Cache cleared');
687 606 }
688 607 });
689 608 }
690   - else if (Editor.enableServiceWorker)
691   - {
  609 + else if (Editor.enableServiceWorker) {
692 610 // Runs as progressive web app if service workers are supported
693 611 navigator.serviceWorker.register('/service-worker.js');
694 612 }
695 613 }
696   - catch (e)
697   - {
698   - if (window.console != null)
699   - {
  614 + catch (e) {
  615 + if (window.console != null) {
700 616 console.error(e);
701 617 }
702 618 }
... ... @@ -704,41 +620,34 @@ App.main = function(callback, createUi)
704 620 // Loads Pusher API
705 621 if (('ArrayBuffer' in window) && !mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp &&
706 622 DrawioFile.SYNC == 'auto' && (urlParams['embed'] != '1' ||
707   - urlParams['embedRT'] == '1') && urlParams['local'] != '1' &&
  623 + urlParams['embedRT'] == '1') && urlParams['local'] != '1' &&
708 624 (urlParams['chrome'] != '0' || urlParams['rt'] == '1') &&
709   - urlParams['stealth'] != '1' && urlParams['offline'] != '1')
710   - {
  625 + urlParams['stealth'] != '1' && urlParams['offline'] != '1') {
711 626 // TODO: Check if async loading is fast enough
712 627 mxscript(App.PUSHER_URL);
713 628
714   - if (urlParams['fast-sync'] == '1')
715   - {
  629 + if (urlParams['fast-sync'] == '1') {
716 630 mxscript(App.SIMPLE_PEER_URL);
717 631 }
718 632 }
719 633
720 634 // Loads plugins
721   - if (urlParams['plugins'] != '0' && urlParams['offline'] != '1')
722   - {
  635 + if (urlParams['plugins'] != '0' && urlParams['offline'] != '1') {
723 636 // mxSettings is not yet initialized in configure mode, redirect parameter
724 637 // to p URL parameter in caller for plugins in embed mode
725 638 var plugins = (mxSettings.settings != null) ? mxSettings.getPlugins() : null;
726 639
727 640 // Configured plugins in embed mode with configure=1 URL should be loaded so we
728 641 // look ahead here and parse the config to fetch the list of custom plugins
729   - if (mxSettings.settings == null && isLocalStorage && typeof(JSON) !== 'undefined')
730   - {
731   - try
732   - {
  642 + if (mxSettings.settings == null && isLocalStorage && typeof (JSON) !== 'undefined') {
  643 + try {
733 644 var temp = JSON.parse(localStorage.getItem(mxSettings.key));
734 645
735   - if (temp != null)
736   - {
  646 + if (temp != null) {
737 647 plugins = temp.plugins;
738 648 }
739 649 }
740   - catch (e)
741   - {
  650 + catch (e) {
742 651 // ignore
743 652 }
744 653 }
... ... @@ -746,49 +655,39 @@ App.main = function(callback, createUi)
746 655 var temp = urlParams['p'];
747 656 App.initPluginCallback();
748 657
749   - if (temp != null)
750   - {
  658 + if (temp != null) {
751 659 // Mapping from key to URL in App.plugins
752 660 App.loadPlugins(temp.split(';'));
753 661 }
754 662
755   - if (plugins != null && plugins.length > 0 && urlParams['plugins'] != '0')
756   - {
  663 + if (plugins != null && plugins.length > 0 && urlParams['plugins'] != '0') {
757 664 // Loading plugins inside the asynchronous block below stops the page from loading so a
758 665 // hardcoded message for the warning dialog is used since the resources are loadd below
759 666 var warning = 'The page has requested to load the following plugin(s):\n \n {1}\n \n Would you like to load these plugin(s) now?\n \n NOTE : Only allow plugins to run if you fully understand the security implications of doing so.\n';
760 667 var tmp = window.location.protocol + '//' + window.location.host;
761 668 var local = true;
762 669
763   - for (var i = 0; i < plugins.length && local; i++)
764   - {
765   - if (plugins[i].charAt(0) != '/' && plugins[i].substring(0, tmp.length) != tmp)
766   - {
  670 + for (var i = 0; i < plugins.length && local; i++) {
  671 + if (plugins[i].charAt(0) != '/' && plugins[i].substring(0, tmp.length) != tmp) {
767 672 local = false;
768 673 }
769 674 }
770 675
771   - if (local || mxUtils.confirm(mxResources.replacePlaceholders(warning, [plugins.join('\n')]).replace(/\\n/g, '\n')))
772   - {
773   - for (var i = 0; i < plugins.length; i++)
774   - {
775   - try
776   - {
777   - if (App.pluginsLoaded[plugins[i]] == null)
778   - {
  676 + if (local || mxUtils.confirm(mxResources.replacePlaceholders(warning, [plugins.join('\n')]).replace(/\\n/g, '\n'))) {
  677 + for (var i = 0; i < plugins.length; i++) {
  678 + try {
  679 + if (App.pluginsLoaded[plugins[i]] == null) {
779 680 App.pluginsLoaded[plugins[i]] = true;
780 681 App.embedModePluginsCount++;
781 682
782   - if (plugins[i].charAt(0) == '/')
783   - {
  683 + if (plugins[i].charAt(0) == '/') {
784 684 plugins[i] = PLUGINS_BASE_PATH + plugins[i];
785 685 }
786 686
787 687 mxscript(plugins[i]);
788 688 }
789 689 }
790   - catch (e)
791   - {
  690 + catch (e) {
792 691 // ignore
793 692 }
794 693 }
... ... @@ -800,14 +699,12 @@ App.main = function(callback, createUi)
800 699 // Special case: Cannot load in asynchronous code below
801 700 if (typeof window.DriveClient === 'function' &&
802 701 (typeof gapi === 'undefined' && (((urlParams['embed'] != '1' && urlParams['gapi'] != '0') ||
803   - (urlParams['embed'] == '1' && urlParams['gapi'] == '1')) && isSvgBrowser &&
804   - isLocalStorage && (document.documentMode == null || document.documentMode >= 10))))
805   - {
  702 + (urlParams['embed'] == '1' && urlParams['gapi'] == '1')) && isSvgBrowser &&
  703 + isLocalStorage && (document.documentMode == null || document.documentMode >= 10)))) {
806 704 mxscript('https://apis.google.com/js/api.js?onload=DrawGapiClientCallback', null, null, null, mxClient.IS_SVG);
807 705 }
808 706 // Disables client
809   - else if (typeof window.gapi === 'undefined')
810   - {
  707 + else if (typeof window.gapi === 'undefined') {
811 708 window.DriveClient = null;
812 709 }
813 710 }
... ... @@ -815,44 +712,34 @@ App.main = function(callback, createUi)
815 712 /**
816 713 * Asynchronous MathJax extension.
817 714 */
818   - if (urlParams['math'] != '0')
819   - {
  715 + if (urlParams['math'] != '0') {
820 716 Editor.initMath();
821 717 }
822 718
823   - function doLoad(bundle)
824   - {
  719 + function doLoad(bundle) {
825 720 // Prefetches asynchronous requests so that below code runs synchronous
826 721 // Loading the correct bundle (one file) via the fallback system in mxResources. The stylesheet
827 722 // is compiled into JS in the build process and is only needed for local development.
828 723 mxUtils.getAll((urlParams['dev'] != '1') ? [bundle] : [bundle,
829   - STYLE_PATH + '/default.xml'], function(xhr)
830   - {
  724 + STYLE_PATH + '/default.xml'], function (xhr) {
831 725 // Adds bundle text to resources
832 726 mxResources.parse(xhr[0].getText());
833 727
834 728 // Configuration mode
835 729 if (isLocalStorage && localStorage != null && window.location.hash != null &&
836   - window.location.hash.substring(0, 9) == '#_CONFIG_')
837   - {
838   - try
839   - {
  730 + window.location.hash.substring(0, 9) == '#_CONFIG_') {
  731 + try {
840 732 var trustedPlugins = {};
841 733
842   - for (var key in App.pluginRegistry)
843   - {
  734 + for (var key in App.pluginRegistry) {
844 735 trustedPlugins[App.pluginRegistry[key]] = true;
845 736 }
846 737
847 738 // Only allows trusted plugins
848   - function checkPlugins(plugins)
849   - {
850   - if (plugins != null)
851   - {
852   - for (var i = 0; i < plugins.length; i++)
853   - {
854   - if (!trustedPlugins[plugins[i]])
855   - {
  739 + function checkPlugins(plugins) {
  740 + if (plugins != null) {
  741 + for (var i = 0; i < plugins.length; i++) {
  742 + if (!trustedPlugins[plugins[i]]) {
856 743 throw new Error(mxResources.get('invalidInput') + ' "' + plugins[i]) + '"';
857 744 }
858 745 }
... ... @@ -863,43 +750,35 @@ App.main = function(callback, createUi)
863 750
864 751 var value = JSON.parse(Graph.decompress(window.location.hash.substring(9)));
865 752
866   - if (value != null && checkPlugins(value.plugins))
867   - {
  753 + if (value != null && checkPlugins(value.plugins)) {
868 754 EditorUi.debug('Setting configuration', JSON.stringify(value));
869 755
870   - if (value.merge != null)
871   - {
  756 + if (value.merge != null) {
872 757 var temp = localStorage.getItem(Editor.configurationKey);
873 758
874   - if (temp != null)
875   - {
  759 + if (temp != null) {
876 760
877   - try
878   - {
  761 + try {
879 762 var config = JSON.parse(temp);
880 763
881   - for (var key in value.merge)
882   - {
  764 + for (var key in value.merge) {
883 765 config[key] = value.merge[key];
884 766 }
885 767
886 768 value = config;
887 769 }
888   - catch (e)
889   - {
  770 + catch (e) {
890 771 window.location.hash = '';
891 772 alert(e);
892 773 }
893 774 }
894   - else
895   - {
  775 + else {
896 776 value = value.merge;
897 777 }
898 778 }
899 779
900 780 if (confirm(mxResources.get('configLinkWarn')) &&
901   - confirm(mxResources.get('configLinkConfirm')))
902   - {
  781 + confirm(mxResources.get('configLinkConfirm'))) {
903 782 localStorage.setItem(Editor.configurationKey, JSON.stringify(value));
904 783 window.location.hash = '';
905 784 window.location.reload();
... ... @@ -908,65 +787,55 @@ App.main = function(callback, createUi)
908 787
909 788 window.location.hash = '';
910 789 }
911   - catch (e)
912   - {
  790 + catch (e) {
913 791 window.location.hash = '';
914 792 alert(e);
915 793 }
916 794 }
917 795
918 796 // Prepares themes with mapping from old default-style to old XML file
919   - if (xhr.length > 1)
920   - {
  797 + if (xhr.length > 1) {
921 798 Graph.prototype.defaultThemes['default-style2'] = xhr[1].getDocumentElement();
922   - Graph.prototype.defaultThemes['darkTheme'] = xhr[1].getDocumentElement();
  799 + Graph.prototype.defaultThemes['darkTheme'] = xhr[1].getDocumentElement();
923 800 }
924 801
925 802 // Main
926   - function realMain()
927   - {
  803 + function realMain() {
928 804 var ui = (createUi != null) ? createUi() : new App(new Editor(
929   - urlParams['chrome'] == '0' || uiTheme == 'min',
930   - null, null, null, urlParams['chrome'] != '0'));
  805 + urlParams['chrome'] == '0' || uiTheme == 'min',
  806 + null, null, null, urlParams['chrome'] != '0'));
931 807
932   - if (window.mxscript != null)
933   - {
  808 + if (window.mxscript != null) {
934 809 // Loads dropbox for all browsers but IE8 and below (no CORS) if not disabled or if enabled and in embed mode
935 810 // KNOWN: Picker does not work in IE11 (https://dropbox.zendesk.com/requests/1650781)
936 811 if (typeof window.DropboxClient === 'function' &&
937 812 (window.Dropbox == null && window.DrawDropboxClientCallback != null &&
938   - (((urlParams['embed'] != '1' && urlParams['db'] != '0') ||
939   - (urlParams['embed'] == '1' && urlParams['db'] == '1')) &&
940   - isSvgBrowser && (document.documentMode == null || document.documentMode > 9))))
941   - {
942   - mxscript(App.DROPBOX_URL, function()
943   - {
  813 + (((urlParams['embed'] != '1' && urlParams['db'] != '0') ||
  814 + (urlParams['embed'] == '1' && urlParams['db'] == '1')) &&
  815 + isSvgBrowser && (document.documentMode == null || document.documentMode > 9)))) {
  816 + mxscript(App.DROPBOX_URL, function () {
944 817 // Must load this after the dropbox SDK since they use the same namespace
945   - mxscript(App.DROPINS_URL, function()
946   - {
  818 + mxscript(App.DROPINS_URL, function () {
947 819 DrawDropboxClientCallback();
948 820 }, 'dropboxjs', App.DROPBOX_APPKEY);
949 821 });
950 822 }
951 823 // Disables client
952   - else if (typeof window.Dropbox === 'undefined' || typeof window.Dropbox.choose === 'undefined')
953   - {
  824 + else if (typeof window.Dropbox === 'undefined' || typeof window.Dropbox.choose === 'undefined') {
954 825 window.DropboxClient = null;
955 826 }
956 827
957 828 // Loads OneDrive for all browsers but IE6/IOS if not disabled or if enabled and in embed mode
958 829 if (typeof window.OneDriveClient === 'function' &&
959 830 (typeof OneDrive === 'undefined' && window.DrawOneDriveClientCallback != null &&
960   - (((urlParams['embed'] != '1' && urlParams['od'] != '0') || (urlParams['embed'] == '1' &&
961   - urlParams['od'] == '1')) && (navigator.userAgent == null ||
962   - navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10))))
963   - {
  831 + (((urlParams['embed'] != '1' && urlParams['od'] != '0') || (urlParams['embed'] == '1' &&
  832 + urlParams['od'] == '1')) && (navigator.userAgent == null ||
  833 + navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10)))) {
964 834 //Editor.oneDriveInlinePicker can be set with configuration which is done later, so load it all time
965 835 mxscript(App.ONEDRIVE_URL, window.DrawOneDriveClientCallback);
966 836 }
967 837 // Disables client
968   - else if (typeof window.OneDrive === 'undefined')
969   - {
  838 + else if (typeof window.OneDrive === 'undefined') {
970 839 window.OneDriveClient = null;
971 840 }
972 841
... ... @@ -974,39 +843,32 @@ App.main = function(callback, createUi)
974 843 if (typeof window.TrelloClient === 'function' && !mxClient.IS_IE11 &&
975 844 typeof window.Trello === 'undefined' && window.DrawTrelloClientCallback != null &&
976 845 urlParams['tr'] == '1' && (navigator.userAgent == null ||
977   - navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10))
978   - {
979   - mxscript(App.TRELLO_JQUERY_URL, function()
980   - {
  846 + navigator.userAgent.indexOf('MSIE') < 0 || document.documentMode >= 10)) {
  847 + mxscript(App.TRELLO_JQUERY_URL, function () {
981 848 // Must load this after the dropbox SDK since they use the same namespace
982   - mxscript(App.TRELLO_URL, function()
983   - {
  849 + mxscript(App.TRELLO_URL, function () {
984 850 DrawTrelloClientCallback();
985 851 });
986 852 });
987 853 }
988 854 // Disables client
989   - else if (typeof window.Trello === 'undefined')
990   - {
  855 + else if (typeof window.Trello === 'undefined') {
991 856 window.TrelloClient = null;
992 857 }
993 858
994 859 }
995 860
996   - if (callback != null)
997   - {
  861 + if (callback != null) {
998 862 callback(ui);
999 863 }
1000 864
1001 865 /**
1002 866 * For developers only
1003 867 */
1004   - if (urlParams['chrome'] != '0' && urlParams['test'] == '1')
1005   - {
  868 + if (urlParams['chrome'] != '0' && urlParams['test'] == '1') {
1006 869 EditorUi.debug('App.start', [ui, (new Date().getTime() - t0.getTime()) + 'ms']);
1007 870
1008   - if (urlParams['export'] != null)
1009   - {
  871 + if (urlParams['export'] != null) {
1010 872 EditorUi.debug('Export:', EXPORT_URL);
1011 873 }
1012 874 }
... ... @@ -1016,8 +878,7 @@ App.main = function(callback, createUi)
1016 878 {
1017 879 realMain();
1018 880 }
1019   - else
1020   - {
  881 + else {
1021 882 mxStencilRegistry.allowEval = false;
1022 883 let loadScriptList = [
1023 884 'js/shapes-14-6-5.min.js',
... ... @@ -1036,85 +897,68 @@ App.main = function(callback, createUi)
1036 897 // const extensionsMinSrc = 'js/extensions.min.js'
1037 898 App.loadScripts(loadScriptList, realMain);
1038 899 }
1039   - }, function(xhr)
1040   - {
  900 + }, function (xhr) {
1041 901 var st = document.getElementById('geStatus');
1042 902
1043   - if (st != null)
1044   - {
  903 + if (st != null) {
1045 904 st.innerHTML = 'Error loading page. <a>Please try refreshing.</a>';
1046 905
1047 906 // Tries reload with default resources in case any language resources were not available
1048   - st.getElementsByTagName('a')[0].onclick = function()
1049   - {
  907 + st.getElementsByTagName('a')[0].onclick = function () {
1050 908 mxLanguage = 'en';
1051 909 doLoad(mxResources.getDefaultBundle(RESOURCE_BASE, mxLanguage) ||
1052   - mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage));
  910 + mxResources.getSpecialBundle(RESOURCE_BASE, mxLanguage));
1053 911 };
1054 912 }
1055 913 });
1056 914 };
1057 915
1058   - function doMain()
1059   - {
  916 + function doMain() {
1060 917 // Optional override for autosaveDelay and defaultEdgeLength
1061   - try
1062   - {
1063   - if (mxSettings.settings != null)
1064   - {
  918 + try {
  919 + if (mxSettings.settings != null) {
1065 920 document.body.style.backgroundColor = (uiTheme == 'dark' ||
1066 921 mxSettings.settings.darkMode) ? Editor.darkColor : '#ffffff';
1067 922
1068   - if (mxSettings.settings.autosaveDelay != null)
1069   - {
  923 + if (mxSettings.settings.autosaveDelay != null) {
1070 924 var val = parseInt(mxSettings.settings.autosaveDelay);
1071 925
1072   - if (!isNaN(val) && val > 0)
1073   - {
  926 + if (!isNaN(val) && val > 0) {
1074 927 DrawioFile.prototype.autosaveDelay = val;
1075 928 EditorUi.debug('Setting autosaveDelay', val);
1076 929 }
1077   - else
1078   - {
  930 + else {
1079 931 EditorUi.debug('Invalid autosaveDelay', val);
1080 932 }
1081 933 }
1082 934
1083   - if (mxSettings.settings.defaultEdgeLength != null)
1084   - {
  935 + if (mxSettings.settings.defaultEdgeLength != null) {
1085 936 var val = parseInt(mxSettings.settings.defaultEdgeLength);
1086 937
1087   - if (!isNaN(val) && val > 0)
1088   - {
  938 + if (!isNaN(val) && val > 0) {
1089 939 Graph.prototype.defaultEdgeLength = val;
1090 940 EditorUi.debug('Using defaultEdgeLength', val);
1091 941 }
1092   - else
1093   - {
  942 + else {
1094 943 EditorUi.debug('Invalid defaultEdgeLength', val);
1095 944 }
1096 945 }
1097 946 }
1098 947 }
1099   - catch (e)
1100   - {
1101   - if (window.console != null)
1102   - {
  948 + catch (e) {
  949 + if (window.console != null) {
1103 950 console.error(e);
1104 951 }
1105 952 }
1106 953
1107 954 // Prefetches default fonts with URLs
1108   - if (Menus.prototype.defaultFonts != null)
1109   - {
1110   - for (var i = 0; i < Menus.prototype.defaultFonts.length; i++)
1111   - {
  955 + if (Menus.prototype.defaultFonts != null) {
  956 + for (var i = 0; i < Menus.prototype.defaultFonts.length; i++) {
1112 957 var value = Menus.prototype.defaultFonts[i];
1113 958
1114 959 if (typeof value !== 'string' &&
1115 960 value.fontFamily != null &&
1116   - value.fontUrl != null)
1117   - {
  961 + value.fontUrl != null) {
1118 962 Graph.addFont(value.fontFamily, value.fontUrl);
1119 963 }
1120 964 }
... ... @@ -1128,30 +972,23 @@ App.main = function(callback, createUi)
1128 972 };
1129 973
1130 974 // Sends load event if configuration is requested and waits for configure message
1131   - if (urlParams['configure'] == '1')
1132   - {
  975 + if (urlParams['configure'] == '1') {
1133 976 var op = window.opener || window.parent;
1134 977
1135   - var configHandler = function(evt)
1136   - {
1137   - if (evt.source == op)
1138   - {
1139   - try
1140   - {
  978 + var configHandler = function (evt) {
  979 + if (evt.source == op) {
  980 + try {
1141 981 var data = JSON.parse(evt.data);
1142 982
1143   - if (data != null && data.action == 'configure')
1144   - {
  983 + if (data != null && data.action == 'configure') {
1145 984 mxEvent.removeListener(window, 'message', configHandler);
1146 985 Editor.configure(data.config, true);
1147 986 mxSettings.load();
1148 987 doMain();
1149 988 }
1150 989 }
1151   - catch (e)
1152   - {
1153   - if (window.console != null)
1154   - {
  990 + catch (e) {
  991 + if (window.console != null) {
1155 992 console.log('Error in configure message: ' + e, evt.data);
1156 993 }
1157 994 }
... ... @@ -1160,52 +997,40 @@ App.main = function(callback, createUi)
1160 997
1161 998 // Receives XML message from opener and puts it into the graph
1162 999 mxEvent.addListener(window, 'message', configHandler);
1163   - op.postMessage(JSON.stringify({event: 'configure'}), '*');
  1000 + op.postMessage(JSON.stringify({ event: 'configure' }), '*');
1164 1001 }
1165   - else
1166   - {
1167   - if (Editor.config == null)
1168   - {
  1002 + else {
  1003 + if (Editor.config == null) {
1169 1004 // Loads configuration from global scope or local storage
1170   - if (window.DRAWIO_CONFIG != null)
1171   - {
1172   - try
1173   - {
  1005 + if (window.DRAWIO_CONFIG != null) {
  1006 + try {
1174 1007 EditorUi.debug('Using global configuration', window.DRAWIO_CONFIG);
1175 1008 Editor.configure(window.DRAWIO_CONFIG);
1176 1009 mxSettings.load();
1177 1010 }
1178   - catch (e)
1179   - {
1180   - if (window.console != null)
1181   - {
  1011 + catch (e) {
  1012 + if (window.console != null) {
1182 1013 console.error(e);
1183 1014 }
1184 1015 }
1185 1016 }
1186 1017
1187 1018 // Loads configuration from local storage
1188   - if (isLocalStorage && localStorage != null && urlParams['embed'] != '1')
1189   - {
  1019 + if (isLocalStorage && localStorage != null && urlParams['embed'] != '1') {
1190 1020 var configData = localStorage.getItem(Editor.configurationKey);
1191 1021
1192   - if (configData != null)
1193   - {
1194   - try
1195   - {
  1022 + if (configData != null) {
  1023 + try {
1196 1024 configData = JSON.parse(configData);
1197 1025
1198   - if (configData != null)
1199   - {
  1026 + if (configData != null) {
1200 1027 EditorUi.debug('Using local configuration', configData);
1201 1028 Editor.configure(configData);
1202 1029 mxSettings.load();
1203 1030 }
1204 1031 }
1205   - catch (e)
1206   - {
1207   - if (window.console != null)
1208   - {
  1032 + catch (e) {
  1033 + if (window.console != null) {
1209 1034 console.error(e);
1210 1035 }
1211 1036 }
... ... @@ -1274,30 +1099,25 @@ App.prototype.fullscreenMode = false;
1274 1099 /**
1275 1100 * Overriden UI settings depending on mode.
1276 1101 */
1277   -if (urlParams['embed'] != '1')
1278   -{
  1102 +if (urlParams['embed'] != '1') {
1279 1103 App.prototype.menubarHeight = 64;
1280 1104 }
1281   -else
1282   -{
  1105 +else {
1283 1106 App.prototype.footerHeight = 0;
1284 1107 }
1285 1108
1286 1109 /**
1287 1110 * Queue for loading plugins and wait for UI instance
1288 1111 */
1289   -App.initPluginCallback = function()
1290   -{
1291   - if (App.DrawPlugins == null)
1292   - {
  1112 +App.initPluginCallback = function () {
  1113 + if (App.DrawPlugins == null) {
1293 1114 // Workaround for need to load plugins now but wait for UI instance
1294 1115 App.DrawPlugins = [];
1295 1116
1296 1117 // Global entry point for plugins is Draw.loadPlugin. This is the only
1297 1118 // long-term supported solution for access to the EditorUi instance.
1298 1119 window.Draw = new Object();
1299   - window.Draw.loadPlugin = function(callback)
1300   - {
  1120 + window.Draw.loadPlugin = function (callback) {
1301 1121 App.DrawPlugins.push(callback);
1302 1122 };
1303 1123 }
... ... @@ -1312,58 +1132,43 @@ App.embedModePluginsCount = 0;
1312 1132 /**
1313 1133 * Queue for loading plugins and wait for UI instance
1314 1134 */
1315   -App.loadPlugins = function(plugins, useInclude)
1316   -{
  1135 +App.loadPlugins = function (plugins, useInclude) {
1317 1136 EditorUi.debug('Loading plugins', plugins);
1318 1137
1319   - for (var i = 0; i < plugins.length; i++)
1320   - {
1321   - if (plugins[i] != null && plugins[i].length > 0)
1322   - {
1323   - try
1324   - {
  1138 + for (var i = 0; i < plugins.length; i++) {
  1139 + if (plugins[i] != null && plugins[i].length > 0) {
  1140 + try {
1325 1141 var url = PLUGINS_BASE_PATH + App.pluginRegistry[plugins[i]];
1326 1142
1327   - if (url != null)
1328   - {
1329   - if (App.pluginsLoaded[url] == null)
1330   - {
  1143 + if (url != null) {
  1144 + if (App.pluginsLoaded[url] == null) {
1331 1145 App.pluginsLoaded[url] = true;
1332 1146 App.embedModePluginsCount++;
1333 1147
1334   - if (typeof window.drawDevUrl === 'undefined')
1335   - {
1336   - if (useInclude)
1337   - {
  1148 + if (typeof window.drawDevUrl === 'undefined') {
  1149 + if (useInclude) {
1338 1150 mxinclude(url);
1339 1151 }
1340   - else
1341   - {
  1152 + else {
1342 1153 mxscript(url);
1343 1154 }
1344 1155 }
1345   - else
1346   - {
1347   - if (useInclude)
1348   - {
  1156 + else {
  1157 + if (useInclude) {
1349 1158 mxinclude(url);
1350 1159 }
1351   - else
1352   - {
  1160 + else {
1353 1161 mxscript(drawDevUrl + url);
1354 1162 }
1355 1163 }
1356 1164 }
1357 1165 }
1358   - else if (window.console != null)
1359   - {
  1166 + else if (window.console != null) {
1360 1167 console.log('Unknown plugin:', plugins[i]);
1361 1168 }
1362 1169 }
1363   - catch (e)
1364   - {
1365   - if (window.console != null)
1366   - {
  1170 + catch (e) {
  1171 + if (window.console != null) {
1367 1172 console.log('Error loading plugin:', plugins[i], e);
1368 1173 }
1369 1174 }
... ... @@ -1375,21 +1180,16 @@ App.loadPlugins = function(plugins, useInclude)
1375 1180 * Delay embed mode initialization until all plugins are loaded
1376 1181 * 延迟嵌入模式初始化,直到所有插件加载完毕
1377 1182 */
1378   -App.prototype.initializeEmbedMode = function()
1379   -{
1380   - if (urlParams['embed'] == '1')
1381   - {
1382   - if (window.location.hostname == 'app.diagrams.net')
1383   - {
  1183 +App.prototype.initializeEmbedMode = function () {
  1184 + if (urlParams['embed'] == '1') {
  1185 + if (window.location.hostname == 'app.diagrams.net') {
1384 1186 this.showBanner('EmbedDeprecationFooter', 'app.diagrams.net will stop working for embed mode. Please use embed.diagrams.net.');
1385 1187 }
1386 1188
1387   - if (App.embedModePluginsCount > 0 || this.initEmbedDone)
1388   - {
  1189 + if (App.embedModePluginsCount > 0 || this.initEmbedDone) {
1389 1190 return; //Wait for plugins to load, or this is a duplicate call due to timeout
1390 1191 }
1391   - else
1392   - {
  1192 + else {
1393 1193 this.initEmbedDone = true;
1394 1194 }
1395 1195
... ... @@ -1400,14 +1200,11 @@ App.prototype.initializeEmbedMode = function()
1400 1200 /**
1401 1201 * TODO: Define viewer protocol and implement new viewer style toolbar
1402 1202 */
1403   -App.prototype.initializeViewerMode = function()
1404   -{
  1203 +App.prototype.initializeViewerMode = function () {
1405 1204 var parent = window.opener || window.parent;
1406 1205
1407   - if (parent != null)
1408   - {
1409   - this.editor.graph.addListener(mxEvent.SIZE, mxUtils.bind(this, function()
1410   - {
  1206 + if (parent != null) {
  1207 + this.editor.graph.addListener(mxEvent.SIZE, mxUtils.bind(this, function () {
1411 1208 parent.postMessage(JSON.stringify(this.createLoadMessage('size')), '*');
1412 1209 }));
1413 1210 }
... ... @@ -1419,8 +1216,7 @@ App.prototype.initializeViewerMode = function()
1419 1216 * @param {number} dx X-coordinate of the translation.
1420 1217 * @param {number} dy Y-coordinate of the translation.
1421 1218 */
1422   -App.prototype.init = function()
1423   -{
  1219 +App.prototype.init = function () {
1424 1220 EditorUi.prototype.init.apply(this, arguments);
1425 1221
1426 1222 /**
... ... @@ -1437,14 +1233,12 @@ App.prototype.init = function()
1437 1233 * Creates github client.
1438 1234 */
1439 1235 this.gitHub = (!mxClient.IS_IE || document.documentMode == 10 ||
1440   - mxClient.IS_IE11 || mxClient.IS_EDGE) &&
1441   - (urlParams['gh'] != '0' && (urlParams['embed'] != '1' ||
  1236 + mxClient.IS_IE11 || mxClient.IS_EDGE) &&
  1237 + (urlParams['gh'] != '0' && (urlParams['embed'] != '1' ||
1442 1238 urlParams['gh'] == '1')) ? new GitHubClient(this) : null;
1443 1239
1444   - if (this.gitHub != null)
1445   - {
1446   - this.gitHub.addListener('userChanged', mxUtils.bind(this, function()
1447   - {
  1240 + if (this.gitHub != null) {
  1241 + this.gitHub.addListener('userChanged', mxUtils.bind(this, function () {
1448 1242 this.updateUserElement();
1449 1243 this.restoreLibraries();
1450 1244 }));
... ... @@ -1456,12 +1250,10 @@ App.prototype.init = function()
1456 1250 this.gitLab = (!mxClient.IS_IE || document.documentMode == 10 ||
1457 1251 mxClient.IS_IE11 || mxClient.IS_EDGE) &&
1458 1252 (urlParams['gl'] != '0' && (urlParams['embed'] != '1' ||
1459   - urlParams['gl'] == '1')) ? new GitLabClient(this) : null;
  1253 + urlParams['gl'] == '1')) ? new GitLabClient(this) : null;
1460 1254
1461   - if (this.gitLab != null)
1462   - {
1463   - this.gitLab.addListener('userChanged', mxUtils.bind(this, function()
1464   - {
  1255 + if (this.gitLab != null) {
  1256 + this.gitLab.addListener('userChanged', mxUtils.bind(this, function () {
1465 1257 this.updateUserElement();
1466 1258 this.restoreLibraries();
1467 1259 }));
... ... @@ -1470,22 +1262,18 @@ App.prototype.init = function()
1470 1262 /**
1471 1263 * Lazy-loading for individual backends
1472 1264 */
1473   - if (urlParams['embed'] != '1' || urlParams['od'] == '1')
1474   - {
  1265 + if (urlParams['embed'] != '1' || urlParams['od'] == '1') {
1475 1266 /**
1476 1267 * Creates onedrive client if all required libraries are available.
1477 1268 */
1478   - var initOneDriveClient = mxUtils.bind(this, function()
1479   - {
1480   - if (typeof OneDrive !== 'undefined')
1481   - {
  1269 + var initOneDriveClient = mxUtils.bind(this, function () {
  1270 + if (typeof OneDrive !== 'undefined') {
1482 1271 /**
1483 1272 * Holds the x-coordinate of the point.
1484 1273 */
1485 1274 this.oneDrive = new OneDriveClient(this);
1486 1275
1487   - this.oneDrive.addListener('userChanged', mxUtils.bind(this, function()
1488   - {
  1276 + this.oneDrive.addListener('userChanged', mxUtils.bind(this, function () {
1489 1277 this.updateUserElement();
1490 1278 this.restoreLibraries();
1491 1279 }));
... ... @@ -1493,8 +1281,7 @@ App.prototype.init = function()
1493 1281 // Notifies listeners of new client
1494 1282 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.oneDrive));
1495 1283 }
1496   - else if (window.DrawOneDriveClientCallback == null)
1497   - {
  1284 + else if (window.DrawOneDriveClientCallback == null) {
1498 1285 window.DrawOneDriveClientCallback = initOneDriveClient;
1499 1286 }
1500 1287 });
... ... @@ -1505,22 +1292,17 @@ App.prototype.init = function()
1505 1292 /**
1506 1293 * Lazy-loading for Trello
1507 1294 */
1508   - if (urlParams['embed'] != '1' || urlParams['tr'] == '1')
1509   - {
  1295 + if (urlParams['embed'] != '1' || urlParams['tr'] == '1') {
1510 1296 /**
1511 1297 * Creates Trello client if all required libraries are available.
1512 1298 */
1513   - var initTrelloClient = mxUtils.bind(this, function()
1514   - {
1515   - if (typeof window.Trello !== 'undefined')
1516   - {
1517   - try
1518   - {
  1299 + var initTrelloClient = mxUtils.bind(this, function () {
  1300 + if (typeof window.Trello !== 'undefined') {
  1301 + try {
1519 1302 this.trello = new TrelloClient(this);
1520 1303
1521 1304 //TODO we have no user info from Trello so we don't set a user
1522   - this.trello.addListener('userChanged', mxUtils.bind(this, function()
1523   - {
  1305 + this.trello.addListener('userChanged', mxUtils.bind(this, function () {
1524 1306 this.updateUserElement();
1525 1307 this.restoreLibraries();
1526 1308 }));
... ... @@ -1528,16 +1310,13 @@ App.prototype.init = function()
1528 1310 // Notifies listeners of new client
1529 1311 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.trello));
1530 1312 }
1531   - catch (e)
1532   - {
1533   - if (window.console != null)
1534   - {
  1313 + catch (e) {
  1314 + if (window.console != null) {
1535 1315 console.error(e);
1536 1316 }
1537 1317 }
1538 1318 }
1539   - else if (window.DrawTrelloClientCallback == null)
1540   - {
  1319 + else if (window.DrawTrelloClientCallback == null) {
1541 1320 window.DrawTrelloClientCallback = initTrelloClient;
1542 1321 }
1543 1322 });
... ... @@ -1548,21 +1327,16 @@ App.prototype.init = function()
1548 1327 /**
1549 1328 * Creates drive client with all required libraries are available.
1550 1329 */
1551   - if (urlParams['embed'] != '1' || urlParams['gapi'] == '1')
1552   - {
1553   - var initDriveClient = mxUtils.bind(this, function()
1554   - {
  1330 + if (urlParams['embed'] != '1' || urlParams['gapi'] == '1') {
  1331 + var initDriveClient = mxUtils.bind(this, function () {
1555 1332 /**
1556 1333 * Creates google drive client if all required libraries are available.
1557 1334 */
1558   - if (typeof gapi !== 'undefined')
1559   - {
1560   - var doInit = mxUtils.bind(this, function()
1561   - {
  1335 + if (typeof gapi !== 'undefined') {
  1336 + var doInit = mxUtils.bind(this, function () {
1562 1337 this.drive = new DriveClient(this);
1563 1338
1564   - this.drive.addListener('userChanged', mxUtils.bind(this, function()
1565   - {
  1339 + this.drive.addListener('userChanged', mxUtils.bind(this, function () {
1566 1340 this.updateUserElement();
1567 1341 this.restoreLibraries();
1568 1342 this.checkLicense();
... ... @@ -1572,22 +1346,19 @@ App.prototype.init = function()
1572 1346 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.drive));
1573 1347 });
1574 1348
1575   - if (window.DrawGapiClientCallback != null)
1576   - {
1577   - gapi.load(((urlParams['picker'] != '0') ? 'picker,': '') + App.GOOGLE_APIS, doInit);
  1349 + if (window.DrawGapiClientCallback != null) {
  1350 + gapi.load(((urlParams['picker'] != '0') ? 'picker,' : '') + App.GOOGLE_APIS, doInit);
1578 1351
1579 1352 /**
1580 1353 * Clears any callbacks.
1581 1354 */
1582 1355 window.DrawGapiClientCallback = null;
1583 1356 }
1584   - else
1585   - {
  1357 + else {
1586 1358 doInit();
1587 1359 }
1588 1360 }
1589   - else if (window.DrawGapiClientCallback == null)
1590   - {
  1361 + else if (window.DrawGapiClientCallback == null) {
1591 1362 window.DrawGapiClientCallback = initDriveClient;
1592 1363 }
1593 1364 });
... ... @@ -1595,15 +1366,12 @@ App.prototype.init = function()
1595 1366 initDriveClient();
1596 1367 }
1597 1368
1598   - if (urlParams['embed'] != '1' || urlParams['db'] == '1')
1599   - {
  1369 + if (urlParams['embed'] != '1' || urlParams['db'] == '1') {
1600 1370 /**
1601 1371 * Creates dropbox client if all required libraries are available.
1602 1372 */
1603   - var initDropboxClient = mxUtils.bind(this, function()
1604   - {
1605   - if (typeof Dropbox === 'function' && typeof Dropbox.choose !== 'undefined')
1606   - {
  1373 + var initDropboxClient = mxUtils.bind(this, function () {
  1374 + if (typeof Dropbox === 'function' && typeof Dropbox.choose !== 'undefined') {
1607 1375 /**
1608 1376 * Clears dropbox client callback.
1609 1377 */
... ... @@ -1612,12 +1380,10 @@ App.prototype.init = function()
1612 1380 /**
1613 1381 * Holds the x-coordinate of the point.
1614 1382 */
1615   - try
1616   - {
  1383 + try {
1617 1384 this.dropbox = new DropboxClient(this);
1618 1385
1619   - this.dropbox.addListener('userChanged', mxUtils.bind(this, function()
1620   - {
  1386 + this.dropbox.addListener('userChanged', mxUtils.bind(this, function () {
1621 1387 this.updateUserElement();
1622 1388 this.restoreLibraries();
1623 1389 }));
... ... @@ -1625,16 +1391,13 @@ App.prototype.init = function()
1625 1391 // Notifies listeners of new client
1626 1392 this.fireEvent(new mxEventObject('clientLoaded', 'client', this.dropbox));
1627 1393 }
1628   - catch (e)
1629   - {
1630   - if (window.console != null)
1631   - {
  1394 + catch (e) {
  1395 + if (window.console != null) {
1632 1396 console.error(e);
1633 1397 }
1634 1398 }
1635 1399 }
1636   - else if (window.DrawDropboxClientCallback == null)
1637   - {
  1400 + else if (window.DrawDropboxClientCallback == null) {
1638 1401 window.DrawDropboxClientCallback = initDropboxClient;
1639 1402 }
1640 1403 });
... ... @@ -1642,8 +1405,7 @@ App.prototype.init = function()
1642 1405 initDropboxClient();
1643 1406 }
1644 1407
1645   - if (urlParams['embed'] != '1')
1646   - {
  1408 + if (urlParams['embed'] != '1') {
1647 1409 /**
1648 1410 * Holds the background element.
1649 1411 */
... ... @@ -1656,45 +1418,35 @@ App.prototype.init = function()
1656 1418 this.sidebarFooterContainer.style.display = 'none';
1657 1419
1658 1420 // Sets the initial mode
1659   - if (urlParams['local'] == '1')
1660   - {
  1421 + if (urlParams['local'] == '1') {
1661 1422 this.setMode(App.MODE_DEVICE);
1662 1423 }
1663   - else
1664   - {
  1424 + else {
1665 1425 this.mode = App.mode;
1666 1426 }
1667 1427
1668 1428 // Add to Home Screen dialog for mobile devices
1669 1429 if ('serviceWorker' in navigator && !this.editor.isChromelessView() &&
1670   - (mxClient.IS_ANDROID || mxClient.IS_IOS))
1671   - {
1672   - window.addEventListener('beforeinstallprompt', mxUtils.bind(this, function(e)
1673   - {
1674   - this.showBanner('AddToHomeScreenFooter', mxResources.get('installApp'), function()
1675   - {
1676   - e.prompt();
  1430 + (mxClient.IS_ANDROID || mxClient.IS_IOS)) {
  1431 + window.addEventListener('beforeinstallprompt', mxUtils.bind(this, function (e) {
  1432 + this.showBanner('AddToHomeScreenFooter', mxResources.get('installApp'), function () {
  1433 + e.prompt();
1677 1434 });
1678 1435 }));
1679 1436 }
1680 1437
1681 1438 if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp && !this.isOffline() &&
1682 1439 !mxClient.IS_ANDROID && !mxClient.IS_IOS && urlParams['open'] == null &&
1683   - (!this.editor.chromeless || this.editor.editable))
1684   - {
1685   - this.editor.addListener('fileLoaded', mxUtils.bind(this, function()
1686   - {
  1440 + (!this.editor.chromeless || this.editor.editable)) {
  1441 + this.editor.addListener('fileLoaded', mxUtils.bind(this, function () {
1687 1442 var file = this.getCurrentFile();
1688 1443 var mode = (file != null) ? file.getMode() : null;
1689 1444
1690   - if (urlParams['extAuth'] != '1' && (mode == App.MODE_DEVICE || mode == App.MODE_BROWSER))
1691   - {
  1445 + if (urlParams['extAuth'] != '1' && (mode == App.MODE_DEVICE || mode == App.MODE_BROWSER)) {
1692 1446 //关闭桌面弹出广告
1693 1447 //this.showDownloadDesktopBanner();
1694 1448 }
1695   - else if (urlParams['embed'] != '1' && this.getServiceName() == 'draw.io')
1696   -
1697   - {
  1449 + else if (urlParams['embed'] != '1' && this.getServiceName() == 'draw.io') {
1698 1450 // just app.diagrams.net users
1699 1451 // this.showNameConfBanner();
1700 1452 }
... ... @@ -1703,13 +1455,11 @@ App.prototype.init = function()
1703 1455
1704 1456 if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp && urlParams['embed'] != '1' && DrawioFile.SYNC == 'auto' &&
1705 1457 urlParams['local'] != '1' && urlParams['stealth'] != '1' && !this.isOffline() &&
1706   - (!this.editor.chromeless || this.editor.editable))
1707   - {
  1458 + (!this.editor.chromeless || this.editor.editable)) {
1708 1459 // Checks if the cache is alive
1709 1460 var acceptResponse = true;
1710 1461
1711   - var timeoutThread = window.setTimeout(mxUtils.bind(this, function()
1712   - {
  1462 + var timeoutThread = window.setTimeout(mxUtils.bind(this, function () {
1713 1463 acceptResponse = false;
1714 1464
1715 1465 // Switches to manual sync if cache cannot be reached
... ... @@ -1717,36 +1467,32 @@ App.prototype.init = function()
1717 1467
1718 1468 var file = this.getCurrentFile();
1719 1469
1720   - if (file != null && file.sync != null)
1721   - {
  1470 + if (file != null && file.sync != null) {
1722 1471 file.sync.destroy();
1723 1472 file.sync = null;
1724 1473
1725 1474 var status = mxUtils.htmlEntities(mxResources.get('timeout'));
1726   - this.editor.setStatus('<div title="'+ status +
  1475 + this.editor.setStatus('<div title="' + status +
1727 1476 '" class="geStatusAlert">' + status + '</div>');
1728 1477 }
1729 1478
1730   - EditorUi.logEvent({category: 'TIMEOUT-CACHE-CHECK', action: 'timeout', label: 408});
  1479 + EditorUi.logEvent({ category: 'TIMEOUT-CACHE-CHECK', action: 'timeout', label: 408 });
1731 1480 }), Editor.cacheTimeout);
1732 1481
1733 1482 var t0 = new Date().getTime();
1734 1483
1735   - mxUtils.get(EditorUi.cacheUrl + '?alive', mxUtils.bind(this, function(req)
1736   - {
  1484 + mxUtils.get(EditorUi.cacheUrl + '?alive', mxUtils.bind(this, function (req) {
1737 1485 window.clearTimeout(timeoutThread);
1738 1486 }));
1739 1487 }
1740 1488 }
1741   - else if (this.menubar != null)
1742   - {
  1489 + else if (this.menubar != null) {
1743 1490 this.menubar.container.style.paddingTop = '0px';
1744 1491 }
1745 1492
1746 1493 this.updateHeader();
1747 1494
1748   - if (this.menubar != null)
1749   - {
  1495 + if (this.menubar != null) {
1750 1496 this.buttonContainer = document.createElement('div');
1751 1497 this.buttonContainer.style.display = 'inline-block';
1752 1498 this.buttonContainer.style.paddingRight = '48px';
... ... @@ -1756,10 +1502,8 @@ App.prototype.init = function()
1756 1502 this.menubar.container.appendChild(this.buttonContainer);
1757 1503 }
1758 1504
1759   - if ((uiTheme == 'atlas' || urlParams['atlas'] == '1') && this.menubar != null)
1760   - {
1761   - if (this.toggleElement != null)
1762   - {
  1505 + if ((uiTheme == 'atlas' || urlParams['atlas'] == '1') && this.menubar != null) {
  1506 + if (this.toggleElement != null) {
1763 1507 this.toggleElement.click();
1764 1508 this.toggleElement.style.display = 'none';
1765 1509 }
... ... @@ -1767,19 +1511,17 @@ App.prototype.init = function()
1767 1511 this.icon = document.createElement('img');
1768 1512 this.icon.setAttribute('src', IMAGE_PATH + '/logo-flat-small.png');
1769 1513 this.icon.setAttribute('title', mxResources.get('draw.io'));
1770   - this.icon.style.padding = urlParams['atlas'] == '1'? '7px' : '6px';
  1514 + this.icon.style.padding = urlParams['atlas'] == '1' ? '7px' : '6px';
1771 1515 this.icon.style.cursor = 'pointer';
1772 1516
1773   - mxEvent.addListener(this.icon, 'click', mxUtils.bind(this, function(evt)
1774   - {
  1517 + mxEvent.addListener(this.icon, 'click', mxUtils.bind(this, function (evt) {
1775 1518 this.appIconClicked(evt);
1776 1519 }));
1777 1520
1778 1521 this.menubar.container.insertBefore(this.icon, this.menubar.container.firstChild);
1779 1522 }
1780 1523
1781   - if (this.editor.graph.isViewer())
1782   - {
  1524 + if (this.editor.graph.isViewer()) {
1783 1525 this.initializeViewerMode();
1784 1526 }
1785 1527 };
... ... @@ -1788,13 +1530,10 @@ App.prototype.init = function()
1788 1530 * Schedules a sanity check.
1789 1531 * 定时完整性检查
1790 1532 */
1791   -App.prototype.scheduleSanityCheck = function()
1792   -{
  1533 +App.prototype.scheduleSanityCheck = function () {
1793 1534 if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp &&
1794   - this.sanityCheckThread == null)
1795   - {
1796   - this.sanityCheckThread = window.setTimeout(mxUtils.bind(this, function()
1797   - {
  1535 + this.sanityCheckThread == null) {
  1536 + this.sanityCheckThread = window.setTimeout(mxUtils.bind(this, function () {
1798 1537 this.sanityCheckThread = null;
1799 1538 this.sanityCheck();
1800 1539 }), this.warnInterval);
... ... @@ -1805,10 +1544,8 @@ App.prototype.scheduleSanityCheck = function()
1805 1544 * Stops sanity checks.
1806 1545 * 停止完整性检查
1807 1546 */
1808   -App.prototype.stopSanityCheck = function()
1809   -{
1810   - if (this.sanityCheckThread != null)
1811   - {
  1547 +App.prototype.stopSanityCheck = function () {
  1548 + if (this.sanityCheckThread != null) {
1812 1549 window.clearTimeout(this.sanityCheckThread);
1813 1550 this.sanityCheckThread = null;
1814 1551 }
... ... @@ -1818,28 +1555,27 @@ App.prototype.stopSanityCheck = function()
1818 1555 * Shows a warning after some time with unsaved changes and autosave.
1819 1556 *
1820 1557 */
1821   -App.prototype.sanityCheck = function()
1822   -{
  1558 +App.prototype.sanityCheck = function () {
1823 1559 var file = this.getCurrentFile();
1824 1560
1825   - if (file != null && file.isModified() && file.isAutosave() && file.isOverdue())
1826   - {
1827   - var evt = {category: 'WARN-FILE-' + file.getHash(),
  1561 + if (file != null && file.isModified() && file.isAutosave() && file.isOverdue()) {
  1562 + var evt = {
  1563 + category: 'WARN-FILE-' + file.getHash(),
1828 1564 action: ((file.savingFile) ? 'saving' : '') +
1829   - ((file.savingFile && file.savingFileTime != null) ? '_' +
1830   - Math.round((Date.now() - file.savingFileTime.getTime()) / 1000) : '') +
1831   - ((file.saveLevel != null) ? ('-sl_' + file.saveLevel) : '') +
1832   - '-age_' + ((file.ageStart != null) ? Math.round((Date.now() - file.ageStart.getTime()) / 1000) : 'x') +
1833   - ((this.editor.autosave) ? '' : '-nosave') +
1834   - ((file.isAutosave()) ? '' : '-noauto') +
1835   - '-open_' + ((file.opened != null) ? Math.round((Date.now() - file.opened.getTime()) / 1000) : 'x') +
1836   - '-save_' + ((file.lastSaved != null) ? Math.round((Date.now() - file.lastSaved.getTime()) / 1000) : 'x') +
1837   - '-change_' + ((file.lastChanged != null) ? Math.round((Date.now() - file.lastChanged.getTime()) / 1000) : 'x')+
1838   - '-alive_' + Math.round((Date.now() - App.startTime.getTime()) / 1000),
1839   - label: (file.sync != null) ? ('client_' + file.sync.clientId) : 'nosync'};
1840   -
1841   - if (file.constructor == DriveFile && file.desc != null && this.drive != null)
1842   - {
  1565 + ((file.savingFile && file.savingFileTime != null) ? '_' +
  1566 + Math.round((Date.now() - file.savingFileTime.getTime()) / 1000) : '') +
  1567 + ((file.saveLevel != null) ? ('-sl_' + file.saveLevel) : '') +
  1568 + '-age_' + ((file.ageStart != null) ? Math.round((Date.now() - file.ageStart.getTime()) / 1000) : 'x') +
  1569 + ((this.editor.autosave) ? '' : '-nosave') +
  1570 + ((file.isAutosave()) ? '' : '-noauto') +
  1571 + '-open_' + ((file.opened != null) ? Math.round((Date.now() - file.opened.getTime()) / 1000) : 'x') +
  1572 + '-save_' + ((file.lastSaved != null) ? Math.round((Date.now() - file.lastSaved.getTime()) / 1000) : 'x') +
  1573 + '-change_' + ((file.lastChanged != null) ? Math.round((Date.now() - file.lastChanged.getTime()) / 1000) : 'x') +
  1574 + '-alive_' + Math.round((Date.now() - App.startTime.getTime()) / 1000),
  1575 + label: (file.sync != null) ? ('client_' + file.sync.clientId) : 'nosync'
  1576 + };
  1577 +
  1578 + if (file.constructor == DriveFile && file.desc != null && this.drive != null) {
1843 1579 evt.label += ((this.drive.user != null) ? ('-user_' + this.drive.user.id) : '-nouser') + '-rev_' +
1844 1580 file.desc.headRevisionId + '-mod_' + file.desc.modifiedDate + '-size_' + file.getSize() +
1845 1581 '-mime_' + file.desc.mimeType;
... ... @@ -1849,12 +1585,10 @@ App.prototype.sanityCheck = function()
1849 1585
1850 1586 var msg = mxResources.get('ensureDataSaved');
1851 1587
1852   - if (file.lastSaved != null)
1853   - {
  1588 + if (file.lastSaved != null) {
1854 1589 var str = this.timeSince(file.lastSaved);
1855 1590
1856   - if (str == null)
1857   - {
  1591 + if (str == null) {
1858 1592 str = mxResources.get('lessThanAMinute');
1859 1593 }
1860 1594
... ... @@ -1865,16 +1599,13 @@ App.prototype.sanityCheck = function()
1865 1599 this.spinner.stop();
1866 1600
1867 1601 this.showError(mxResources.get('unsavedChanges'), msg, mxResources.get('ignore'),
1868   - mxUtils.bind(this, function()
1869   - {
  1602 + mxUtils.bind(this, function () {
1870 1603 this.hideDialog();
1871   - }), null, mxResources.get('save'), mxUtils.bind(this, function()
1872   - {
  1604 + }), null, mxResources.get('save'), mxUtils.bind(this, function () {
1873 1605 this.stopSanityCheck();
1874 1606 this.actions.get((this.mode == null || !file.isEditable()) ?
1875 1607 'saveAs' : 'save').funct();
1876   - }), null, null, 360, 120, null, mxUtils.bind(this, function()
1877   - {
  1608 + }), null, null, 360, 120, null, mxUtils.bind(this, function () {
1878 1609 this.scheduleSanityCheck();
1879 1610 }));
1880 1611 }
... ... @@ -1883,28 +1614,25 @@ App.prototype.sanityCheck = function()
1883 1614 /**
1884 1615 * Returns true if the current domain is for the new drive app.
1885 1616 */
1886   -App.prototype.isDriveDomain = function()
1887   -{
  1617 +App.prototype.isDriveDomain = function () {
1888 1618 return urlParams['drive'] != '0' &&
1889 1619 (window.location.hostname == 'test.draw.io' ||
1890   - window.location.hostname == 'www.draw.io' ||
1891   - window.location.hostname == 'drive.draw.io' ||
1892   - window.location.hostname == 'app.diagrams.net' ||
1893   - window.location.hostname == 'jgraph.github.io');
  1620 + window.location.hostname == 'www.draw.io' ||
  1621 + window.location.hostname == 'drive.draw.io' ||
  1622 + window.location.hostname == 'app.diagrams.net' ||
  1623 + window.location.hostname == 'jgraph.github.io');
1894 1624 };
1895 1625
1896 1626 /**
1897 1627 * Returns the pusher instance for notifications. Creates the instance of none exists.
1898 1628 */
1899   -App.prototype.getPusher = function()
1900   -{
1901   - if (this.pusher == null && typeof window.Pusher === 'function')
1902   - {
  1629 +App.prototype.getPusher = function () {
  1630 + if (this.pusher == null && typeof window.Pusher === 'function') {
1903 1631 this.pusher = new Pusher(App.PUSHER_KEY,
1904   - {
1905   - cluster: App.PUSHER_CLUSTER,
1906   - encrypted: true
1907   - });
  1632 + {
  1633 + cluster: App.PUSHER_CLUSTER,
  1634 + encrypted: true
  1635 + });
1908 1636 }
1909 1637
1910 1638 return this.pusher;
... ... @@ -1913,10 +1641,8 @@ App.prototype.getPusher = function()
1913 1641 /**
1914 1642 * Shows a footer to download the desktop version once per session.
1915 1643 */
1916   -App.prototype.showNameChangeBanner = function()
1917   -{
1918   - this.showBanner('DiagramsFooter', 'draw.io is now diagrams.net', mxUtils.bind(this, function()
1919   - {
  1644 +App.prototype.showNameChangeBanner = function () {
  1645 + this.showBanner('DiagramsFooter', 'draw.io is now diagrams.net', mxUtils.bind(this, function () {
1920 1646 this.openLink('https://www.diagrams.net/blog/move-diagrams-net');
1921 1647 }));
1922 1648 };
... ... @@ -1924,10 +1650,8 @@ App.prototype.showNameChangeBanner = function()
1924 1650 /**
1925 1651 * Shows a footer to download the desktop version once per session.
1926 1652 */
1927   -App.prototype.showNameConfBanner = function()
1928   -{
1929   - this.showBanner('ConfFooter', 'Try draw.io for Confluence', mxUtils.bind(this, function()
1930   - {
  1653 +App.prototype.showNameConfBanner = function () {
  1654 + this.showBanner('ConfFooter', 'Try draw.io for Confluence', mxUtils.bind(this, function () {
1931 1655 this.openLink('https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-for-confluence');
1932 1656 }), true);
1933 1657 };
... ... @@ -1935,10 +1659,8 @@ App.prototype.showNameConfBanner = function()
1935 1659 /**
1936 1660 * Shows a footer to download the desktop version once per session.
1937 1661 */
1938   -App.prototype.showDownloadDesktopBanner = function()
1939   -{
1940   - this.showBanner('DesktopFooter', mxResources.get('downloadDesktop'), mxUtils.bind(this, function()
1941   - {
  1662 +App.prototype.showDownloadDesktopBanner = function () {
  1663 + this.showBanner('DesktopFooter', mxResources.get('downloadDesktop'), mxUtils.bind(this, function () {
1942 1664 this.openLink('https://get.diagrams.net/');
1943 1665 }));
1944 1666 };
... ... @@ -1946,140 +1668,127 @@ App.prototype.showDownloadDesktopBanner = function()
1946 1668 /**
1947 1669 * Shows a footer to download the desktop version once per session.
1948 1670 */
1949   -App.prototype.showRatingBanner = function()
1950   -{
1951   - if (!this.bannerShowing && !this['hideBanner' + 'ratingFooter'] &&
1952   - (!isLocalStorage || mxSettings.settings == null ||
1953   - mxSettings.settings['close' + 'ratingFooter'] == null))
1954   - {
1955   - var banner = document.createElement('div');
1956   - banner.style.cssText = 'position:absolute;bottom:10px;left:50%;max-width:90%;padding:18px 34px 12px 20px;' +
1957   - 'font-size:16px;font-weight:bold;white-space:nowrap;cursor:pointer;z-index:' + mxPopupMenu.prototype.zIndex + ';';
1958   - mxUtils.setPrefixedStyle(banner.style, 'box-shadow', '1px 1px 2px 0px #ddd');
1959   - mxUtils.setPrefixedStyle(banner.style, 'transform', 'translate(-50%,120%)');
1960   - mxUtils.setPrefixedStyle(banner.style, 'transition', 'all 1s ease');
1961   - banner.className = 'geBtn gePrimaryBtn';
1962   -
1963   - var img = document.createElement('img');
1964   - img.setAttribute('src', Dialog.prototype.closeImage);
1965   - img.setAttribute('title', mxResources.get('close'));
1966   - img.setAttribute('border', '0');
1967   - img.style.cssText = 'position:absolute;right:10px;top:12px;filter:invert(1);padding:6px;margin:-6px;cursor:default;';
1968   - banner.appendChild(img);
1969   -
1970   - var star = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZ' +
1971   - 'XdvcmtzIENTM5jWRgMAAAQRdEVYdFhNTDpjb20uYWRvYmUueG1wADw/eHBhY2tldCBiZWdpbj0iICAgIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+Cjx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8i' +
1972   - 'IHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDQuMS1jMDM0IDQ2LjI3Mjk3NiwgU2F0IEphbiAyNyAyMDA3IDIyOjExOjQxICAgICAgICAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDI' +
1973   - 'vMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4YXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgogICAgICAgICA8eGFwOkNyZW' +
1974   - 'F0b3JUb29sPkFkb2JlIEZpcmV3b3JrcyBDUzM8L3hhcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhhcDpDcmVhdGVEYXRlPjIwMDgtMDItMTdUMDI6MzY6NDVaPC94YXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhhcDpNb2RpZ' +
1975   - 'nlEYXRlPjIwMDktMDMtMTdUMTQ6MTI6MDJaPC94YXA6TW9kaWZ5RGF0ZT4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmRjPSJo' +
1976   - 'dHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyI+CiAgICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo' +
1977   - 'gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIC' +
1978   - 'AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI' +
1979   - 'CAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIIImu8AAAAAVdEVYdENyZWF0aW9uIFRpbWUAMi8xNy8wOCCcqlgAAAHuSURBVDiNlZJBi1JRGIbfk+fc0ZuMXorJe4XujWoMdREaA23HICj6AQeLINr0C4I27ab2' +
1980   - '7VqOI9+q/sH8gMDceG1RkIwgClEXFMbRc5zTZgZURmG+5fu9PN/7Hg6wZohoh4h21nn4uqXW+q0xZgzg+SrPlTXX73uet+26bp6ICpcGaK1fua57M5vN3tZav7gUgIiSqVTqcRAEm0EQbCaTyQoRXb3Iy4hoG8CT6XSaY4xtMMa' +
1981   - 'SQohMPp8v+r7vAEC3243CMGwqpfoApsaYE8uyfgM45ABOjDEvXdfNlMvlzFINAIDneY7neZVzvdlsDgaDQYtzfsjOIjtKqU+e5+0Wi0V3VV8ACMOw3+/3v3HOX0sp/7K53te11h/S6fRuoVAIhBAL76OUOm2320dRFH0VQuxJKf' +
1982   - '8BAFu+UKvVvpRKpWe2bYt5fTweq0ajQUKIN1LK43N94SMR0Y1YLLYlhBBKqQUw51wkEol7WmuzoC8FuJtIJLaUUoii6Ljb7f4yxpz6vp9zHMe2bfvacDi8BeDHKkBuNps5rVbr52QyaVuW9ZExttHpdN73ej0/Ho+nADxYCdBaV' +
1983   - '0aj0RGAz5ZlHUgpx2erR/V6/d1wOHwK4CGA/QsBnPN9AN+llH+WkqFare4R0QGAO/M6M8Ysey81/wGqa8MlVvHPNAAAAABJRU5ErkJggg==';
1984   -
1985   - mxUtils.write(banner, 'Please rate us');
1986   - document.body.appendChild(banner);
1987   -
1988   - var star1 = document.createElement('img');
1989   - star1.setAttribute('border', '0');
1990   - star1.setAttribute('align', 'absmiddle');
1991   - star1.setAttribute('title', '1 star');
1992   - star1.setAttribute('style', 'margin-top:-6px;cursor:pointer;margin-left:8px;');
1993   - star1.setAttribute('src', star);
1994   - banner.appendChild(star1);
1995   -
1996   - var star2 = document.createElement('img');
1997   - star2.setAttribute('border', '0');
1998   - star2.setAttribute('align', 'absmiddle');
1999   - star2.setAttribute('title', '2 star');
2000   - star2.setAttribute('style', 'margin-top:-6px;margin-left:3px;cursor:pointer;');
2001   - star2.setAttribute('src', star);
2002   - banner.appendChild(star2);
2003   -
2004   - var star3 = document.createElement('img');
2005   - star3.setAttribute('border', '0');
2006   - star3.setAttribute('align', 'absmiddle');
2007   - star3.setAttribute('title', '3 star');
2008   - star3.setAttribute('style', 'margin-top:-6px;margin-left:3px;cursor:pointer;');
2009   - star3.setAttribute('src', star);
2010   - banner.appendChild(star3);
2011   -
2012   - var star4 = document.createElement('img');
2013   - star4.setAttribute('border', '0');
2014   - star4.setAttribute('align', 'absmiddle');
2015   - star4.setAttribute('title', '4 star');
2016   - star4.setAttribute('style', 'margin-top:-6px;margin-left:3px;cursor:pointer;');
2017   - star4.setAttribute('src', star);
2018   - banner.appendChild(star4);
2019   -
2020   - this.bannerShowing = true;
2021   -
2022   - var onclose = mxUtils.bind(this, function()
2023   - {
2024   - if (banner.parentNode != null)
2025   - {
2026   - banner.parentNode.removeChild(banner);
2027   - this.bannerShowing = false;
2028   -
2029   - this['hideBanner' + 'ratingFooter'] = true;
2030   -
2031   - if (isLocalStorage && mxSettings.settings != null)
2032   - {
2033   - mxSettings.settings['close' + 'ratingFooter'] = Date.now();
2034   - mxSettings.save();
2035   - }
  1671 +App.prototype.showRatingBanner = function () {
  1672 + if (!this.bannerShowing && !this['hideBanner' + 'ratingFooter'] &&
  1673 + (!isLocalStorage || mxSettings.settings == null ||
  1674 + mxSettings.settings['close' + 'ratingFooter'] == null)) {
  1675 + var banner = document.createElement('div');
  1676 + banner.style.cssText = 'position:absolute;bottom:10px;left:50%;max-width:90%;padding:18px 34px 12px 20px;' +
  1677 + 'font-size:16px;font-weight:bold;white-space:nowrap;cursor:pointer;z-index:' + mxPopupMenu.prototype.zIndex + ';';
  1678 + mxUtils.setPrefixedStyle(banner.style, 'box-shadow', '1px 1px 2px 0px #ddd');
  1679 + mxUtils.setPrefixedStyle(banner.style, 'transform', 'translate(-50%,120%)');
  1680 + mxUtils.setPrefixedStyle(banner.style, 'transition', 'all 1s ease');
  1681 + banner.className = 'geBtn gePrimaryBtn';
  1682 +
  1683 + var img = document.createElement('img');
  1684 + img.setAttribute('src', Dialog.prototype.closeImage);
  1685 + img.setAttribute('title', mxResources.get('close'));
  1686 + img.setAttribute('border', '0');
  1687 + img.style.cssText = 'position:absolute;right:10px;top:12px;filter:invert(1);padding:6px;margin:-6px;cursor:default;';
  1688 + banner.appendChild(img);
  1689 +
  1690 + var star = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZ' +
  1691 + 'XdvcmtzIENTM5jWRgMAAAQRdEVYdFhNTDpjb20uYWRvYmUueG1wADw/eHBhY2tldCBiZWdpbj0iICAgIiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+Cjx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8i' +
  1692 + 'IHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDQuMS1jMDM0IDQ2LjI3Mjk3NiwgU2F0IEphbiAyNyAyMDA3IDIyOjExOjQxICAgICAgICAiPgogICA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDI' +
  1693 + 'vMjItcmRmLXN5bnRheC1ucyMiPgogICAgICA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIgogICAgICAgICAgICB4bWxuczp4YXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iPgogICAgICAgICA8eGFwOkNyZW' +
  1694 + 'F0b3JUb29sPkFkb2JlIEZpcmV3b3JrcyBDUzM8L3hhcDpDcmVhdG9yVG9vbD4KICAgICAgICAgPHhhcDpDcmVhdGVEYXRlPjIwMDgtMDItMTdUMDI6MzY6NDVaPC94YXA6Q3JlYXRlRGF0ZT4KICAgICAgICAgPHhhcDpNb2RpZ' +
  1695 + 'nlEYXRlPjIwMDktMDMtMTdUMTQ6MTI6MDJaPC94YXA6TW9kaWZ5RGF0ZT4KICAgICAgPC9yZGY6RGVzY3JpcHRpb24+CiAgICAgIDxyZGY6RGVzY3JpcHRpb24gcmRmOmFib3V0PSIiCiAgICAgICAgICAgIHhtbG5zOmRjPSJo' +
  1696 + 'dHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyI+CiAgICAgICAgIDxkYzpmb3JtYXQ+aW1hZ2UvcG5nPC9kYzpmb3JtYXQ+CiAgICAgIDwvcmRmOkRlc2NyaXB0aW9uPgogICA8L3JkZjpSREY+CjwveDp4bXBtZXRhPgo' +
  1697 + 'gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgCiAgICAgICAgICAgICAgICAgICAgICAgICAgIC' +
  1698 + 'AgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgI' +
  1699 + 'CAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIIImu8AAAAAVdEVYdENyZWF0aW9uIFRpbWUAMi8xNy8wOCCcqlgAAAHuSURBVDiNlZJBi1JRGIbfk+fc0ZuMXorJe4XujWoMdREaA23HICj6AQeLINr0C4I27ab2' +
  1700 + '7VqOI9+q/sH8gMDceG1RkIwgClEXFMbRc5zTZgZURmG+5fu9PN/7Hg6wZohoh4h21nn4uqXW+q0xZgzg+SrPlTXX73uet+26bp6ICpcGaK1fua57M5vN3tZav7gUgIiSqVTqcRAEm0EQbCaTyQoRXb3Iy4hoG8CT6XSaY4xtMMa' +
  1701 + 'SQohMPp8v+r7vAEC3243CMGwqpfoApsaYE8uyfgM45ABOjDEvXdfNlMvlzFINAIDneY7neZVzvdlsDgaDQYtzfsjOIjtKqU+e5+0Wi0V3VV8ACMOw3+/3v3HOX0sp/7K53te11h/S6fRuoVAIhBAL76OUOm2320dRFH0VQuxJKf' +
  1702 + '8BAFu+UKvVvpRKpWe2bYt5fTweq0ajQUKIN1LK43N94SMR0Y1YLLYlhBBKqQUw51wkEol7WmuzoC8FuJtIJLaUUoii6Ljb7f4yxpz6vp9zHMe2bfvacDi8BeDHKkBuNps5rVbr52QyaVuW9ZExttHpdN73ej0/Ho+nADxYCdBaV' +
  1703 + '0aj0RGAz5ZlHUgpx2erR/V6/d1wOHwK4CGA/QsBnPN9AN+llH+WkqFare4R0QGAO/M6M8Ysey81/wGqa8MlVvHPNAAAAABJRU5ErkJggg==';
  1704 +
  1705 + mxUtils.write(banner, 'Please rate us');
  1706 + document.body.appendChild(banner);
  1707 +
  1708 + var star1 = document.createElement('img');
  1709 + star1.setAttribute('border', '0');
  1710 + star1.setAttribute('align', 'absmiddle');
  1711 + star1.setAttribute('title', '1 star');
  1712 + star1.setAttribute('style', 'margin-top:-6px;cursor:pointer;margin-left:8px;');
  1713 + star1.setAttribute('src', star);
  1714 + banner.appendChild(star1);
  1715 +
  1716 + var star2 = document.createElement('img');
  1717 + star2.setAttribute('border', '0');
  1718 + star2.setAttribute('align', 'absmiddle');
  1719 + star2.setAttribute('title', '2 star');
  1720 + star2.setAttribute('style', 'margin-top:-6px;margin-left:3px;cursor:pointer;');
  1721 + star2.setAttribute('src', star);
  1722 + banner.appendChild(star2);
  1723 +
  1724 + var star3 = document.createElement('img');
  1725 + star3.setAttribute('border', '0');
  1726 + star3.setAttribute('align', 'absmiddle');
  1727 + star3.setAttribute('title', '3 star');
  1728 + star3.setAttribute('style', 'margin-top:-6px;margin-left:3px;cursor:pointer;');
  1729 + star3.setAttribute('src', star);
  1730 + banner.appendChild(star3);
  1731 +
  1732 + var star4 = document.createElement('img');
  1733 + star4.setAttribute('border', '0');
  1734 + star4.setAttribute('align', 'absmiddle');
  1735 + star4.setAttribute('title', '4 star');
  1736 + star4.setAttribute('style', 'margin-top:-6px;margin-left:3px;cursor:pointer;');
  1737 + star4.setAttribute('src', star);
  1738 + banner.appendChild(star4);
  1739 +
  1740 + this.bannerShowing = true;
  1741 +
  1742 + var onclose = mxUtils.bind(this, function () {
  1743 + if (banner.parentNode != null) {
  1744 + banner.parentNode.removeChild(banner);
  1745 + this.bannerShowing = false;
  1746 +
  1747 + this['hideBanner' + 'ratingFooter'] = true;
  1748 +
  1749 + if (isLocalStorage && mxSettings.settings != null) {
  1750 + mxSettings.settings['close' + 'ratingFooter'] = Date.now();
  1751 + mxSettings.save();
2036 1752 }
2037   - });
  1753 + }
  1754 + });
2038 1755
2039   - mxEvent.addListener(img, 'click', mxUtils.bind(this, function(e)
2040   - {
2041   - mxEvent.consume(e);
2042   - onclose();
2043   - }));
2044   - mxEvent.addListener(star1, 'click', mxUtils.bind(this, function(e)
2045   - {
2046   - mxEvent.consume(e);
2047   - onclose();
2048   - }));
2049   - mxEvent.addListener(star2, 'click', mxUtils.bind(this, function(e)
2050   - {
2051   - mxEvent.consume(e);
2052   - onclose();
2053   - }));
2054   - mxEvent.addListener(star3, 'click', mxUtils.bind(this, function(e)
2055   - {
2056   - mxEvent.consume(e);
2057   - onclose();
2058   - }));
2059   - mxEvent.addListener(star4, 'click', mxUtils.bind(this, function(e)
2060   - {
2061   - mxEvent.consume(e);
2062   - window.open('https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-for-confluence?hosting=datacenter&tab=reviews');
2063   - onclose();
2064   - }));
  1756 + mxEvent.addListener(img, 'click', mxUtils.bind(this, function (e) {
  1757 + mxEvent.consume(e);
  1758 + onclose();
  1759 + }));
  1760 + mxEvent.addListener(star1, 'click', mxUtils.bind(this, function (e) {
  1761 + mxEvent.consume(e);
  1762 + onclose();
  1763 + }));
  1764 + mxEvent.addListener(star2, 'click', mxUtils.bind(this, function (e) {
  1765 + mxEvent.consume(e);
  1766 + onclose();
  1767 + }));
  1768 + mxEvent.addListener(star3, 'click', mxUtils.bind(this, function (e) {
  1769 + mxEvent.consume(e);
  1770 + onclose();
  1771 + }));
  1772 + mxEvent.addListener(star4, 'click', mxUtils.bind(this, function (e) {
  1773 + mxEvent.consume(e);
  1774 + window.open('https://marketplace.atlassian.com/apps/1210933/draw-io-diagrams-for-confluence?hosting=datacenter&tab=reviews');
  1775 + onclose();
  1776 + }));
2065 1777
2066   - var hide = mxUtils.bind(this, function()
2067   - {
2068   - mxUtils.setPrefixedStyle(banner.style, 'transform', 'translate(-50%,120%)');
  1778 + var hide = mxUtils.bind(this, function () {
  1779 + mxUtils.setPrefixedStyle(banner.style, 'transform', 'translate(-50%,120%)');
2069 1780
2070   - window.setTimeout(mxUtils.bind(this, function()
2071   - {
2072   - onclose();
2073   - }), 1000);
2074   - });
  1781 + window.setTimeout(mxUtils.bind(this, function () {
  1782 + onclose();
  1783 + }), 1000);
  1784 + });
2075 1785
2076   - window.setTimeout(mxUtils.bind(this, function()
2077   - {
2078   - mxUtils.setPrefixedStyle(banner.style, 'transform', 'translate(-50%,0%)');
2079   - }), 500);
  1786 + window.setTimeout(mxUtils.bind(this, function () {
  1787 + mxUtils.setPrefixedStyle(banner.style, 'transform', 'translate(-50%,0%)');
  1788 + }), 500);
2080 1789
2081   - window.setTimeout(hide, 60000);
2082   - }
  1790 + window.setTimeout(hide, 60000);
  1791 + }
2083 1792 };
2084 1793
2085 1794 /**
... ... @@ -2087,13 +1796,11 @@ App.prototype.showRatingBanner = function()
2087 1796 * IMPORTANT: Do not change this function without consulting
2088 1797 * the privacy lead. No personal information must be sent.
2089 1798 */
2090   -App.prototype.checkLicense = function()
2091   -{
  1799 +App.prototype.checkLicense = function () {
2092 1800 var driveUser = this.drive.getUser();
2093 1801 var email = (driveUser != null) ? driveUser.email : null;
2094 1802
2095   - if (!this.isOffline() && !this.editor.chromeless && email != null && driveUser.id != null)
2096   - {
  1803 + if (!this.isOffline() && !this.editor.chromeless && email != null && driveUser.id != null) {
2097 1804 // Only the domain and hashed user ID are transmitted. This code was reviewed and deemed
2098 1805 // compliant by dbenson 2021-09-01.
2099 1806 var at = email.lastIndexOf('@');
... ... @@ -2102,28 +1809,22 @@ App.prototype.checkLicense = function()
2102 1809
2103 1810 // Timestamp is workaround for cached response in certain environments
2104 1811 mxUtils.post('/license', 'domain=' + encodeURIComponent(domain) + '&id=' + encodeURIComponent(userId) +
2105   - '&ts=' + new Date().getTime(),
2106   - mxUtils.bind(this, function(req)
2107   - {
2108   - try
2109   - {
2110   - if (req.getStatus() >= 200 && req.getStatus() <= 299)
2111   - {
  1812 + '&ts=' + new Date().getTime(),
  1813 + mxUtils.bind(this, function (req) {
  1814 + try {
  1815 + if (req.getStatus() >= 200 && req.getStatus() <= 299) {
2112 1816 var value = req.getText();
2113 1817
2114   - if (value.length > 0)
2115   - {
  1818 + if (value.length > 0) {
2116 1819 var lic = JSON.parse(value);
2117 1820
2118   - if (lic != null)
2119   - {
  1821 + if (lic != null) {
2120 1822 this.handleLicense(lic, domain);
2121 1823 }
2122 1824 }
2123 1825 }
2124 1826 }
2125   - catch (e)
2126   - {
  1827 + catch (e) {
2127 1828 // ignore
2128 1829 }
2129 1830 }));
... ... @@ -2133,10 +1834,8 @@ App.prototype.checkLicense = function()
2133 1834 /**
2134 1835 * Returns true if the current domain is for the new drive app.
2135 1836 */
2136   -App.prototype.handleLicense = function(lic, domain)
2137   -{
2138   - if (lic != null && lic.plugins != null)
2139   - {
  1837 +App.prototype.handleLicense = function (lic, domain) {
  1838 + if (lic != null && lic.plugins != null) {
2140 1839 App.loadPlugins(lic.plugins.split(';'), true);
2141 1840 }
2142 1841 };
... ... @@ -2144,16 +1843,13 @@ App.prototype.handleLicense = function(lic, domain)
2144 1843 /**
2145 1844 *
2146 1845 */
2147   -App.prototype.getEditBlankXml = function()
2148   -{
  1846 +App.prototype.getEditBlankXml = function () {
2149 1847 var file = this.getCurrentFile();
2150 1848
2151   - if (file != null && this.editor.isChromelessView() && this.editor.graph.isLightboxView())
2152   - {
  1849 + if (file != null && this.editor.isChromelessView() && this.editor.graph.isLightboxView()) {
2153 1850 return file.getData();
2154 1851 }
2155   - else
2156   - {
  1852 + else {
2157 1853 return this.getFileData(true);
2158 1854 }
2159 1855 };
... ... @@ -2161,8 +1857,7 @@ App.prototype.getEditBlankXml = function()
2161 1857 /**
2162 1858 * Updates action states depending on the selection.
2163 1859 */
2164   -App.prototype.updateActionStates = function()
2165   -{
  1860 +App.prototype.updateActionStates = function () {
2166 1861 EditorUi.prototype.updateActionStates.apply(this, arguments);
2167 1862
2168 1863 this.actions.get('revisionHistory').setEnabled(this.isRevisionHistoryEnabled());
... ... @@ -2171,29 +1866,22 @@ App.prototype.updateActionStates = function()
2171 1866 /**
2172 1867 * Adds the specified entry to the recent file list in local storage
2173 1868 */
2174   -App.prototype.addRecent = function(entry)
2175   -{
2176   - if (isLocalStorage && localStorage != null)
2177   - {
  1869 +App.prototype.addRecent = function (entry) {
  1870 + if (isLocalStorage && localStorage != null) {
2178 1871 var recent = this.getRecent();
2179 1872
2180   - if (recent == null)
2181   - {
  1873 + if (recent == null) {
2182 1874 recent = [];
2183 1875 }
2184   - else
2185   - {
2186   - for (var i = 0; i < recent.length; i++)
2187   - {
2188   - if (recent[i].id == entry.id)
2189   - {
  1876 + else {
  1877 + for (var i = 0; i < recent.length; i++) {
  1878 + if (recent[i].id == entry.id) {
2190 1879 recent.splice(i, 1);
2191 1880 }
2192 1881 }
2193 1882 }
2194 1883
2195   - if (recent != null)
2196   - {
  1884 + if (recent != null) {
2197 1885 recent.unshift(entry);
2198 1886 recent = recent.slice(0, 10);
2199 1887 localStorage.setItem('.recent', JSON.stringify(recent));
... ... @@ -2204,21 +1892,16 @@ App.prototype.addRecent = function(entry)
2204 1892 /**
2205 1893 * Returns the recent file list from local storage
2206 1894 */
2207   -App.prototype.getRecent = function()
2208   -{
2209   - if (isLocalStorage && localStorage != null)
2210   - {
2211   - try
2212   - {
  1895 +App.prototype.getRecent = function () {
  1896 + if (isLocalStorage && localStorage != null) {
  1897 + try {
2213 1898 var recent = localStorage.getItem('.recent');
2214 1899
2215   - if (recent != null)
2216   - {
  1900 + if (recent != null) {
2217 1901 return JSON.parse(recent);
2218 1902 }
2219 1903 }
2220   - catch (e)
2221   - {
  1904 + catch (e) {
2222 1905 // ignore
2223 1906 }
2224 1907
... ... @@ -2229,16 +1912,12 @@ App.prototype.getRecent = function()
2229 1912 /**
2230 1913 * Clears the recent file list in local storage
2231 1914 */
2232   -App.prototype.resetRecent = function(entry)
2233   -{
2234   - if (isLocalStorage && localStorage != null)
2235   - {
2236   - try
2237   - {
  1915 +App.prototype.resetRecent = function (entry) {
  1916 + if (isLocalStorage && localStorage != null) {
  1917 + try {
2238 1918 localStorage.removeItem('.recent');
2239 1919 }
2240   - catch (e)
2241   - {
  1920 + catch (e) {
2242 1921 // ignore
2243 1922 }
2244 1923 }
... ... @@ -2247,31 +1926,24 @@ App.prototype.resetRecent = function(entry)
2247 1926 /**
2248 1927 * Sets the onbeforeunload for the application
2249 1928 */
2250   -App.prototype.onBeforeUnload = function()
2251   -{
2252   - if (urlParams['embed'] == '1' && this.editor.modified)
2253   - {
  1929 +App.prototype.onBeforeUnload = function () {
  1930 + if (urlParams['embed'] == '1' && this.editor.modified) {
2254 1931 return mxResources.get('allChangesLost');
2255 1932 }
2256   - else
2257   - {
  1933 + else {
2258 1934 var file = this.getCurrentFile();
2259 1935
2260   - if (file != null)
2261   - {
  1936 + if (file != null) {
2262 1937 // KNOWN: Message is ignored by most browsers
2263 1938 if (file.constructor == LocalFile && file.getHash() == '' && !file.isModified() &&
2264 1939 urlParams['nowarn'] != '1' && !this.isDiagramEmpty() && urlParams['url'] == null &&
2265   - !this.editor.isChromelessView() && file.fileHandle == null)
2266   - {
  1940 + !this.editor.isChromelessView() && file.fileHandle == null) {
2267 1941 return mxResources.get('ensureDataSaved');
2268 1942 }
2269   - else if (file.isModified())
2270   - {
  1943 + else if (file.isModified()) {
2271 1944 return mxResources.get('allChangesLost');
2272 1945 }
2273   - else
2274   - {
  1946 + else {
2275 1947 file.close(true);
2276 1948 }
2277 1949 }
... ... @@ -2284,26 +1956,21 @@ App.prototype.onBeforeUnload = function()
2284 1956 * @param {number} dx X-coordinate of the translation.
2285 1957 * @param {number} dy Y-coordinate of the translation.
2286 1958 */
2287   -App.prototype.updateDocumentTitle = function()
2288   -{
2289   - if (!this.editor.graph.isLightboxView())
2290   - {
  1959 +App.prototype.updateDocumentTitle = function () {
  1960 + if (!this.editor.graph.isLightboxView()) {
2291 1961 var title = this.editor.appName;
2292 1962 var file = this.getCurrentFile();
2293 1963
2294   - if (this.isOfflineApp())
2295   - {
  1964 + if (this.isOfflineApp()) {
2296 1965 title += ' app';
2297 1966 }
2298 1967
2299   - if (file != null)
2300   - {
  1968 + if (file != null) {
2301 1969 var filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename;
2302 1970 title = filename + ' - ' + title;
2303 1971 }
2304 1972
2305   - if (document.title != title)
2306   - {
  1973 + if (document.title != title) {
2307 1974 document.title = title;
2308 1975 var graph = this.editor.graph;
2309 1976 graph.invalidateDescendantsWithPlaceholders(graph.model.getRoot());
... ... @@ -2315,32 +1982,26 @@ App.prototype.updateDocumentTitle = function()
2315 1982 /**
2316 1983 * Returns a thumbnail of the current file.
2317 1984 */
2318   -App.prototype.getThumbnail = function(width, fn)
2319   -{
  1985 +App.prototype.getThumbnail = function (width, fn) {
2320 1986 var result = false;
2321 1987
2322   - try
2323   - {
  1988 + try {
2324 1989 var acceptResponse = true;
2325 1990
2326   - var timeoutThread = window.setTimeout(mxUtils.bind(this, function()
2327   - {
  1991 + var timeoutThread = window.setTimeout(mxUtils.bind(this, function () {
2328 1992 acceptResponse = false;
2329 1993 fn(null);
2330 1994 }), this.timeout);
2331 1995
2332   - var success = mxUtils.bind(this, function(canvas)
2333   - {
  1996 + var success = mxUtils.bind(this, function (canvas) {
2334 1997 window.clearTimeout(timeoutThread);
2335 1998
2336   - if (acceptResponse)
2337   - {
  1999 + if (acceptResponse) {
2338 2000 fn(canvas);
2339 2001 }
2340 2002 });
2341 2003
2342   - if (this.thumbImageCache == null)
2343   - {
  2004 + if (this.thumbImageCache == null) {
2344 2005 this.thumbImageCache = new Object();
2345 2006 }
2346 2007
... ... @@ -2352,31 +2013,25 @@ App.prototype.getThumbnail = function(width, fn)
2352 2013 // To avoid refresh during save dark theme uses separate graph instance
2353 2014 var darkTheme = graph.themes != null && graph.defaultThemeName == 'darkTheme';
2354 2015
2355   - if (this.pages != null && (darkTheme || this.currentPage != this.pages[0]))
2356   - {
  2016 + if (this.pages != null && (darkTheme || this.currentPage != this.pages[0])) {
2357 2017 var graphGetGlobalVariable = graph.getGlobalVariable;
2358 2018 graph = this.createTemporaryGraph(graph.getStylesheet());
2359 2019 graph.setBackgroundImage = this.editor.graph.setBackgroundImage;
2360 2020 var page = this.pages[0];
2361 2021
2362   - if (this.currentPage == page)
2363   - {
  2022 + if (this.currentPage == page) {
2364 2023 graph.setBackgroundImage(bgImg);
2365 2024 }
2366   - else if (page.viewState != null && page.viewState != null)
2367   - {
  2025 + else if (page.viewState != null && page.viewState != null) {
2368 2026 bgImg = page.viewState.backgroundImage;
2369 2027 graph.setBackgroundImage(bgImg);
2370 2028 }
2371 2029
2372   - graph.getGlobalVariable = function(name)
2373   - {
2374   - if (name == 'page')
2375   - {
  2030 + graph.getGlobalVariable = function (name) {
  2031 + if (name == 'page') {
2376 2032 return page.getName();
2377 2033 }
2378   - else if (name == 'pagenumber')
2379   - {
  2034 + else if (name == 'pagenumber') {
2380 2035 return 1;
2381 2036 }
2382 2037
... ... @@ -2389,42 +2044,34 @@ App.prototype.getThumbnail = function(width, fn)
2389 2044 }
2390 2045
2391 2046 // Uses client-side canvas export
2392   - if (mxClient.IS_CHROMEAPP || this.useCanvasForExport)
2393   - {
2394   - this.editor.exportToCanvas(mxUtils.bind(this, function(canvas)
2395   - {
2396   - try
2397   - {
2398   - // Removes temporary graph from DOM
2399   - if (graph != this.editor.graph && graph.container.parentNode != null)
2400   - {
  2047 + if (mxClient.IS_CHROMEAPP || this.useCanvasForExport) {
  2048 + this.editor.exportToCanvas(mxUtils.bind(this, function (canvas) {
  2049 + try {
  2050 + // Removes temporary graph from DOM
  2051 + if (graph != this.editor.graph && graph.container.parentNode != null) {
2401 2052 graph.container.parentNode.removeChild(graph.container);
2402 2053 }
2403 2054 }
2404   - catch (e)
2405   - {
  2055 + catch (e) {
2406 2056 canvas = null;
2407 2057 }
2408 2058
2409   - success(canvas);
2410   - }), width, this.thumbImageCache, '#ffffff', function()
2411   - {
2412   - // Continues with null in error case
2413   - success();
2414   - }, null, null, null, null, null, null, graph, null, null, null,
2415   - null, 'diagram', null);
  2059 + success(canvas);
  2060 + }), width, this.thumbImageCache, '#ffffff', function () {
  2061 + // Continues with null in error case
  2062 + success();
  2063 + }, null, null, null, null, null, null, graph, null, null, null,
  2064 + null, 'diagram', null);
2416 2065
2417   - result = true;
  2066 + result = true;
2418 2067 }
2419   - else if (this.canvasSupported && this.getCurrentFile() != null)
2420   - {
  2068 + else if (this.canvasSupported && this.getCurrentFile() != null) {
2421 2069 var canvas = document.createElement('canvas');
2422 2070 var bounds = graph.getGraphBounds();
2423 2071 var t = graph.view.translate;
2424 2072 var s = graph.view.scale;
2425 2073
2426   - if (bgImg != null)
2427   - {
  2074 + if (bgImg != null) {
2428 2075 bounds = mxRectangle.fromRectangle(bounds);
2429 2076 bounds.add(new mxRectangle(
2430 2077 (t.x + bgImg.x) * s, (t.y + bgImg.y) * s,
... ... @@ -2451,8 +2098,7 @@ App.prototype.getThumbnail = function(width, fn)
2451 2098 // Paint white background instead of transparent
2452 2099 var bg = graph.background;
2453 2100
2454   - if (bg == null || bg == '' || bg == mxConstants.NONE)
2455   - {
  2101 + if (bg == null || bg == '' || bg == mxConstants.NONE) {
2456 2102 bg = '#ffffff';
2457 2103 }
2458 2104
... ... @@ -2463,8 +2109,7 @@ App.prototype.getThumbnail = function(width, fn)
2463 2109 ctx.restore();
2464 2110
2465 2111 // Paints background image
2466   - if (bgImg != null)
2467   - {
  2112 + if (bgImg != null) {
2468 2113 var img = new Image();
2469 2114 img.src = bgImg.src;
2470 2115
... ... @@ -2486,10 +2131,8 @@ App.prototype.getThumbnail = function(width, fn)
2486 2131 // Render graph
2487 2132 var imgExport = new mxImageExport();
2488 2133
2489   - imgExport.drawShape = function(state, canvas)
2490   - {
2491   - if (state.shape instanceof mxShape && state.shape.checkBounds())
2492   - {
  2134 + imgExport.drawShape = function (state, canvas) {
  2135 + if (state.shape instanceof mxShape && state.shape.checkBounds()) {
2493 2136 canvas.save();
2494 2137 canvas.translate(0.5, 0.5);
2495 2138 state.shape.paint(canvas);
... ... @@ -2498,27 +2141,22 @@ App.prototype.getThumbnail = function(width, fn)
2498 2141 }
2499 2142 };
2500 2143
2501   - imgExport.drawText = function(state, canvas)
2502   - {
  2144 + imgExport.drawText = function (state, canvas) {
2503 2145 // No text output for thumbnails
2504 2146 };
2505 2147
2506 2148 imgExport.drawState(graph.getView().getState(graph.model.root), asynCanvas);
2507 2149
2508   - asynCanvas.finish(mxUtils.bind(this, function()
2509   - {
2510   - try
2511   - {
  2150 + asynCanvas.finish(mxUtils.bind(this, function () {
  2151 + try {
2512 2152 imgExport.drawState(graph.getView().getState(graph.model.root), htmlCanvas);
2513 2153
2514   - // Removes temporary graph from DOM
2515   - if (graph != this.editor.graph && graph.container.parentNode != null)
2516   - {
  2154 + // Removes temporary graph from DOM
  2155 + if (graph != this.editor.graph && graph.container.parentNode != null) {
2517 2156 graph.container.parentNode.removeChild(graph.container);
2518 2157 }
2519 2158 }
2520   - catch (e)
2521   - {
  2159 + catch (e) {
2522 2160 canvas = null;
2523 2161 }
2524 2162
... ... @@ -2528,19 +2166,16 @@ App.prototype.getThumbnail = function(width, fn)
2528 2166 result = true;
2529 2167 }
2530 2168 }
2531   - catch (e)
2532   - {
  2169 + catch (e) {
2533 2170 result = false;
2534 2171
2535 2172 // Removes temporary graph from DOM
2536   - if (graph != null && graph != this.editor.graph && graph.container.parentNode != null)
2537   - {
  2173 + if (graph != null && graph != this.editor.graph && graph.container.parentNode != null) {
2538 2174 graph.container.parentNode.removeChild(graph.container);
2539 2175 }
2540 2176 }
2541 2177
2542   - if (!result)
2543   - {
  2178 + if (!result) {
2544 2179 window.clearTimeout(timeoutThread);
2545 2180 }
2546 2181
... ... @@ -2553,8 +2188,7 @@ App.prototype.getThumbnail = function(width, fn)
2553 2188 * @param {number} dx X-coordinate of the translation.
2554 2189 * @param {number} dy Y-coordinate of the translation.
2555 2190 */
2556   -App.prototype.createBackground = function()
2557   -{
  2191 +App.prototype.createBackground = function () {
2558 2192 var bg = this.createDiv('background');
2559 2193 bg.style.position = 'absolute';
2560 2194 bg.style.background = 'white';
... ... @@ -2574,65 +2208,52 @@ App.prototype.createBackground = function()
2574 2208 * @param {number} dx X-coordinate of the translation.
2575 2209 * @param {number} dy Y-coordinate of the translation.
2576 2210 */
2577   -(function()
2578   -{
  2211 +(function () {
2579 2212 var editorUiSetMode = EditorUi.prototype.setMode;
2580 2213
2581   - App.prototype.setMode = function(mode, remember)
2582   - {
  2214 + App.prototype.setMode = function (mode, remember) {
2583 2215 editorUiSetMode.apply(this, arguments);
2584 2216
2585 2217 // Note: UseLocalStorage affects the file dialogs
2586 2218 // and should not be modified if mode is undefined
2587   - if (this.mode != null)
2588   - {
  2219 + if (this.mode != null) {
2589 2220 Editor.useLocalStorage = this.mode == App.MODE_BROWSER;
2590 2221 }
2591 2222
2592   - if (this.appIcon != null)
2593   - {
  2223 + if (this.appIcon != null) {
2594 2224 var file = this.getCurrentFile();
2595 2225 mode = (file != null) ? file.getMode() : mode;
2596 2226
2597   - if (mode == App.MODE_GOOGLE)
2598   - {
  2227 + if (mode == App.MODE_GOOGLE) {
2599 2228 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('googleDrive')]));
2600 2229 this.appIcon.style.cursor = 'pointer';
2601 2230 }
2602   - else if (mode == App.MODE_DROPBOX)
2603   - {
  2231 + else if (mode == App.MODE_DROPBOX) {
2604 2232 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('dropbox')]));
2605 2233 this.appIcon.style.cursor = 'pointer';
2606 2234 }
2607   - else if (mode == App.MODE_ONEDRIVE)
2608   - {
  2235 + else if (mode == App.MODE_ONEDRIVE) {
2609 2236 this.appIcon.setAttribute('title', mxResources.get('openIt', [mxResources.get('oneDrive')]));
2610 2237 this.appIcon.style.cursor = 'pointer';
2611 2238 }
2612   - else
2613   - {
  2239 + else {
2614 2240 this.appIcon.removeAttribute('title');
2615 2241 this.appIcon.style.cursor = (mode == App.MODE_DEVICE) ? 'pointer' : 'default';
2616 2242 }
2617 2243 }
2618 2244
2619   - if (remember)
2620   - {
2621   - try
2622   - {
2623   - if (isLocalStorage)
2624   - {
  2245 + if (remember) {
  2246 + try {
  2247 + if (isLocalStorage) {
2625 2248 localStorage.setItem('.mode', mode);
2626 2249 }
2627   - else if (typeof(Storage) != 'undefined')
2628   - {
  2250 + else if (typeof (Storage) != 'undefined') {
2629 2251 var expiry = new Date();
2630 2252 expiry.setYear(expiry.getFullYear() + 1);
2631 2253 document.cookie = 'MODE=' + mode + '; expires=' + expiry.toUTCString();
2632 2254 }
2633 2255 }
2634   - catch (e)
2635   - {
  2256 + catch (e) {
2636 2257 // ignore possible access denied
2637 2258 }
2638 2259 }
... ... @@ -2644,99 +2265,76 @@ App.prototype.createBackground = function()
2644 2265 *
2645 2266 * Authorizes the client, gets the userId and calls <open>.
2646 2267 */
2647   -App.prototype.appIconClicked = function(evt)
2648   -{
2649   - if (mxEvent.isAltDown(evt))
2650   - {
  2268 +App.prototype.appIconClicked = function (evt) {
  2269 + if (mxEvent.isAltDown(evt)) {
2651 2270 this.showSplash(true);
2652 2271 }
2653   - else
2654   - {
  2272 + else {
2655 2273 var file = this.getCurrentFile();
2656 2274 var mode = (file != null) ? file.getMode() : null;
2657 2275
2658   - if (mode == App.MODE_GOOGLE)
2659   - {
  2276 + if (mode == App.MODE_GOOGLE) {
2660 2277 if (file != null && file.desc != null && file.desc.parents != null &&
2661   - file.desc.parents.length > 0 && !mxEvent.isShiftDown(evt))
2662   - {
  2278 + file.desc.parents.length > 0 && !mxEvent.isShiftDown(evt)) {
2663 2279 // Opens containing folder
2664 2280 this.openLink('https://drive.google.com/drive/folders/' + file.desc.parents[0].id);
2665 2281 }
2666   - else if (file != null && file.getId() != null)
2667   - {
  2282 + else if (file != null && file.getId() != null) {
2668 2283 this.openLink('https://drive.google.com/open?id=' + file.getId());
2669 2284 }
2670   - else
2671   - {
  2285 + else {
2672 2286 this.openLink('https://drive.google.com/?authuser=0');
2673 2287 }
2674 2288 }
2675   - else if (mode == App.MODE_ONEDRIVE)
2676   - {
2677   - if (file != null && file.meta != null && file.meta.webUrl != null)
2678   - {
  2289 + else if (mode == App.MODE_ONEDRIVE) {
  2290 + if (file != null && file.meta != null && file.meta.webUrl != null) {
2679 2291 var url = file.meta.webUrl;
2680 2292 var name = encodeURIComponent(file.meta.name);
2681 2293
2682   - if (url.substring(url.length - name.length, url.length) == name)
2683   - {
  2294 + if (url.substring(url.length - name.length, url.length) == name) {
2684 2295 url = url.substring(0, url.length - name.length);
2685 2296 }
2686 2297
2687 2298 this.openLink(url);
2688 2299 }
2689   - else
2690   - {
  2300 + else {
2691 2301 this.openLink('https://onedrive.live.com/');
2692 2302 }
2693 2303 }
2694   - else if (mode == App.MODE_DROPBOX)
2695   - {
2696   - if (file != null && file.stat != null && file.stat.path_display != null)
2697   - {
  2304 + else if (mode == App.MODE_DROPBOX) {
  2305 + if (file != null && file.stat != null && file.stat.path_display != null) {
2698 2306 var url = 'https://www.dropbox.com/home/Apps/drawio' + file.stat.path_display;
2699 2307
2700   - if (!mxEvent.isShiftDown(evt))
2701   - {
  2308 + if (!mxEvent.isShiftDown(evt)) {
2702 2309 url = url.substring(0, url.length - file.stat.name.length);
2703 2310 }
2704 2311
2705 2312 this.openLink(url);
2706 2313 }
2707   - else
2708   - {
  2314 + else {
2709 2315 this.openLink('https://www.dropbox.com/');
2710 2316 }
2711 2317 }
2712   - else if (mode == App.MODE_TRELLO)
2713   - {
  2318 + else if (mode == App.MODE_TRELLO) {
2714 2319 this.openLink('https://trello.com/');
2715 2320 }
2716   - else if (mode == App.MODE_GITHUB)
2717   - {
2718   - if (file != null && file.constructor == GitHubFile)
2719   - {
  2321 + else if (mode == App.MODE_GITHUB) {
  2322 + if (file != null && file.constructor == GitHubFile) {
2720 2323 this.openLink(file.meta.html_url);
2721 2324 }
2722   - else
2723   - {
  2325 + else {
2724 2326 this.openLink('https://github.com/');
2725 2327 }
2726 2328 }
2727   - else if (mode == App.MODE_GITLAB)
2728   - {
2729   - if (file != null && file.constructor == GitLabFile)
2730   - {
  2329 + else if (mode == App.MODE_GITLAB) {
  2330 + if (file != null && file.constructor == GitLabFile) {
2731 2331 this.openLink(file.meta.html_url);
2732 2332 }
2733   - else
2734   - {
  2333 + else {
2735 2334 this.openLink(DRAWIO_GITLAB_URL);
2736 2335 }
2737 2336 }
2738   - else if (mode == App.MODE_DEVICE)
2739   - {
  2337 + else if (mode == App.MODE_DEVICE) {
2740 2338 this.openLink('https://get.draw.io/');
2741 2339 }
2742 2340 }
... ... @@ -2749,14 +2347,11 @@ App.prototype.appIconClicked = function(evt)
2749 2347 *
2750 2348 * Authorizes the client, gets the userId and calls <open>.
2751 2349 */
2752   -App.prototype.clearMode = function()
2753   -{
2754   - if (isLocalStorage)
2755   - {
  2350 +App.prototype.clearMode = function () {
  2351 + if (isLocalStorage) {
2756 2352 localStorage.removeItem('.mode');
2757 2353 }
2758   - else if (typeof(Storage) != 'undefined')
2759   - {
  2354 + else if (typeof (Storage) != 'undefined') {
2760 2355 var expiry = new Date();
2761 2356 expiry.setYear(expiry.getFullYear() - 1);
2762 2357 document.cookie = 'MODE=; expires=' + expiry.toUTCString();
... ... @@ -2769,23 +2364,19 @@ App.prototype.clearMode = function()
2769 2364 * @param {number} dx X-coordinate of the translation.
2770 2365 * @param {number} dy Y-coordinate of the translation.
2771 2366 */
2772   -App.prototype.getDiagramId = function()
2773   -{
  2367 +App.prototype.getDiagramId = function () {
2774 2368 var id = window.location.hash;
2775 2369
2776 2370 // Strips the hash sign
2777   - if (id != null && id.length > 0)
2778   - {
  2371 + if (id != null && id.length > 0) {
2779 2372 id = id.substring(1);
2780 2373 }
2781 2374
2782 2375 // Workaround for Trello client appending data after hash
2783   - if (id != null && id.length > 1 && id.charAt(0) == 'T')
2784   - {
  2376 + if (id != null && id.length > 1 && id.charAt(0) == 'T') {
2785 2377 var idx = id.indexOf('#');
2786 2378
2787   - if (idx > 0)
2788   - {
  2379 + if (idx > 0) {
2789 2380 id = id.substring(0, idx);
2790 2381 }
2791 2382 }
... ... @@ -2796,48 +2387,38 @@ App.prototype.getDiagramId = function()
2796 2387 /**
2797 2388 * Opens any file specified in the URL parameters.
2798 2389 */
2799   -App.prototype.open = function()
2800   -{
  2390 +App.prototype.open = function () {
2801 2391 // Cross-domain window access is not allowed in FF, so if we
2802 2392 // were opened from another domain then this will fail.
2803   - try
2804   - {
  2393 + try {
2805 2394 // If the create URL param is used in embed mode then
2806 2395 // we try to open the XML from window.opener[value].
2807 2396 // Use this for embedding via tab to bypass the timing
2808 2397 // issues when passing messages without onload event.
2809   - if (window.opener != null)
2810   - {
  2398 + if (window.opener != null) {
2811 2399 var value = urlParams['create'];
2812 2400
2813   - if (value != null)
2814   - {
  2401 + if (value != null) {
2815 2402 value = decodeURIComponent(value);
2816 2403 }
2817 2404
2818 2405 if (value != null && value.length > 0 && value.substring(0, 7) != 'http://' &&
2819   - value.substring(0, 8) != 'https://')
2820   - {
  2406 + value.substring(0, 8) != 'https://') {
2821 2407 var doc = mxUtils.parseXml(window.opener[value]);
2822 2408 this.editor.setGraphXml(doc.documentElement);
2823 2409 }
2824   - else if (window.opener.openFile != null)
2825   - {
2826   - window.opener.openFile.setConsumer(mxUtils.bind(this, function(xml, filename, temp)
2827   - {
  2410 + else if (window.opener.openFile != null) {
  2411 + window.opener.openFile.setConsumer(mxUtils.bind(this, function (xml, filename, temp) {
2828 2412 this.spinner.stop();
2829 2413
2830   - if (filename == null)
2831   - {
  2414 + if (filename == null) {
2832 2415 var title = urlParams['title'];
2833 2416 temp = true;
2834 2417
2835   - if (title != null)
2836   - {
  2418 + if (title != null) {
2837 2419 filename = decodeURIComponent(title);
2838 2420 }
2839   - else
2840   - {
  2421 + else {
2841 2422 filename = this.defaultFilename;
2842 2423 }
2843 2424 }
... ... @@ -2845,8 +2426,7 @@ App.prototype.open = function()
2845 2426 // Replaces PNG with XML extension
2846 2427 var dot = (!this.useCanvasForExport) ? filename.substring(filename.length - 4) == '.png' : -1;
2847 2428
2848   - if (dot > 0)
2849   - {
  2429 + if (dot > 0) {
2850 2430 filename = filename.substring(0, filename.length - 4) + '.drawio';
2851 2431 }
2852 2432
... ... @@ -2857,17 +2437,14 @@ App.prototype.open = function()
2857 2437 }
2858 2438 }
2859 2439 }
2860   - catch(e)
2861   - {
  2440 + catch (e) {
2862 2441 // ignore
2863 2442 }
2864 2443 };
2865 2444
2866   -App.prototype.loadGapi = function(then)
2867   -{
2868   - if (typeof gapi !== 'undefined')
2869   - {
2870   - gapi.load(((urlParams['picker'] != '0') ? 'picker,': '') + App.GOOGLE_APIS, then);
  2445 +App.prototype.loadGapi = function (then) {
  2446 + if (typeof gapi !== 'undefined') {
  2447 + gapi.load(((urlParams['picker'] != '0') ? 'picker,' : '') + App.GOOGLE_APIS, then);
2871 2448 }
2872 2449 };
2873 2450
... ... @@ -2877,19 +2454,14 @@ App.prototype.loadGapi = function(then)
2877 2454 * @param {number} dx X-coordinate of the translation.
2878 2455 * @param {number} dy Y-coordinate of the translation.
2879 2456 */
2880   -App.prototype.load = function()
2881   -{
  2457 +App.prototype.load = function () {
2882 2458 // Checks if we're running in embedded mode
2883   - if (urlParams['embed'] != '1')
2884   - {
2885   - if (this.spinner.spin(document.body, mxResources.get('starting')))
2886   - {
2887   - try
2888   - {
  2459 + if (urlParams['embed'] != '1') {
  2460 + if (this.spinner.spin(document.body, mxResources.get('starting'))) {
  2461 + try {
2889 2462 this.stateArg = (urlParams['state'] != null && this.drive != null) ? JSON.parse(decodeURIComponent(urlParams['state'])) : null;
2890 2463 }
2891   - catch (e)
2892   - {
  2464 + catch (e) {
2893 2465 // ignores invalid state args
2894 2466 }
2895 2467
... ... @@ -2897,46 +2469,37 @@ App.prototype.load = function()
2897 2469
2898 2470 // Passes the userId from the state parameter to the client
2899 2471 if ((window.location.hash == null || window.location.hash.length == 0) &&
2900   - this.drive != null && this.stateArg != null && this.stateArg.userId != null)
2901   - {
  2472 + this.drive != null && this.stateArg != null && this.stateArg.userId != null) {
2902 2473 this.drive.setUserId(this.stateArg.userId);
2903 2474 }
2904 2475
2905 2476 // Legacy support for fileId parameter which is moved to the hash tag
2906   - if (urlParams['fileId'] != null)
2907   - {
  2477 + if (urlParams['fileId'] != null) {
2908 2478 window.location.hash = 'G' + urlParams['fileId'];
2909 2479 window.location.search = this.getSearch(['fileId']);
2910 2480 }
2911   - else
2912   - {
  2481 + else {
2913 2482 // Asynchronous or disabled loading of client
2914   - if (this.drive == null)
2915   - {
2916   - if (this.mode == App.MODE_GOOGLE)
2917   - {
  2483 + if (this.drive == null) {
  2484 + if (this.mode == App.MODE_GOOGLE) {
2918 2485 this.mode = null;
2919 2486 }
2920 2487
2921 2488 this.start();
2922 2489 }
2923   - else
2924   - {
2925   - this.loadGapi(mxUtils.bind(this, function()
2926   - {
  2490 + else {
  2491 + this.loadGapi(mxUtils.bind(this, function () {
2927 2492 this.start();
2928 2493 }));
2929 2494 }
2930 2495 }
2931 2496 }
2932 2497 }
2933   - else
2934   - {
  2498 + else {
2935 2499 this.restoreLibraries();
2936 2500
2937   - if (urlParams['gapi'] == '1')
2938   - {
2939   - this.loadGapi(function() {});
  2501 + if (urlParams['gapi'] == '1') {
  2502 + this.loadGapi(function () { });
2940 2503 }
2941 2504 }
2942 2505 };
... ... @@ -2944,31 +2507,26 @@ App.prototype.load = function()
2944 2507 /**
2945 2508 * Adds the listener for automatically saving the diagram for local changes.
2946 2509 */
2947   -App.prototype.showRefreshDialog = function(title, message)
2948   -{
2949   - if (!this.showingRefreshDialog)
2950   - {
  2510 +App.prototype.showRefreshDialog = function (title, message) {
  2511 + if (!this.showingRefreshDialog) {
2951 2512 this.showingRefreshDialog = true;
2952 2513
2953 2514 this.showError(title || mxResources.get('externalChanges'),
2954 2515 message || mxResources.get('redirectToNewApp'),
2955   - mxResources.get('refresh'), mxUtils.bind(this, function()
2956   - {
2957   - var file = this.getCurrentFile();
  2516 + mxResources.get('refresh'), mxUtils.bind(this, function () {
  2517 + var file = this.getCurrentFile();
2958 2518
2959   - if (file != null)
2960   - {
2961   - file.setModified(false);
2962   - }
  2519 + if (file != null) {
  2520 + file.setModified(false);
  2521 + }
2963 2522
2964   - this.spinner.spin(document.body, mxResources.get('connecting'));
2965   - this.editor.graph.setEnabled(false);
2966   - window.location.reload();
2967   - }), null, null, null, null, null, 340, 180);
  2523 + this.spinner.spin(document.body, mxResources.get('connecting'));
  2524 + this.editor.graph.setEnabled(false);
  2525 + window.location.reload();
  2526 + }), null, null, null, null, null, 340, 180);
2968 2527
2969 2528 // Adds important notice to dialog
2970   - if (this.dialog != null && this.dialog.container != null)
2971   - {
  2529 + if (this.dialog != null && this.dialog.container != null) {
2972 2530 var alert = this.createRealtimeNotice();
2973 2531 alert.style.left = '0';
2974 2532 alert.style.right = '0';
... ... @@ -2986,10 +2544,8 @@ App.prototype.showRefreshDialog = function(title, message)
2986 2544 /**
2987 2545 * Called in start after the spinner stops.
2988 2546 */
2989   -App.prototype.showAlert = function(message)
2990   -{
2991   - if (message != null && message.length > 0)
2992   - {
  2547 +App.prototype.showAlert = function (message) {
  2548 + if (message != null && message.length > 0) {
2993 2549 var div = document.createElement('div');
2994 2550 div.className = 'geAlert';
2995 2551 div.style.zIndex = 2e9;
... ... @@ -3013,10 +2569,8 @@ App.prototype.showAlert = function(message)
3013 2569 close.innerHTML = mxResources.get('close');
3014 2570 div.appendChild(close);
3015 2571
3016   - mxEvent.addListener(close, 'click', function(evt)
3017   - {
3018   - if (div.parentNode != null)
3019   - {
  2572 + mxEvent.addListener(close, 'click', function (evt) {
  2573 + if (div.parentNode != null) {
3020 2574 div.parentNode.removeChild(div);
3021 2575 mxEvent.consume(evt);
3022 2576 }
... ... @@ -3025,21 +2579,17 @@ App.prototype.showAlert = function(message)
3025 2579 document.body.appendChild(div);
3026 2580
3027 2581 // Delayed to get smoother animation after DOM rendering
3028   - window.setTimeout(function()
3029   - {
  2582 + window.setTimeout(function () {
3030 2583 div.style.top = '30px';
3031 2584 }, 10);
3032 2585
3033 2586 // Fades out the alert after 15 secs
3034   - window.setTimeout(function()
3035   - {
  2587 + window.setTimeout(function () {
3036 2588 mxUtils.setPrefixedStyle(div.style, 'transition', 'all 2s ease');
3037 2589 div.style.opacity = '0';
3038 2590
3039   - window.setTimeout(function()
3040   - {
3041   - if (div.parentNode != null)
3042   - {
  2591 + window.setTimeout(function () {
  2592 + if (div.parentNode != null) {
3043 2593 div.parentNode.removeChild(div);
3044 2594 }
3045 2595 }, 2000);
... ... @@ -3053,48 +2603,38 @@ App.prototype.showAlert = function(message)
3053 2603 * @param {number} dx X-coordinate of the translation.
3054 2604 * @param {number} dy Y-coordinate of the translation.
3055 2605 */
3056   -App.prototype.start = function()
3057   -{
3058   - if (this.bg != null && this.bg.parentNode != null)
3059   - {
  2606 +App.prototype.start = function () {
  2607 + if (this.bg != null && this.bg.parentNode != null) {
3060 2608 this.bg.parentNode.removeChild(this.bg);
3061 2609 }
3062 2610
3063 2611 this.restoreLibraries();
3064 2612 this.spinner.stop();
3065 2613
3066   - try
3067   - {
  2614 + try {
3068 2615 // Handles all errors
3069 2616 var ui = this;
3070 2617
3071   - window.onerror = function(message, url, linenumber, colno, err)
3072   - {
  2618 + window.onerror = function (message, url, linenumber, colno, err) {
3073 2619 // Ignores Grammarly error [1344]
3074   - if (message != 'ResizeObserver loop limit exceeded')
3075   - {
  2620 + if (message != 'ResizeObserver loop limit exceeded') {
3076 2621 EditorUi.logError('Uncaught: ' + ((message != null) ? message : ''),
3077 2622 url, linenumber, colno, err, null, true);
3078   - ui.handleError({message: message}, mxResources.get('unknownError'),
  2623 + ui.handleError({ message: message }, mxResources.get('unknownError'),
3079 2624 null, null, null, null, true);
3080 2625 }
3081 2626 };
3082 2627
3083 2628 // Listens to changes of the hash if not in embed or client mode
3084   - if (urlParams['client'] != '1' && urlParams['embed'] != '1')
3085   - {
  2629 + if (urlParams['client'] != '1' && urlParams['embed'] != '1') {
3086 2630 // Installs listener to claim current draft if there is one
3087   - try
3088   - {
3089   - if (isLocalStorage)
3090   - {
3091   - window.addEventListener('storage', mxUtils.bind(this, function(evt)
3092   - {
  2631 + try {
  2632 + if (isLocalStorage) {
  2633 + window.addEventListener('storage', mxUtils.bind(this, function (evt) {
3093 2634 var file = this.getCurrentFile();
3094 2635 EditorUi.debug('storage event', [evt], [file]);
3095 2636
3096   - if (file != null && evt.key == '.draft-alive-check' && evt.newValue != null && file.draftId != null)
3097   - {
  2637 + if (file != null && evt.key == '.draft-alive-check' && evt.newValue != null && file.draftId != null) {
3098 2638 this.draftAliveCheck = evt.newValue;
3099 2639 file.saveDraft();
3100 2640 }
... ... @@ -3103,36 +2643,28 @@ App.prototype.start = function()
3103 2643
3104 2644 if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp && !this.isOfflineApp() &&
3105 2645 urlParams['open'] == null && /www\.draw\.io$/.test(window.location.hostname) &&
3106   - (!this.editor.chromeless || this.editor.editable))
3107   - {
  2646 + (!this.editor.chromeless || this.editor.editable)) {
3108 2647 this.showNameChangeBanner();
3109 2648 }
3110 2649 }
3111   - catch (e)
3112   - {
  2650 + catch (e) {
3113 2651 // ignore
3114 2652 }
3115 2653
3116   - mxEvent.addListener(window, 'hashchange', mxUtils.bind(this, function(evt)
3117   - {
3118   - try
3119   - {
  2654 + mxEvent.addListener(window, 'hashchange', mxUtils.bind(this, function (evt) {
  2655 + try {
3120 2656 this.hideDialog();
3121 2657 var id = this.getDiagramId();
3122 2658 var file = this.getCurrentFile();
3123 2659
3124   - if (file == null || file.getHash() != id)
3125   - {
  2660 + if (file == null || file.getHash() != id) {
3126 2661 this.loadFile(id, true);
3127 2662 }
3128 2663 }
3129   - catch (e)
3130   - {
  2664 + catch (e) {
3131 2665 // Workaround for possible scrollWidth of null in Dialog ctor
3132   - if (document.body != null)
3133   - {
3134   - this.handleError(e, mxResources.get('errorLoadingFile'), mxUtils.bind(this, function()
3135   - {
  2666 + if (document.body != null) {
  2667 + this.handleError(e, mxResources.get('errorLoadingFile'), mxUtils.bind(this, function () {
3136 2668 var file = this.getCurrentFile();
3137 2669 window.location.hash = (file != null) ? file.getHash() : '';
3138 2670 }));
... ... @@ -3142,61 +2674,47 @@ App.prototype.start = function()
3142 2674 }
3143 2675
3144 2676 // Descriptor for CSV import
3145   - if ((window.location.hash == null || window.location.hash.length <= 1) && urlParams['desc'] != null)
3146   - {
3147   - try
3148   - {
  2677 + if ((window.location.hash == null || window.location.hash.length <= 1) && urlParams['desc'] != null) {
  2678 + try {
3149 2679 this.loadDescriptor(JSON.parse(Graph.decompress(urlParams['desc'])),
3150   - null, mxUtils.bind(this, function(e)
3151   - {
3152   - this.handleError(e, mxResources.get('errorLoadingFile'));
3153   - }));
  2680 + null, mxUtils.bind(this, function (e) {
  2681 + this.handleError(e, mxResources.get('errorLoadingFile'));
  2682 + }));
3154 2683 }
3155   - catch (e)
3156   - {
  2684 + catch (e) {
3157 2685 this.handleError(e, mxResources.get('errorLoadingFile'));
3158 2686 }
3159 2687 }
3160 2688 // Redirects old url URL parameter to new #U format
3161 2689 // 文件加载
3162   - else if ((window.location.hash == null || window.location.hash.length <= 1) && urlParams['url'] != null)
3163   - {
  2690 + else if ((window.location.hash == null || window.location.hash.length <= 1) && urlParams['url'] != null) {
3164 2691 this.loadFile('U' + urlParams['url'], true);
3165 2692 }
3166 2693 //为null时,通过弹出文件框,选择加载文件加载
3167   - else if (this.getCurrentFile() == null)
3168   - {
3169   - var done = mxUtils.bind(this, function()
3170   - {
  2694 + else if (this.getCurrentFile() == null) {
  2695 + var done = mxUtils.bind(this, function () {
3171 2696 // Starts in client mode and waits for data
3172 2697 if (urlParams['client'] == '1' && (window.location.hash == null ||
3173   - window.location.hash.length == 0 || window.location.hash.substring(0, 2) == '#P'))
3174   - {
3175   - var doLoadFile = mxUtils.bind(this, function(xml)
3176   - {
  2698 + window.location.hash.length == 0 || window.location.hash.substring(0, 2) == '#P')) {
  2699 + var doLoadFile = mxUtils.bind(this, function (xml) {
3177 2700 // Extracts graph model from PNG
3178   - if (Editor.isPngDataUrl(xml))
3179   - {
  2701 + if (Editor.isPngDataUrl(xml)) {
3180 2702 xml = Editor.extractGraphModelFromPng(xml);
3181 2703 }
3182 2704
3183 2705 var title = urlParams['title'];
3184 2706
3185   - if (title != null)
3186   - {
  2707 + if (title != null) {
3187 2708 title = decodeURIComponent(title);
3188 2709 }
3189   - else
3190   - {
  2710 + else {
3191 2711 title = this.defaultFilename;
3192 2712 }
3193 2713
3194 2714 var file = new LocalFile(this, xml, title, true);
3195 2715
3196   - if (window.location.hash != null && window.location.hash.substring(0, 2) == '#P')
3197   - {
3198   - file.getHash = function()
3199   - {
  2716 + if (window.location.hash != null && window.location.hash.substring(0, 2) == '#P') {
  2717 + file.getHash = function () {
3200 2718 return window.location.hash.substring(1);
3201 2719 };
3202 2720 }
... ... @@ -3207,29 +2725,22 @@ App.prototype.start = function()
3207 2725
3208 2726 var parent = window.opener || window.parent;
3209 2727
3210   - if (parent != window)
3211   - {
  2728 + if (parent != window) {
3212 2729 var value = urlParams['create'];
3213 2730
3214   - if (value != null)
3215   - {
  2731 + if (value != null) {
3216 2732 doLoadFile(parent[decodeURIComponent(value)]);
3217 2733 }
3218   - else
3219   - {
  2734 + else {
3220 2735 value = urlParams['data'];
3221 2736
3222   - if (value != null)
3223   - {
  2737 + if (value != null) {
3224 2738 doLoadFile(decodeURIComponent(value));
3225 2739 }
3226   - else
3227   - {
3228   - this.installMessageHandler(mxUtils.bind(this, function(xml, evt)
3229   - {
  2740 + else {
  2741 + this.installMessageHandler(mxUtils.bind(this, function (xml, evt) {
3230 2742 // Ignores messages from other windows
3231   - if (evt.source == parent)
3232   - {
  2743 + if (evt.source == parent) {
3233 2744 doLoadFile(xml);
3234 2745 }
3235 2746 }));
... ... @@ -3238,72 +2749,57 @@ App.prototype.start = function()
3238 2749 }
3239 2750 }
3240 2751 // Checks if no earlier loading errors are showing
3241   - else if (this.dialog == null)
3242   - {
3243   - if (urlParams['demo'] == '1')
3244   - {
  2752 + else if (this.dialog == null) {
  2753 + if (urlParams['demo'] == '1') {
3245 2754 var prev = Editor.useLocalStorage;
3246 2755 this.createFile(this.defaultFilename, null, null, null, null, null, null, true);
3247 2756 Editor.useLocalStorage = prev;
3248 2757 }
3249   - else
3250   - {
  2758 + else {
3251 2759 var waiting = false;
3252 2760
3253 2761 // Checks if we're waiting for some asynchronous file to be loaded
3254 2762 // Cross-domain window access is not allowed in FF, so if we
3255 2763 // were opened from another domain then this will fail.
3256   - try
3257   - {
  2764 + try {
3258 2765 waiting = window.opener != null && window.opener.openFile != null;
3259 2766 }
3260   - catch(e)
3261   - {
  2767 + catch (e) {
3262 2768 // ignore
3263 2769 }
3264 2770
3265   - if (waiting)
3266   - {
  2771 + if (waiting) {
3267 2772 // Spinner is stopped in App.open
3268 2773 this.spinner.spin(document.body, mxResources.get('loading'))
3269 2774 }
3270   - else
3271   - {
  2775 + else {
3272 2776 var id = this.getDiagramId();
3273 2777
3274 2778 if (EditorUi.enableDrafts && urlParams['mode'] == null &&
3275 2779 this.getServiceName() == 'draw.io' && (id == null || id.length == 0) &&
3276   - !this.editor.isChromelessView())
3277   - {
  2780 + !this.editor.isChromelessView()) {
3278 2781 this.checkDrafts();
3279 2782 }
3280   - else if (id != null && id.length > 0)
3281   - {
3282   - this.loadFile(id, null, null, mxUtils.bind(this, function()
3283   - {
  2783 + else if (id != null && id.length > 0) {
  2784 + this.loadFile(id, null, null, mxUtils.bind(this, function () {
3284 2785 var temp = decodeURIComponent(urlParams['viewbox'] || '');
3285 2786
3286   - if (temp != '')
3287   - {
3288   - try
3289   - {
  2787 + if (temp != '') {
  2788 + try {
3290 2789 var bounds = JSON.parse(temp);
3291 2790 this.editor.graph.fitWindow(bounds, bounds.border);
3292 2791 }
3293   - catch (e)
3294   - {
  2792 + catch (e) {
3295 2793 // Ignore invalid viewport
3296 2794 console.error(e);
3297 2795 }
3298 2796 }
3299 2797 }));
3300 2798 }
3301   - else if (urlParams['splash'] != '0' || urlParams['mode'] != null)
3302   - {
  2799 + else if (urlParams['splash'] != '0' || urlParams['mode'] != null) {
3303 2800 this.loadFile();
3304 2801 }
3305   - else if (!EditorUi.isElectronApp)
3306   - {
  2802 + else if (!EditorUi.isElectronApp) {
3307 2803 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
3308 2804 }
3309 2805 }
... ... @@ -3314,62 +2810,50 @@ App.prototype.start = function()
3314 2810 var value = decodeURIComponent(urlParams['create'] || '');
3315 2811
3316 2812 if ((window.location.hash == null || window.location.hash.length <= 1) &&
3317   - value != null && value.length > 0 && this.spinner.spin(document.body, mxResources.get('loading')))
3318   - {
3319   - var reconnect = mxUtils.bind(this, function()
3320   - {
  2813 + value != null && value.length > 0 && this.spinner.spin(document.body, mxResources.get('loading'))) {
  2814 + var reconnect = mxUtils.bind(this, function () {
3321 2815 // Removes URL parameter and reloads the page
3322   - if (this.spinner.spin(document.body, mxResources.get('reconnecting')))
3323   - {
  2816 + if (this.spinner.spin(document.body, mxResources.get('reconnecting'))) {
3324 2817 window.location.search = this.getSearch(['create', 'title']);
3325 2818 };
3326 2819 });
3327 2820
3328   - var showCreateDialog = mxUtils.bind(this, function(xml)
3329   - {
  2821 + var showCreateDialog = mxUtils.bind(this, function (xml) {
3330 2822 this.spinner.stop();
3331 2823
3332 2824 // Resets mode for dialog - local file is only for preview
3333   - if (urlParams['splash'] != '0')
3334   - {
  2825 + if (urlParams['splash'] != '0') {
3335 2826 this.fileLoaded(new LocalFile(this, xml, null));
3336 2827
3337 2828 this.editor.graph.setEnabled(false);
3338 2829 this.mode = urlParams['mode'];
3339 2830 var title = urlParams['title'];
3340 2831
3341   - if (title != null)
3342   - {
  2832 + if (title != null) {
3343 2833 title = decodeURIComponent(title);
3344 2834 }
3345   - else
3346   - {
  2835 + else {
3347 2836 title = this.defaultFilename;
3348 2837 }
3349 2838
3350 2839 var serviceCount = this.getServiceCount(true);
3351 2840
3352   - if (isLocalStorage)
3353   - {
  2841 + if (isLocalStorage) {
3354 2842 serviceCount++;
3355 2843 }
3356 2844
3357 2845 var rowLimit = (serviceCount <= 4) ? 2 : (serviceCount > 6 ? 4 : 3);
3358 2846
3359   - var dlg = new CreateDialog(this, title, mxUtils.bind(this, function(filename, mode)
3360   - {
3361   - if (mode == null)
3362   - {
  2847 + var dlg = new CreateDialog(this, title, mxUtils.bind(this, function (filename, mode) {
  2848 + if (mode == null) {
3363 2849 this.hideDialog();
3364 2850 var prev = Editor.useLocalStorage;
3365 2851 this.createFile((filename.length > 0) ? filename : this.defaultFilename,
3366 2852 this.getFileData(), null, null, null, true, null, true);
3367 2853 Editor.useLocalStorage = prev;
3368 2854 }
3369   - else
3370   - {
3371   - this.pickFolder(mode, mxUtils.bind(this, function(folderId)
3372   - {
  2855 + else {
  2856 + this.pickFolder(mode, mxUtils.bind(this, function (folderId) {
3373 2857 this.createFile(filename, this.getFileData(true),
3374 2858 null, mode, null, true, folderId);
3375 2859 }));
... ... @@ -3378,61 +2862,47 @@ App.prototype.start = function()
3378 2862 null, null, true, rowLimit, null, null, null,
3379 2863 this.editor.fileExtensions);
3380 2864 this.showDialog(dlg.container, 420, (serviceCount > rowLimit) ? 390 : 280,
3381   - true, false, mxUtils.bind(this, function(cancel)
3382   - {
3383   - if (cancel && this.getCurrentFile() == null)
3384   - {
3385   - this.showSplash();
3386   - }
3387   - }));
  2865 + true, false, mxUtils.bind(this, function (cancel) {
  2866 + if (cancel && this.getCurrentFile() == null) {
  2867 + this.showSplash();
  2868 + }
  2869 + }));
3388 2870 dlg.init();
3389 2871 }
3390 2872 });
3391 2873
3392 2874 value = decodeURIComponent(value);
3393 2875
3394   - if (value.substring(0, 7) != 'http://' && value.substring(0, 8) != 'https://')
3395   - {
  2876 + if (value.substring(0, 7) != 'http://' && value.substring(0, 8) != 'https://') {
3396 2877 // Cross-domain window access is not allowed in FF, so if we
3397 2878 // were opened from another domain then this will fail.
3398   - try
3399   - {
3400   - if (window.opener != null && window.opener[value] != null)
3401   - {
  2879 + try {
  2880 + if (window.opener != null && window.opener[value] != null) {
3402 2881 showCreateDialog(window.opener[value]);
3403 2882 }
3404   - else
3405   - {
  2883 + else {
3406 2884 this.handleError(null, mxResources.get('errorLoadingFile'));
3407 2885 }
3408 2886 }
3409   - catch (e)
3410   - {
  2887 + catch (e) {
3411 2888 this.handleError(e, mxResources.get('errorLoadingFile'));
3412 2889 }
3413 2890 }
3414   - else
3415   - {
3416   - this.loadTemplate(value, function(text)
3417   - {
  2891 + else {
  2892 + this.loadTemplate(value, function (text) {
3418 2893 showCreateDialog(text);
3419   - }, mxUtils.bind(this, function()
3420   - {
  2894 + }, mxUtils.bind(this, function () {
3421 2895 this.handleError(null, mxResources.get('errorLoadingFile'), reconnect);
3422 2896 }));
3423 2897 }
3424 2898 }
3425   - else
3426   - {
  2899 + else {
3427 2900 // Passes the fileId from the state parameter to the hash tag and reloads
3428 2901 // the page without the state parameter
3429 2902 if ((window.location.hash == null || window.location.hash.length <= 1) &&
3430   - urlParams['state'] != null && this.stateArg != null && this.stateArg.action == 'open')
3431   - {
3432   - if (this.stateArg.ids != null)
3433   - {
3434   - if (window.history && window.history.replaceState)
3435   - {
  2903 + urlParams['state'] != null && this.stateArg != null && this.stateArg.action == 'open') {
  2904 + if (this.stateArg.ids != null) {
  2905 + if (window.history && window.history.replaceState) {
3436 2906 // Removes state URL parameter without reloading the page
3437 2907 window.history.replaceState(null, null, window.location.pathname +
3438 2908 this.getSearch(['state']));
... ... @@ -3442,10 +2912,8 @@ App.prototype.start = function()
3442 2912 }
3443 2913 }
3444 2914 else if ((window.location.hash == null || window.location.hash.length <= 1) &&
3445   - this.drive != null && this.stateArg != null && this.stateArg.action == 'create')
3446   - {
3447   - if (window.history && window.history.replaceState)
3448   - {
  2915 + this.drive != null && this.stateArg != null && this.stateArg.action == 'create') {
  2916 + if (window.history && window.history.replaceState) {
3449 2917 // Removes state URL parameter without reloading the page
3450 2918 window.history.replaceState(null, null, window.location.pathname +
3451 2919 this.getSearch(['state']));
... ... @@ -3453,22 +2921,18 @@ App.prototype.start = function()
3453 2921
3454 2922 this.setMode(App.MODE_GOOGLE);
3455 2923
3456   - if (urlParams['splash'] == '0')
3457   - {
  2924 + if (urlParams['splash'] == '0') {
3458 2925 this.createFile((urlParams['title'] != null) ?
3459 2926 decodeURIComponent(urlParams['title']) :
3460 2927 this.defaultFilename);
3461 2928 }
3462   - else
3463   - {
  2929 + else {
3464 2930 this.actions.get('new').funct();
3465 2931 }
3466 2932 }
3467   - else
3468   - {
  2933 + else {
3469 2934 // Removes open URL parameter. Hash is also updated in Init to load client.
3470   - if (urlParams['open'] != null && window.history && window.history.replaceState)
3471   - {
  2935 + if (urlParams['open'] != null && window.history && window.history.replaceState) {
3472 2936
3473 2937 window.history.replaceState(null, null, window.location.pathname +
3474 2938 this.getSearch(['open', 'sketch']));
... ... @@ -3480,8 +2944,7 @@ App.prototype.start = function()
3480 2944 }
3481 2945 }
3482 2946 }
3483   - catch (e)
3484   - {
  2947 + catch (e) {
3485 2948 this.handleError(e);
3486 2949 }
3487 2950 };
... ... @@ -3489,20 +2952,15 @@ App.prototype.start = function()
3489 2952 /**
3490 2953 * Checks for orphaned drafts.
3491 2954 */
3492   -App.prototype.loadDraft = function(xml, success)
3493   -{
3494   - this.createFile(this.defaultFilename, xml, null, null, mxUtils.bind(this, function()
3495   - {
3496   - window.setTimeout(mxUtils.bind(this, function()
3497   - {
  2955 +App.prototype.loadDraft = function (xml, success) {
  2956 + this.createFile(this.defaultFilename, xml, null, null, mxUtils.bind(this, function () {
  2957 + window.setTimeout(mxUtils.bind(this, function () {
3498 2958 var file = this.getCurrentFile();
3499 2959
3500   - if (file != null)
3501   - {
  2960 + if (file != null) {
3502 2961 file.fileChanged();
3503 2962
3504   - if (success != null)
3505   - {
  2963 + if (success != null) {
3506 2964 success();
3507 2965 }
3508 2966 }
... ... @@ -3510,41 +2968,32 @@ App.prototype.loadDraft = function(xml, success)
3510 2968 }), null, null, true);
3511 2969 };
3512 2970
3513   -App.prototype.filterDrafts = function(filePath, guid, callback)
3514   -{
  2971 +App.prototype.filterDrafts = function (filePath, guid, callback) {
3515 2972 var drafts = [];
3516 2973
3517   - function result()
3518   - {
  2974 + function result() {
3519 2975 callback(drafts);
3520 2976 };
3521 2977
3522   - try
3523   - {
3524   - this.getDatabaseItems(mxUtils.bind(this, function(items)
3525   - {
  2978 + try {
  2979 + this.getDatabaseItems(mxUtils.bind(this, function (items) {
3526 2980 // Collects orphaned drafts
3527   - for (var i = 0; i < items.length; i++)
3528   - {
3529   - try
3530   - {
  2981 + for (var i = 0; i < items.length; i++) {
  2982 + try {
3531 2983 var key = items[i].key;
3532 2984
3533   - if (key != null && key.substring(0, 7) == '.draft_')
3534   - {
  2985 + if (key != null && key.substring(0, 7) == '.draft_') {
3535 2986 var obj = JSON.parse(items[i].data);
3536 2987
3537 2988 if (obj != null && obj.type == 'draft' && obj.aliveCheck != guid &&
3538 2989 ((filePath == null && obj.fileObject == null) ||
3539   - (obj.fileObject != null && obj.fileObject.path == filePath)))
3540   - {
  2990 + (obj.fileObject != null && obj.fileObject.path == filePath))) {
3541 2991 obj.key = key;
3542 2992 drafts.push(obj);
3543 2993 }
3544 2994 }
3545 2995 }
3546   - catch (e)
3547   - {
  2996 + catch (e) {
3548 2997 // ignore
3549 2998 }
3550 2999 }
... ... @@ -3552,8 +3001,7 @@ App.prototype.filterDrafts = function(filePath, guid, callback)
3552 3001 result();
3553 3002 }, result));
3554 3003 }
3555   - catch (e)
3556   - {
  3004 + catch (e) {
3557 3005 result();
3558 3006 }
3559 3007 };
... ... @@ -3561,83 +3009,65 @@ App.prototype.filterDrafts = function(filePath, guid, callback)
3561 3009 /**
3562 3010 * Checks for orphaned drafts.
3563 3011 */
3564   -App.prototype.checkDrafts = function()
3565   -{
3566   - try
3567   - {
  3012 +App.prototype.checkDrafts = function () {
  3013 + try {
3568 3014 // Triggers storage event for other windows to mark active drafts
3569 3015 var guid = Editor.guid();
3570 3016 localStorage.setItem('.draft-alive-check', guid);
3571 3017
3572   - window.setTimeout(mxUtils.bind(this, function()
3573   - {
  3018 + window.setTimeout(mxUtils.bind(this, function () {
3574 3019 localStorage.removeItem('.draft-alive-check');
3575 3020
3576   - this.filterDrafts(null, guid, mxUtils.bind(this, function(drafts)
3577   - {
3578   - if (drafts.length == 1)
3579   - {
3580   - this.loadDraft(drafts[0].data, mxUtils.bind(this, function()
3581   - {
  3021 + this.filterDrafts(null, guid, mxUtils.bind(this, function (drafts) {
  3022 + if (drafts.length == 1) {
  3023 + this.loadDraft(drafts[0].data, mxUtils.bind(this, function () {
3582 3024 this.removeDatabaseItem(drafts[0].key);
3583 3025 }));
3584 3026 }
3585   - else if (drafts.length > 1)
3586   - {
  3027 + else if (drafts.length > 1) {
3587 3028 var ts = new Date(drafts[0].modified);
3588 3029
3589 3030 var dlg = new DraftDialog(this, (drafts.length > 1) ? mxResources.get('selectDraft') :
3590 3031 mxResources.get('draftFound', [ts.toLocaleDateString() + ' ' + ts.toLocaleTimeString()]),
3591   - (drafts.length > 1) ? null : drafts[0].data, mxUtils.bind(this, function(index)
3592   - {
3593   - this.hideDialog();
3594   - index = (index != '') ? index : 0;
  3032 + (drafts.length > 1) ? null : drafts[0].data, mxUtils.bind(this, function (index) {
  3033 + this.hideDialog();
  3034 + index = (index != '') ? index : 0;
3595 3035
3596   - this.loadDraft(drafts[index].data, mxUtils.bind(this, function()
3597   - {
3598   - this.removeDatabaseItem(drafts[index].key);
3599   - }));
3600   - }), mxUtils.bind(this, function(index, success)
3601   - {
3602   - index = (index != '') ? index : 0;
3603   -
3604   - // Discard draft
3605   - this.confirm(mxResources.get('areYouSure'), null, mxUtils.bind(this, function()
3606   - {
3607   - this.removeDatabaseItem(drafts[index].key);
3608   -
3609   - if (success != null)
3610   - {
3611   - success();
3612   - }
3613   - }), mxResources.get('no'), mxResources.get('yes'));
3614   - }), null, null, null, (drafts.length > 1) ? drafts : null);
3615   - this.showDialog(dlg.container, 640, 480, true, false, mxUtils.bind(this, function(cancel)
3616   - {
3617   - if (urlParams['splash'] != '0')
3618   - {
  3036 + this.loadDraft(drafts[index].data, mxUtils.bind(this, function () {
  3037 + this.removeDatabaseItem(drafts[index].key);
  3038 + }));
  3039 + }), mxUtils.bind(this, function (index, success) {
  3040 + index = (index != '') ? index : 0;
  3041 +
  3042 + // Discard draft
  3043 + this.confirm(mxResources.get('areYouSure'), null, mxUtils.bind(this, function () {
  3044 + this.removeDatabaseItem(drafts[index].key);
  3045 +
  3046 + if (success != null) {
  3047 + success();
  3048 + }
  3049 + }), mxResources.get('no'), mxResources.get('yes'));
  3050 + }), null, null, null, (drafts.length > 1) ? drafts : null);
  3051 + this.showDialog(dlg.container, 640, 480, true, false, mxUtils.bind(this, function (cancel) {
  3052 + if (urlParams['splash'] != '0') {
3619 3053 this.loadFile();
3620 3054 }
3621   - else
3622   - {
  3055 + else {
3623 3056 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
3624 3057 }
3625 3058 }));
3626 3059 dlg.init();
3627 3060 }
3628   - else if (urlParams['splash'] != '0')
3629   - {
  3061 + else if (urlParams['splash'] != '0') {
3630 3062 this.loadFile();
3631 3063 }
3632   - else
3633   - {
  3064 + else {
3634 3065 this.createFile(this.defaultFilename, this.getFileData(), null, null, null, null, null, true);
3635 3066 }
3636 3067 }));
3637 3068 }), 0);
3638 3069 }
3639   - catch (e)
3640   - {
  3070 + catch (e) {
3641 3071 // ignore
3642 3072 }
3643 3073 };
... ... @@ -3648,48 +3078,39 @@ App.prototype.checkDrafts = function()
3648 3078 * @param {number} dx X-coordinate of the translation.
3649 3079 * @param {number} dy Y-coordinate of the translation.
3650 3080 */
3651   -App.prototype.showSplash = function(force)
3652   -{
  3081 +App.prototype.showSplash = function (force) {
3653 3082 //Splash dialog shouldn't be shownn when running without a file menu
3654   - if (urlParams['noFileMenu'] == '1')
3655   - {
  3083 + if (urlParams['noFileMenu'] == '1') {
3656 3084 return;
3657 3085 }
3658 3086
3659 3087 var serviceCount = this.getServiceCount(true);
3660 3088
3661   - var showSecondDialog = mxUtils.bind(this, function()
3662   - {
  3089 + var showSecondDialog = mxUtils.bind(this, function () {
3663 3090 var dlg = new SplashDialog(this);
3664 3091
3665 3092 this.showDialog(dlg.container, 340, (mxClient.IS_CHROMEAPP || EditorUi.isElectronApp) ? 200 : 230, true, true,
3666   - mxUtils.bind(this, function(cancel)
3667   - {
  3093 + mxUtils.bind(this, function (cancel) {
3668 3094 // Creates a blank diagram if the dialog is closed
3669   - if (cancel && !mxClient.IS_CHROMEAPP)
3670   - {
  3095 + if (cancel && !mxClient.IS_CHROMEAPP) {
3671 3096 var prev = Editor.useLocalStorage;
3672   - this.createFile(this.defaultFilename + (EditorUi.isElectronApp? '.drawio' : ''), null, null, null, null, null, null,
  3097 + this.createFile(this.defaultFilename + (EditorUi.isElectronApp ? '.drawio' : ''), null, null, null, null, null, null,
3673 3098 urlParams['local'] != '1');
3674 3099 Editor.useLocalStorage = prev;
3675 3100 }
3676 3101 }), true);
3677 3102 });
3678 3103
3679   - if (this.editor.isChromelessView())
3680   - {
3681   - this.handleError({message: mxResources.get('noFileSelected')},
3682   - mxResources.get('errorLoadingFile'), mxUtils.bind(this, function()
3683   - {
3684   - this.showSplash();
3685   - }));
  3104 + if (this.editor.isChromelessView()) {
  3105 + this.handleError({ message: mxResources.get('noFileSelected') },
  3106 + mxResources.get('errorLoadingFile'), mxUtils.bind(this, function () {
  3107 + this.showSplash();
  3108 + }));
3686 3109 }
3687   - else if (!mxClient.IS_CHROMEAPP && (this.mode == null || force))
3688   - {
  3110 + else if (!mxClient.IS_CHROMEAPP && (this.mode == null || force)) {
3689 3111 var rowLimit = (serviceCount == 4) ? 2 : 3;
3690 3112
3691   - var dlg = new StorageDialog(this, mxUtils.bind(this, function()
3692   - {
  3113 + var dlg = new StorageDialog(this, mxUtils.bind(this, function () {
3693 3114 this.hideDialog();
3694 3115 showSecondDialog();
3695 3116 }), rowLimit);
... ... @@ -3697,8 +3118,7 @@ App.prototype.showSplash = function(force)
3697 3118 this.showDialog(dlg.container, (rowLimit < 3) ? 200 : 300,
3698 3119 ((serviceCount > 3) ? 320 : 210), true, false);
3699 3120 }
3700   - else if (urlParams['create'] == null)
3701   - {
  3121 + else if (urlParams['create'] == null) {
3702 3122 showSecondDialog();
3703 3123 }
3704 3124 };
... ... @@ -3709,13 +3129,11 @@ App.prototype.showSplash = function(force)
3709 3129 * @param {number} dx X-coordinate of the translation.
3710 3130 * @param {number} dy Y-coordinate of the translation.
3711 3131 */
3712   -App.prototype.addLanguageMenu = function(elt, addLabel)
3713   -{
  3132 +App.prototype.addLanguageMenu = function (elt, addLabel) {
3714 3133 var img = null;
3715 3134 var langMenu = this.menus.get('language');
3716 3135
3717   - if (langMenu != null)
3718   - {
  3136 + if (langMenu != null) {
3719 3137 img = document.createElement('div');
3720 3138 img.setAttribute('title', mxResources.get('language'));
3721 3139 img.className = 'geIcon geSprite geSprite-globe';
... ... @@ -3724,8 +3142,7 @@ App.prototype.addLanguageMenu = function(elt, addLabel)
3724 3142 img.style.bottom = '20px';
3725 3143 img.style.right = '20px';
3726 3144
3727   - if (addLabel)
3728   - {
  3145 + if (addLabel) {
3729 3146 img.style.direction = 'rtl';
3730 3147 img.style.textAlign = 'right';
3731 3148 img.style.right = '24px';
... ... @@ -3741,8 +3158,7 @@ App.prototype.addLanguageMenu = function(elt, addLabel)
3741 3158 img.appendChild(label);
3742 3159 }
3743 3160
3744   - mxEvent.addListener(img, 'click', mxUtils.bind(this, function(evt)
3745   - {
  3161 + mxEvent.addListener(img, 'click', mxUtils.bind(this, function (evt) {
3746 3162 this.editor.graph.popupMenuHandler.hideMenu();
3747 3163 var menu = new mxPopupMenu(this.menus.get('language').funct);
3748 3164 menu.div.className += ' geMenubarMenu';
... ... @@ -3751,8 +3167,7 @@ App.prototype.addLanguageMenu = function(elt, addLabel)
3751 3167 menu.autoExpand = true;
3752 3168
3753 3169 // Disables autoexpand and destroys menu when hidden
3754   - menu.hideMenu = mxUtils.bind(this, function()
3755   - {
  3170 + menu.hideMenu = mxUtils.bind(this, function () {
3756 3171 mxPopupMenu.prototype.hideMenu.apply(menu, arguments);
3757 3172 menu.destroy();
3758 3173 });
... ... @@ -3773,41 +3188,31 @@ App.prototype.addLanguageMenu = function(elt, addLabel)
3773 3188 /**
3774 3189 * Loads the given file handle as a local file.
3775 3190 */
3776   -App.prototype.loadFileSystemEntry = function(fileHandle, success, error)
3777   -{
3778   - error = (error != null) ? error : mxUtils.bind(this, function(e)
3779   - {
  3191 +App.prototype.loadFileSystemEntry = function (fileHandle, success, error) {
  3192 + error = (error != null) ? error : mxUtils.bind(this, function (e) {
3780 3193 this.handleError(e);
3781 3194 });
3782 3195
3783   - try
3784   - {
3785   - fileHandle.getFile().then(mxUtils.bind(this, function(file)
3786   - {
  3196 + try {
  3197 + fileHandle.getFile().then(mxUtils.bind(this, function (file) {
3787 3198 var reader = new FileReader();
3788 3199
3789   - reader.onload = mxUtils.bind(this, function(e)
3790   - {
3791   - try
3792   - {
3793   - if (success != null)
3794   - {
  3200 + reader.onload = mxUtils.bind(this, function (e) {
  3201 + try {
  3202 + if (success != null) {
3795 3203 var data = e.target.result;
3796 3204
3797   - if (file.type == 'image/png')
3798   - {
  3205 + if (file.type == 'image/png') {
3799 3206 data = this.extractGraphModelFromPng(data);
3800 3207 }
3801 3208
3802 3209 success(new LocalFile(this, data, file.name, null, fileHandle, file));
3803 3210 }
3804   - else
3805   - {
  3211 + else {
3806 3212 this.openFileHandle(e.target.result, file.name, file, false, fileHandle);
3807 3213 }
3808 3214 }
3809   - catch(e)
3810   - {
  3215 + catch (e) {
3811 3216 error(e);
3812 3217 }
3813 3218 });
... ... @@ -3816,18 +3221,15 @@ App.prototype.loadFileSystemEntry = function(fileHandle, success, error)
3816 3221
3817 3222 if ((file.type.substring(0, 5) === 'image' ||
3818 3223 file.type === 'application/pdf') &&
3819   - file.type.substring(0, 9) !== 'image/svg')
3820   - {
  3224 + file.type.substring(0, 9) !== 'image/svg') {
3821 3225 reader.readAsDataURL(file);
3822 3226 }
3823   - else
3824   - {
  3227 + else {
3825 3228 reader.readAsText(file);
3826 3229 }
3827 3230 }), error);
3828 3231 }
3829   - catch (e)
3830   - {
  3232 + catch (e) {
3831 3233 error(e);
3832 3234 }
3833 3235 };
... ... @@ -3835,70 +3237,58 @@ App.prototype.loadFileSystemEntry = function(fileHandle, success, error)
3835 3237 /**
3836 3238 * Loads the given file handle as a local file.
3837 3239 */
3838   -App.prototype.createFileSystemOptions = function(name)
3839   -{
  3240 +App.prototype.createFileSystemOptions = function (name) {
3840 3241 var ext = [];
3841 3242 var temp = null;
3842 3243
3843   - if (name != null)
3844   - {
  3244 + if (name != null) {
3845 3245 var idx = name.lastIndexOf('.');
3846 3246
3847   - if (idx > 0)
3848   - {
  3247 + if (idx > 0) {
3849 3248 temp = name.substring(idx + 1);
3850 3249 }
3851 3250 }
3852 3251
3853   - for (var i = 0; i < this.editor.diagramFileTypes.length; i++)
3854   - {
3855   - var obj = {description: mxResources.get(this.editor.diagramFileTypes[i].description) +
3856   - ((mxClient.IS_MAC) ? ' (.' + this.editor.diagramFileTypes[i].extension + ')' : ''),
3857   - accept: {}};
  3252 + for (var i = 0; i < this.editor.diagramFileTypes.length; i++) {
  3253 + var obj = {
  3254 + description: mxResources.get(this.editor.diagramFileTypes[i].description) +
  3255 + ((mxClient.IS_MAC) ? ' (.' + this.editor.diagramFileTypes[i].extension + ')' : ''),
  3256 + accept: {}
  3257 + };
3858 3258 obj.accept[this.editor.diagramFileTypes[i].mimeType] = ['.' + this.editor.diagramFileTypes[i].extension];
3859 3259
3860   - if (this.editor.diagramFileTypes[i].extension == temp)
3861   - {
  3260 + if (this.editor.diagramFileTypes[i].extension == temp) {
3862 3261 ext.splice(0, 0, obj);
3863 3262 }
3864   - else
3865   - {
3866   - if (this.editor.diagramFileTypes[i].extension == temp)
3867   - {
  3263 + else {
  3264 + if (this.editor.diagramFileTypes[i].extension == temp) {
3868 3265 ext.splice(0, 0, obj);
3869 3266 }
3870   - else
3871   - {
  3267 + else {
3872 3268 ext.push(obj);
3873 3269 }
3874 3270 }
3875 3271 }
3876 3272
3877 3273 // TODO: Specify default filename
3878   - return {types: ext, fileName: name};
  3274 + return { types: ext, fileName: name };
3879 3275 };
3880 3276
3881 3277 /**
3882 3278 * Loads the given file handle as a local file.
3883 3279 */
3884   -App.prototype.showSaveFilePicker = function(success, error, opts)
3885   -{
3886   - error = (error != null) ? error : mxUtils.bind(this, function(e)
3887   - {
3888   - if (e.name != 'AbortError')
3889   - {
  3280 +App.prototype.showSaveFilePicker = function (success, error, opts) {
  3281 + error = (error != null) ? error : mxUtils.bind(this, function (e) {
  3282 + if (e.name != 'AbortError') {
3890 3283 this.handleError(e);
3891 3284 }
3892 3285 });
3893 3286
3894 3287 opts = (opts != null) ? opts : this.createFileSystemOptions();
3895 3288
3896   - window.showSaveFilePicker(opts).then(mxUtils.bind(this, function(fileHandle)
3897   - {
3898   - if (fileHandle != null)
3899   - {
3900   - fileHandle.getFile().then(mxUtils.bind(this, function(desc)
3901   - {
  3289 + window.showSaveFilePicker(opts).then(mxUtils.bind(this, function (fileHandle) {
  3290 + if (fileHandle != null) {
  3291 + fileHandle.getFile().then(mxUtils.bind(this, function (desc) {
3902 3292 success(fileHandle, desc);
3903 3293 }), error);
3904 3294 }
... ... @@ -3911,66 +3301,50 @@ App.prototype.showSaveFilePicker = function(success, error, opts)
3911 3301 * @param {number} dx X-coordinate of the translation.
3912 3302 * @param {number} dy Y-coordinate of the translation.
3913 3303 */
3914   -App.prototype.pickFile = function(mode)
3915   -{
3916   - try
3917   - {
  3304 +App.prototype.pickFile = function (mode) {
  3305 + try {
3918 3306 mode = (mode != null) ? mode : this.mode;
3919 3307
3920   - if (mode == App.MODE_GOOGLE)
3921   - {
3922   - if (this.drive != null && typeof(google) != 'undefined' && typeof(google.picker) != 'undefined')
3923   - {
  3308 + if (mode == App.MODE_GOOGLE) {
  3309 + if (this.drive != null && typeof (google) != 'undefined' && typeof (google.picker) != 'undefined') {
3924 3310 this.drive.pickFile();
3925 3311 }
3926   - else
3927   - {
  3312 + else {
3928 3313 this.openLink('https://drive.google.com');
3929 3314 }
3930 3315 }
3931   - else
3932   - {
  3316 + else {
3933 3317 var peer = this.getPeerForMode(mode);
3934 3318
3935   - if (peer != null)
3936   - {
  3319 + if (peer != null) {
3937 3320 peer.pickFile();
3938 3321 }
3939   - else if (mode == App.MODE_DEVICE && EditorUi.nativeFileSupport)
3940   - {
3941   - window.showOpenFilePicker().then(mxUtils.bind(this, function(fileHandles)
3942   - {
  3322 + else if (mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) {
  3323 + window.showOpenFilePicker().then(mxUtils.bind(this, function (fileHandles) {
3943 3324 if (fileHandles != null && fileHandles.length > 0 &&
3944   - this.spinner.spin(document.body, mxResources.get('loading')))
3945   - {
  3325 + this.spinner.spin(document.body, mxResources.get('loading'))) {
3946 3326 this.loadFileSystemEntry(fileHandles[0]);
3947 3327 }
3948   - }), mxUtils.bind(this, function(e)
3949   - {
3950   - if (e.name != 'AbortError')
3951   - {
  3328 + }), mxUtils.bind(this, function (e) {
  3329 + if (e.name != 'AbortError') {
3952 3330 this.handleError(e);
3953 3331 }
3954 3332 }));
3955 3333 }
3956   - else if (mode == App.MODE_DEVICE && Graph.fileSupport)
3957   - {
3958   - if (this.openFileInputElt == null)
3959   - {
  3334 + else if (mode == App.MODE_DEVICE && Graph.fileSupport) {
  3335 + if (this.openFileInputElt == null) {
3960 3336 var input = document.createElement('input');
3961 3337 input.setAttribute('type', 'file');
3962 3338
3963   - mxEvent.addListener(input, 'change', mxUtils.bind(this, function()
3964   - {
3965   - if (input.files != null)
3966   - {
  3339 + mxEvent.addListener(input, 'change', mxUtils.bind(this, function () {
  3340 + if (input.files != null) {
3967 3341 this.openFiles(input.files);
3968 3342
3969   - // Resets input to force change event for
  3343 + // Resets input to force change event for
3970 3344 // same file (type reset required for IE)
3971 3345 input.type = '';
3972 3346 input.type = 'file';
3973   - input.value = '';
  3347 + input.value = '';
3974 3348 }
3975 3349 }));
3976 3350
... ... @@ -3981,25 +3355,21 @@ App.prototype.pickFile = function(mode)
3981 3355
3982 3356 this.openFileInputElt.click();
3983 3357 }
3984   - else
3985   - {
  3358 + else {
3986 3359 this.hideDialog();
3987 3360 window.openNew = this.getCurrentFile() != null && !this.isDiagramEmpty();
3988 3361 window.baseUrl = this.getUrl();
3989 3362 window.openKey = 'open';
3990 3363
3991   - window.listBrowserFiles = mxUtils.bind(this, function(success, error)
3992   - {
  3364 + window.listBrowserFiles = mxUtils.bind(this, function (success, error) {
3993 3365 StorageFile.listFiles(this, 'F', success, error);
3994 3366 });
3995 3367
3996   - window.openBrowserFile = mxUtils.bind(this, function(title, success, error)
3997   - {
  3368 + window.openBrowserFile = mxUtils.bind(this, function (title, success, error) {
3998 3369 StorageFile.getFileContent(this, title, success, error);
3999 3370 });
4000 3371
4001   - window.deleteBrowserFile = mxUtils.bind(this, function(title, success, error)
4002   - {
  3372 + window.deleteBrowserFile = mxUtils.bind(this, function (title, success, error) {
4003 3373 StorageFile.deleteFile(this, title, success, error);
4004 3374 });
4005 3375
... ... @@ -4008,15 +3378,12 @@ App.prototype.pickFile = function(mode)
4008 3378 this.openFile();
4009 3379
4010 3380 // Installs local handler for opened files in same window
4011   - window.openFile.setConsumer(mxUtils.bind(this, function(xml, filename)
4012   - {
4013   - var doOpenFile = mxUtils.bind(this, function()
4014   - {
  3381 + window.openFile.setConsumer(mxUtils.bind(this, function (xml, filename) {
  3382 + var doOpenFile = mxUtils.bind(this, function () {
4015 3383 // Replaces PNG with XML extension
4016 3384 var dot = !this.useCanvasForExport && filename.substring(filename.length - 4) == '.png';
4017 3385
4018   - if (dot)
4019   - {
  3386 + if (dot) {
4020 3387 filename = filename.substring(0, filename.length - 4) + '.drawio';
4021 3388 }
4022 3389
... ... @@ -4027,12 +3394,10 @@ App.prototype.pickFile = function(mode)
4027 3394
4028 3395 var currentFile = this.getCurrentFile();
4029 3396
4030   - if (currentFile == null || !currentFile.isModified())
4031   - {
  3397 + if (currentFile == null || !currentFile.isModified()) {
4032 3398 doOpenFile();
4033 3399 }
4034   - else
4035   - {
  3400 + else {
4036 3401 this.confirm(mxResources.get('allChangesLost'), null, doOpenFile,
4037 3402 mxResources.get('cancel'), mxResources.get('discardChanges'));
4038 3403 }
... ... @@ -4042,21 +3407,18 @@ App.prototype.pickFile = function(mode)
4042 3407 var dlg = this.dialog;
4043 3408 var dlgClose = dlg.close;
4044 3409
4045   - this.dialog.close = mxUtils.bind(this, function(cancel)
4046   - {
  3410 + this.dialog.close = mxUtils.bind(this, function (cancel) {
4047 3411 Editor.useLocalStorage = prevValue;
4048 3412 dlgClose.apply(dlg, arguments);
4049 3413
4050   - if (this.getCurrentFile() == null)
4051   - {
  3414 + if (this.getCurrentFile() == null) {
4052 3415 this.showSplash();
4053 3416 }
4054 3417 });
4055 3418 }
4056 3419 }
4057 3420 }
4058   - catch (e)
4059   - {
  3421 + catch (e) {
4060 3422 this.handleError(e);
4061 3423 }
4062 3424 };
... ... @@ -4067,53 +3429,40 @@ App.prototype.pickFile = function(mode)
4067 3429 * @param {number} dx X-coordinate of the translation.
4068 3430 * @param {number} dy Y-coordinate of the translation.
4069 3431 */
4070   -App.prototype.pickLibrary = function(mode)
4071   -{
  3432 +App.prototype.pickLibrary = function (mode) {
4072 3433 mode = (mode != null) ? mode : this.mode;
4073 3434
4074 3435 if (mode == App.MODE_GOOGLE || mode == App.MODE_DROPBOX || mode == App.MODE_ONEDRIVE ||
4075   - mode == App.MODE_GITHUB || mode == App.MODE_GITLAB || mode == App.MODE_TRELLO)
4076   - {
  3436 + mode == App.MODE_GITHUB || mode == App.MODE_GITLAB || mode == App.MODE_TRELLO) {
4077 3437 var peer = (mode == App.MODE_GOOGLE) ? this.drive :
4078 3438 ((mode == App.MODE_ONEDRIVE) ? this.oneDrive :
4079   - ((mode == App.MODE_GITHUB) ? this.gitHub :
4080   - ((mode == App.MODE_GITLAB) ? this.gitLab :
4081   - ((mode == App.MODE_TRELLO) ? this.trello :
4082   - this.dropbox))));
4083   -
4084   - if (peer != null)
4085   - {
4086   - peer.pickLibrary(mxUtils.bind(this, function(id, optionalFile)
4087   - {
4088   - if (optionalFile != null)
4089   - {
4090   - try
4091   - {
  3439 + ((mode == App.MODE_GITHUB) ? this.gitHub :
  3440 + ((mode == App.MODE_GITLAB) ? this.gitLab :
  3441 + ((mode == App.MODE_TRELLO) ? this.trello :
  3442 + this.dropbox))));
  3443 +
  3444 + if (peer != null) {
  3445 + peer.pickLibrary(mxUtils.bind(this, function (id, optionalFile) {
  3446 + if (optionalFile != null) {
  3447 + try {
4092 3448 this.loadLibrary(optionalFile);
4093 3449 }
4094   - catch (e)
4095   - {
  3450 + catch (e) {
4096 3451 this.handleError(e, mxResources.get('errorLoadingFile'));
4097 3452 }
4098 3453 }
4099   - else
4100   - {
4101   - if (this.spinner.spin(document.body, mxResources.get('loading')))
4102   - {
4103   - peer.getLibrary(id, mxUtils.bind(this, function(file)
4104   - {
  3454 + else {
  3455 + if (this.spinner.spin(document.body, mxResources.get('loading'))) {
  3456 + peer.getLibrary(id, mxUtils.bind(this, function (file) {
4105 3457 this.spinner.stop();
4106 3458
4107   - try
4108   - {
  3459 + try {
4109 3460 this.loadLibrary(file);
4110 3461 }
4111   - catch (e)
4112   - {
  3462 + catch (e) {
4113 3463 this.handleError(e, mxResources.get('errorLoadingFile'));
4114 3464 }
4115   - }), mxUtils.bind(this, function(resp)
4116   - {
  3465 + }), mxUtils.bind(this, function (resp) {
4117 3466 this.handleError(resp, (resp != null) ? mxResources.get('errorLoadingFile') : null);
4118 3467 }));
4119 3468 }
... ... @@ -4121,31 +3470,22 @@ App.prototype.pickLibrary = function(mode)
4121 3470 }));
4122 3471 }
4123 3472 }
4124   - else if (mode == App.MODE_DEVICE && Graph.fileSupport)
4125   - {
4126   - if (this.libFileInputElt == null)
4127   - {
  3473 + else if (mode == App.MODE_DEVICE && Graph.fileSupport) {
  3474 + if (this.libFileInputElt == null) {
4128 3475 var input = document.createElement('input');
4129 3476 input.setAttribute('type', 'file');
4130 3477
4131   - mxEvent.addListener(input, 'change', mxUtils.bind(this, function()
4132   - {
4133   - if (input.files != null)
4134   - {
4135   - for (var i = 0; i < input.files.length; i++)
4136   - {
4137   - (mxUtils.bind(this, function(file)
4138   - {
  3478 + mxEvent.addListener(input, 'change', mxUtils.bind(this, function () {
  3479 + if (input.files != null) {
  3480 + for (var i = 0; i < input.files.length; i++) {
  3481 + (mxUtils.bind(this, function (file) {
4139 3482 var reader = new FileReader();
4140 3483
4141   - reader.onload = mxUtils.bind(this, function(e)
4142   - {
4143   - try
4144   - {
  3484 + reader.onload = mxUtils.bind(this, function (e) {
  3485 + try {
4145 3486 this.loadLibrary(new LocalLibrary(this, e.target.result, file.name));
4146 3487 }
4147   - catch (e)
4148   - {
  3488 + catch (e) {
4149 3489 this.handleError(e, mxResources.get('errorLoadingFile'));
4150 3490 }
4151 3491 });
... ... @@ -4154,10 +3494,10 @@ App.prototype.pickLibrary = function(mode)
4154 3494 }))(input.files[i]);
4155 3495 }
4156 3496
4157   - // Resets input to force change event for same file (type reset required for IE)
  3497 + // Resets input to force change event for same file (type reset required for IE)
4158 3498 input.type = '';
4159 3499 input.type = 'file';
4160   - input.value = '';
  3500 + input.value = '';
4161 3501 }
4162 3502 }));
4163 3503
... ... @@ -4168,23 +3508,19 @@ App.prototype.pickLibrary = function(mode)
4168 3508
4169 3509 this.libFileInputElt.click();
4170 3510 }
4171   - else
4172   - {
  3511 + else {
4173 3512 window.openNew = false;
4174 3513 window.openKey = 'open';
4175 3514
4176   - window.listBrowserFiles = mxUtils.bind(this, function(success, error)
4177   - {
  3515 + window.listBrowserFiles = mxUtils.bind(this, function (success, error) {
4178 3516 StorageFile.listFiles(this, 'L', success, error);
4179 3517 });
4180 3518
4181   - window.openBrowserFile = mxUtils.bind(this, function(title, success, error)
4182   - {
  3519 + window.openBrowserFile = mxUtils.bind(this, function (title, success, error) {
4183 3520 StorageFile.getFileContent(this, title, success, error);
4184 3521 });
4185 3522
4186   - window.deleteBrowserFile = mxUtils.bind(this, function(title, success, error)
4187   - {
  3523 + window.deleteBrowserFile = mxUtils.bind(this, function (title, success, error) {
4188 3524 StorageFile.deleteFile(this, title, success, error);
4189 3525 });
4190 3526
... ... @@ -4192,28 +3528,23 @@ App.prototype.pickLibrary = function(mode)
4192 3528 Editor.useLocalStorage = mode == App.MODE_BROWSER;
4193 3529
4194 3530 // Closes dialog after open
4195   - window.openFile = new OpenFile(mxUtils.bind(this, function(cancel)
4196   - {
  3531 + window.openFile = new OpenFile(mxUtils.bind(this, function (cancel) {
4197 3532 this.hideDialog(cancel);
4198 3533 }));
4199 3534
4200   - window.openFile.setConsumer(mxUtils.bind(this, function(xml, filename)
4201   - {
4202   - try
4203   - {
  3535 + window.openFile.setConsumer(mxUtils.bind(this, function (xml, filename) {
  3536 + try {
4204 3537 this.loadLibrary((mode == App.MODE_BROWSER) ? new StorageLibrary(this, xml, filename) :
4205 3538 new LocalLibrary(this, xml, filename));
4206 3539 }
4207   - catch (e)
4208   - {
  3540 + catch (e) {
4209 3541 this.handleError(e, mxResources.get('errorLoadingFile'));
4210 3542 }
4211 3543 }));
4212 3544
4213 3545 // Removes openFile if dialog is closed
4214 3546 this.showDialog(new OpenDialog(this).container, (Editor.useLocalStorage) ? 640 : 360,
4215   - (Editor.useLocalStorage) ? 480 : 220, true, true, function()
4216   - {
  3547 + (Editor.useLocalStorage) ? 480 : 220, true, true, function () {
4217 3548 Editor.useLocalStorage = prevValue;
4218 3549 window.openFile = null;
4219 3550 });
... ... @@ -4226,21 +3557,17 @@ App.prototype.pickLibrary = function(mode)
4226 3557 * @param {number} dx X-coordinate of the translation.
4227 3558 * @param {number} dy Y-coordinate of the translation.
4228 3559 */
4229   -App.prototype.saveLibrary = function(name, images, file, mode, noSpin, noReload, fn)
4230   -{
4231   - try
4232   - {
  3560 +App.prototype.saveLibrary = function (name, images, file, mode, noSpin, noReload, fn) {
  3561 + try {
4233 3562 mode = (mode != null) ? mode : this.mode;
4234 3563 noSpin = (noSpin != null) ? noSpin : false;
4235 3564 noReload = (noReload != null) ? noReload : false;
4236 3565 var xml = this.createLibraryDataFromImages(images);
4237 3566
4238   - var error = mxUtils.bind(this, function(resp)
4239   - {
  3567 + var error = mxUtils.bind(this, function (resp) {
4240 3568 this.spinner.stop();
4241 3569
4242   - if (fn != null)
4243   - {
  3570 + if (fn != null) {
4244 3571 fn();
4245 3572 }
4246 3573
... ... @@ -4248,130 +3575,101 @@ App.prototype.saveLibrary = function(name, images, file, mode, noSpin, noReload,
4248 3575 });
4249 3576
4250 3577 // Handles special case for local libraries
4251   - if (file == null && mode == App.MODE_DEVICE)
4252   - {
  3578 + if (file == null && mode == App.MODE_DEVICE) {
4253 3579 file = new LocalLibrary(this, xml, name);
4254 3580 }
4255 3581
4256   - if (file == null)
4257   - {
4258   - this.pickFolder(mode, mxUtils.bind(this, function(folderId)
4259   - {
4260   - if (mode == App.MODE_GOOGLE && this.drive != null && this.spinner.spin(document.body, mxResources.get('inserting')))
4261   - {
4262   - this.drive.insertFile(name, xml, folderId, mxUtils.bind(this, function(newFile)
4263   - {
  3582 + if (file == null) {
  3583 + this.pickFolder(mode, mxUtils.bind(this, function (folderId) {
  3584 + if (mode == App.MODE_GOOGLE && this.drive != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3585 + this.drive.insertFile(name, xml, folderId, mxUtils.bind(this, function (newFile) {
4264 3586 this.spinner.stop();
4265 3587 this.hideDialog(true);
4266 3588 this.libraryLoaded(newFile, images);
4267 3589 }), error, this.drive.libraryMimeType);
4268 3590 }
4269   - else if (mode == App.MODE_GITHUB && this.gitHub != null && this.spinner.spin(document.body, mxResources.get('inserting')))
4270   - {
4271   - this.gitHub.insertLibrary(name, xml, mxUtils.bind(this, function(newFile)
4272   - {
  3591 + else if (mode == App.MODE_GITHUB && this.gitHub != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3592 + this.gitHub.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
4273 3593 this.spinner.stop();
4274 3594 this.hideDialog(true);
4275 3595 this.libraryLoaded(newFile, images);
4276 3596 }), error, folderId);
4277 3597 }
4278   - else if (mode == App.MODE_GITLAB && this.gitLab != null && this.spinner.spin(document.body, mxResources.get('inserting')))
4279   - {
4280   - this.gitLab.insertLibrary(name, xml, mxUtils.bind(this, function(newFile)
4281   - {
  3598 + else if (mode == App.MODE_GITLAB && this.gitLab != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3599 + this.gitLab.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
4282 3600 this.spinner.stop();
4283 3601 this.hideDialog(true);
4284 3602 this.libraryLoaded(newFile, images);
4285 3603 }), error, folderId);
4286 3604 }
4287   - else if (mode == App.MODE_TRELLO && this.trello != null && this.spinner.spin(document.body, mxResources.get('inserting')))
4288   - {
4289   - this.trello.insertLibrary(name, xml, mxUtils.bind(this, function(newFile)
4290   - {
  3605 + else if (mode == App.MODE_TRELLO && this.trello != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3606 + this.trello.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
4291 3607 this.spinner.stop();
4292 3608 this.hideDialog(true);
4293 3609 this.libraryLoaded(newFile, images);
4294 3610 }), error, folderId);
4295 3611 }
4296   - else if (mode == App.MODE_DROPBOX && this.dropbox != null && this.spinner.spin(document.body, mxResources.get('inserting')))
4297   - {
4298   - this.dropbox.insertLibrary(name, xml, mxUtils.bind(this, function(newFile)
4299   - {
  3612 + else if (mode == App.MODE_DROPBOX && this.dropbox != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3613 + this.dropbox.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
4300 3614 this.spinner.stop();
4301 3615 this.hideDialog(true);
4302 3616 this.libraryLoaded(newFile, images);
4303 3617 }), error, folderId);
4304 3618 }
4305   - else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('inserting')))
4306   - {
4307   - this.oneDrive.insertLibrary(name, xml, mxUtils.bind(this, function(newFile)
4308   - {
  3619 + else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
  3620 + this.oneDrive.insertLibrary(name, xml, mxUtils.bind(this, function (newFile) {
4309 3621 this.spinner.stop();
4310 3622 this.hideDialog(true);
4311 3623 this.libraryLoaded(newFile, images);
4312 3624 }), error, folderId);
4313 3625 }
4314   - else if (mode == App.MODE_BROWSER)
4315   - {
4316   - var fn = mxUtils.bind(this, function()
4317   - {
  3626 + else if (mode == App.MODE_BROWSER) {
  3627 + var fn = mxUtils.bind(this, function () {
4318 3628 var file = new StorageLibrary(this, xml, name);
4319 3629
4320 3630 // Inserts data into local storage
4321   - file.saveFile(name, false, mxUtils.bind(this, function()
4322   - {
  3631 + file.saveFile(name, false, mxUtils.bind(this, function () {
4323 3632 this.hideDialog(true);
4324 3633 this.libraryLoaded(file, images);
4325 3634 }), error);
4326 3635 });
4327 3636
4328   - if (localStorage.getItem(name) == null)
4329   - {
  3637 + if (localStorage.getItem(name) == null) {
4330 3638 fn();
4331 3639 }
4332   - else
4333   - {
  3640 + else {
4334 3641 this.confirm(mxResources.get('replaceIt', [name]), fn);
4335 3642 }
4336 3643 }
4337   - else
4338   - {
4339   - this.handleError({message: mxResources.get('serviceUnavailableOrBlocked')});
  3644 + else {
  3645 + this.handleError({ message: mxResources.get('serviceUnavailableOrBlocked') });
4340 3646 }
4341 3647 }));
4342 3648 }
4343   - else if (noSpin || this.spinner.spin(document.body, mxResources.get('saving')))
4344   - {
  3649 + else if (noSpin || this.spinner.spin(document.body, mxResources.get('saving'))) {
4345 3650 file.setData(xml);
4346 3651
4347   - var doSave = mxUtils.bind(this, function()
4348   - {
4349   - file.save(true, mxUtils.bind(this, function(resp)
4350   - {
  3652 + var doSave = mxUtils.bind(this, function () {
  3653 + file.save(true, mxUtils.bind(this, function (resp) {
4351 3654 this.spinner.stop();
4352 3655 this.hideDialog(true);
4353 3656
4354   - if (!noReload)
4355   - {
  3657 + if (!noReload) {
4356 3658 this.libraryLoaded(file, images);
4357 3659 }
4358 3660
4359   - if (fn != null)
4360   - {
  3661 + if (fn != null) {
4361 3662 fn();
4362 3663 }
4363 3664 }), error);
4364 3665 });
4365 3666
4366   - if (name != file.getTitle())
4367   - {
  3667 + if (name != file.getTitle()) {
4368 3668 var oldHash = file.getHash();
4369 3669
4370   - file.rename(name, mxUtils.bind(this, function(resp)
4371   - {
  3670 + file.rename(name, mxUtils.bind(this, function (resp) {
4372 3671 // Change hash in stored settings
4373   - if (file.constructor != LocalLibrary && oldHash != file.getHash())
4374   - {
  3672 + if (file.constructor != LocalLibrary && oldHash != file.getHash()) {
4375 3673 mxSettings.removeCustomLibrary(oldHash);
4376 3674 mxSettings.addCustomLibrary(file.getHash());
4377 3675 }
... ... @@ -4384,14 +3682,12 @@ App.prototype.saveLibrary = function(name, images, file, mode, noSpin, noReload,
4384 3682 doSave();
4385 3683 }), error)
4386 3684 }
4387   - else
4388   - {
  3685 + else {
4389 3686 doSave();
4390 3687 }
4391 3688 }
4392 3689 }
4393   - catch (e)
4394   - {
  3690 + catch (e) {
4395 3691 this.handleError(e);
4396 3692 }
4397 3693 };
... ... @@ -4399,48 +3695,37 @@ App.prototype.saveLibrary = function(name, images, file, mode, noSpin, noReload,
4399 3695 /**
4400 3696 * Adds the label menu items to the given menu and parent.
4401 3697 */
4402   -App.prototype.saveFile = function(forceDialog, success)
4403   -{
  3698 +App.prototype.saveFile = function (forceDialog, success) {
4404 3699 var file = this.getCurrentFile();
4405 3700
4406   - if (file != null)
4407   - {
  3701 + if (file != null) {
4408 3702 // FIXME: Invoke for local files
4409   - var done = mxUtils.bind(this, function()
4410   - {
4411   - if (EditorUi.enableDrafts)
4412   - {
  3703 + var done = mxUtils.bind(this, function () {
  3704 + if (EditorUi.enableDrafts) {
4413 3705 file.removeDraft();
4414 3706 }
4415 3707
4416   - if (this.getCurrentFile() != file && !file.isModified())
4417   - {
  3708 + if (this.getCurrentFile() != file && !file.isModified()) {
4418 3709 // Workaround for possible status update while save as dialog is showing
4419 3710 // is to show no saved status for device files
4420   - if (file.getMode() != App.MODE_DEVICE)
4421   - {
  3711 + if (file.getMode() != App.MODE_DEVICE) {
4422 3712 this.editor.setStatus(mxUtils.htmlEntities(mxResources.get('allChangesSaved')));
4423 3713 }
4424   - else
4425   - {
  3714 + else {
4426 3715 this.editor.setStatus('');
4427 3716 }
4428 3717 }
4429 3718
4430   - if (success != null)
4431   - {
  3719 + if (success != null) {
4432 3720 success();
4433 3721 }
4434 3722 });
4435 3723
4436   - if (!forceDialog && file.getTitle() != null && file.invalidFileHandle == null && this.mode != null)
4437   - {
  3724 + if (!forceDialog && file.getTitle() != null && file.invalidFileHandle == null && this.mode != null) {
4438 3725 this.save(file.getTitle(), done);
4439 3726 }
4440   - else if (file != null && file.constructor == LocalFile && file.fileHandle != null)
4441   - {
4442   - this.showSaveFilePicker(mxUtils.bind(this, function(fileHandle, desc)
4443   - {
  3727 + else if (file != null && file.constructor == LocalFile && file.fileHandle != null) {
  3728 + this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) {
4444 3729 file.invalidFileHandle = null;
4445 3730 file.fileHandle = fileHandle;
4446 3731 file.title = desc.name;
... ... @@ -4448,56 +3733,43 @@ App.prototype.saveFile = function(forceDialog, success)
4448 3733 this.save(desc.name, done);
4449 3734 }), null, this.createFileSystemOptions(file.getTitle()));
4450 3735 }
4451   - else
4452   - {
  3736 + else {
4453 3737 var filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename;
4454 3738 var allowTab = !mxClient.IS_IOS || !navigator.standalone;
4455 3739 var prev = this.mode;
4456 3740 var serviceCount = this.getServiceCount(true);
4457 3741
4458   - if (isLocalStorage)
4459   - {
  3742 + if (isLocalStorage) {
4460 3743 serviceCount++;
4461 3744 }
4462 3745
4463 3746 var rowLimit = (serviceCount <= 4) ? 2 : (serviceCount > 6 ? 4 : 3);
4464 3747
4465   - var dlg = new CreateDialog(this, filename, mxUtils.bind(this, function(name, mode, input)
4466   - {
4467   - if (name != null && name.length > 0)
4468   - {
  3748 + var dlg = new CreateDialog(this, filename, mxUtils.bind(this, function (name, mode, input) {
  3749 + if (name != null && name.length > 0) {
4469 3750 // Handles special case where PDF export is detected
4470   - if (/(\.pdf)$/i.test(name))
4471   - {
4472   - this.confirm(mxResources.get('didYouMeanToExportToPdf'), mxUtils.bind(this, function()
4473   - {
  3751 + if (/(\.pdf)$/i.test(name)) {
  3752 + this.confirm(mxResources.get('didYouMeanToExportToPdf'), mxUtils.bind(this, function () {
4474 3753 this.hideDialog();
4475 3754 this.actions.get('exportPdf').funct();
4476   - }), mxUtils.bind(this, function()
4477   - {
  3755 + }), mxUtils.bind(this, function () {
4478 3756 input.value = name.split('.').slice(0, -1).join('.');
4479 3757 input.focus();
4480 3758
4481   - if (mxClient.IS_GC || mxClient.IS_FF || document.documentMode >= 5)
4482   - {
  3759 + if (mxClient.IS_GC || mxClient.IS_FF || document.documentMode >= 5) {
4483 3760 input.select();
4484 3761 }
4485   - else
4486   - {
  3762 + else {
4487 3763 document.execCommand('selectAll', false, null);
4488 3764 }
4489 3765 }), mxResources.get('yes'), mxResources.get('no'));
4490 3766 }
4491   - else
4492   - {
  3767 + else {
4493 3768 this.hideDialog();
4494 3769
4495   - if (prev == null && mode == App.MODE_DEVICE)
4496   - {
4497   - if (file != null && EditorUi.nativeFileSupport)
4498   - {
4499   - this.showSaveFilePicker(mxUtils.bind(this, function(fileHandle, desc)
4500   - {
  3770 + if (prev == null && mode == App.MODE_DEVICE) {
  3771 + if (file != null && EditorUi.nativeFileSupport) {
  3772 + this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) {
4501 3773 file.fileHandle = fileHandle;
4502 3774 file.mode = App.MODE_DEVICE;
4503 3775 file.title = desc.name;
... ... @@ -4505,29 +3777,23 @@ App.prototype.saveFile = function(forceDialog, success)
4505 3777
4506 3778 this.setMode(App.MODE_DEVICE);
4507 3779 this.save(desc.name, done);
4508   - }), mxUtils.bind(this, function(e)
4509   - {
4510   - if (e.name != 'AbortError')
4511   - {
  3780 + }), mxUtils.bind(this, function (e) {
  3781 + if (e.name != 'AbortError') {
4512 3782 this.handleError(e);
4513 3783 }
4514 3784 }), this.createFileSystemOptions(name));
4515 3785 }
4516   - else
4517   - {
  3786 + else {
4518 3787 this.setMode(App.MODE_DEVICE);
4519 3788 this.save(name, done);
4520 3789 }
4521 3790 }
4522   - else if (mode == 'download')
4523   - {
  3791 + else if (mode == 'download') {
4524 3792 var tmp = new LocalFile(this, null, name);
4525 3793 tmp.save();
4526 3794 }
4527   - else if (mode == '_blank')
4528   - {
4529   - window.openFile = new OpenFile(function()
4530   - {
  3795 + else if (mode == '_blank') {
  3796 + window.openFile = new OpenFile(function () {
4531 3797 window.openFile = null;
4532 3798 });
4533 3799
... ... @@ -4535,24 +3801,20 @@ App.prototype.saveFile = function(forceDialog, success)
4535 3801 window.openFile.setData(this.getFileData(true));
4536 3802 this.openLink(this.getUrl(window.location.pathname), null, true);
4537 3803 }
4538   - else if (prev != mode)
4539   - {
4540   - this.pickFolder(mode, mxUtils.bind(this, function(folderId)
4541   - {
  3804 + else if (prev != mode) {
  3805 + this.pickFolder(mode, mxUtils.bind(this, function (folderId) {
4542 3806 this.createFile(name, this.getFileData(/(\.xml)$/i.test(name) ||
4543 3807 name.indexOf('.') < 0 || /(\.drawio)$/i.test(name),
4544 3808 /(\.svg)$/i.test(name), /(\.html)$/i.test(name)),
4545 3809 null, mode, done, this.mode == null, folderId);
4546 3810 }));
4547 3811 }
4548   - else if (mode != null)
4549   - {
  3812 + else if (mode != null) {
4550 3813 this.save(name, done);
4551 3814 }
4552 3815 }
4553 3816 }
4554   - }), mxUtils.bind(this, function()
4555   - {
  3817 + }), mxUtils.bind(this, function () {
4556 3818 this.hideDialog();
4557 3819 }), mxResources.get('saveAs'), mxResources.get('download'), null, null, allowTab,
4558 3820 null, true, rowLimit, null, null, null, this.editor.fileExtensions, false);
... ... @@ -4568,8 +3830,7 @@ App.prototype.saveFile = function(forceDialog, success)
4568 3830 * @param {number} dx X-coordinate of the translation.
4569 3831 * @param {number} dy Y-coordinate of the translation.
4570 3832 */
4571   -App.prototype.loadTemplate = function(url, onload, onerror, templateFilename, asLibrary)
4572   -{
  3833 +App.prototype.loadTemplate = function (url, onload, onerror, templateFilename, asLibrary) {
4573 3834 var base64 = false;
4574 3835 var realUrl = url;
4575 3836 var filterFn = (templateFilename != null) ? templateFilename : url;
... ... @@ -4577,86 +3838,67 @@ App.prototype.loadTemplate = function(url, onload, onerror, templateFilename, as
4577 3838 /(\.vs(x|sx?))($|\?)/i.test(filterFn);
4578 3839 var binary = /\.png$/i.test(filterFn) || /\.pdf$/i.test(filterFn);
4579 3840
4580   - if (!this.editor.isCorsEnabledForUrl(realUrl))
4581   - {
  3841 + if (!this.editor.isCorsEnabledForUrl(realUrl)) {
4582 3842 base64 = binary || isVisioFilename;
4583 3843 var nocache = 't=' + new Date().getTime();
4584 3844 realUrl = PROXY_URL + '?url=' + encodeURIComponent(url) +
4585 3845 '&' + nocache + ((base64) ? '&base64=1' : '');
4586 3846 }
4587 3847
4588   - this.editor.loadUrl(realUrl, mxUtils.bind(this, function(responseData)
4589   - {
4590   - try
4591   - {
  3848 + this.editor.loadUrl(realUrl, mxUtils.bind(this, function (responseData) {
  3849 + try {
4592 3850 var data = (!base64) ? responseData : ((window.atob && !mxClient.IS_IE && !mxClient.IS_IE11) ?
4593 3851 atob(responseData) : Base64.decode(responseData));
4594 3852
4595   - if (isVisioFilename || this.isVisioData(data))
4596   - {
  3853 + if (isVisioFilename || this.isVisioData(data)) {
4597 3854 // Adds filename to control converter code
4598   - if (!isVisioFilename)
4599   - {
4600   - if (asLibrary)
4601   - {
  3855 + if (!isVisioFilename) {
  3856 + if (asLibrary) {
4602 3857 filterFn = this.isRemoteVisioData(data) ? 'raw.vss' : 'raw.vssx';
4603 3858 }
4604   - else
4605   - {
  3859 + else {
4606 3860 filterFn = this.isRemoteVisioData(data) ? 'raw.vsd' : 'raw.vsdx';
4607 3861 }
4608 3862 }
4609 3863
4610   - this.importVisio(this.base64ToBlob(responseData.substring(responseData.indexOf(',') + 1)), function(xml)
4611   - {
  3864 + this.importVisio(this.base64ToBlob(responseData.substring(responseData.indexOf(',') + 1)), function (xml) {
4612 3865 onload(xml);
4613 3866 }, onerror, filterFn);
4614 3867 }
4615   - else if (new XMLHttpRequest().upload && this.isRemoteFileFormat(data, filterFn))
4616   - {
4617   - if (this.isExternalDataComms())
4618   - {
  3868 + else if (new XMLHttpRequest().upload && this.isRemoteFileFormat(data, filterFn)) {
  3869 + if (this.isExternalDataComms()) {
4619 3870 // Asynchronous parsing via server
4620   - this.parseFileData(data, mxUtils.bind(this, function(xhr)
4621   - {
  3871 + this.parseFileData(data, mxUtils.bind(this, function (xhr) {
4622 3872 if (xhr.readyState == 4 && xhr.status >= 200 && xhr.status <= 299 &&
4623   - xhr.responseText.substring(0, 13) == '<mxGraphModel')
4624   - {
  3873 + xhr.responseText.substring(0, 13) == '<mxGraphModel') {
4625 3874 onload(xhr.responseText);
4626 3875 }
4627 3876 }), url);
4628 3877 }
4629   - else
4630   - {
  3878 + else {
4631 3879 this.showError(mxResources.get('error'), mxResources.get('notInOffline'), null, onerror);
4632 3880 }
4633 3881 }
4634   - else if (this.isLucidChartData(data))
4635   - {
4636   - this.convertLucidChart(data, mxUtils.bind(this, function(xml)
4637   - {
  3882 + else if (this.isLucidChartData(data)) {
  3883 + this.convertLucidChart(data, mxUtils.bind(this, function (xml) {
4638 3884 onload(xml);
4639   - }), mxUtils.bind(this, function(e)
4640   - {
  3885 + }), mxUtils.bind(this, function (e) {
4641 3886 onerror(e);
4642 3887 }));
4643 3888 }
4644   - else
4645   - {
4646   - if (/(\.png)($|\?)/i.test(filterFn) || Editor.isPngData(data))
4647   - {
  3889 + else {
  3890 + if (/(\.png)($|\?)/i.test(filterFn) || Editor.isPngData(data)) {
4648 3891 data = Editor.extractGraphModelFromPng(responseData);
4649 3892 }
4650 3893
4651 3894 onload(data);
4652 3895 }
4653 3896 }
4654   - catch (e)
4655   - {
  3897 + catch (e) {
4656 3898 onerror(e);
4657 3899 }
4658 3900 }), onerror, /(\.png)($|\?)/i.test(filterFn) || /(\.v(dx|sdx?))($|\?)/i.test(filterFn) ||
4659   - /(\.vs(x|sx?))($|\?)/i.test(filterFn), null, null, base64);
  3901 + /(\.vs(x|sx?))($|\?)/i.test(filterFn), null, null, base64);
4660 3902 };
4661 3903
4662 3904 /**
... ... @@ -4665,34 +3907,26 @@ App.prototype.loadTemplate = function(url, onload, onerror, templateFilename, as
4665 3907 * @param {number} dx X-coordinate of the translation.
4666 3908 * @param {number} dy Y-coordinate of the translation.
4667 3909 */
4668   -App.prototype.getPeerForMode = function(mode)
4669   -{
4670   - if (mode == App.MODE_GOOGLE)
4671   - {
  3910 +App.prototype.getPeerForMode = function (mode) {
  3911 + if (mode == App.MODE_GOOGLE) {
4672 3912 return this.drive;
4673 3913 }
4674   - else if (mode == App.MODE_GITHUB)
4675   - {
  3914 + else if (mode == App.MODE_GITHUB) {
4676 3915 return this.gitHub;
4677 3916 }
4678   - else if (mode == App.MODE_GITLAB)
4679   - {
  3917 + else if (mode == App.MODE_GITLAB) {
4680 3918 return this.gitLab;
4681 3919 }
4682   - else if (mode == App.MODE_DROPBOX)
4683   - {
  3920 + else if (mode == App.MODE_DROPBOX) {
4684 3921 return this.dropbox;
4685 3922 }
4686   - else if (mode == App.MODE_ONEDRIVE)
4687   - {
  3923 + else if (mode == App.MODE_ONEDRIVE) {
4688 3924 return this.oneDrive;
4689 3925 }
4690   - else if (mode == App.MODE_TRELLO)
4691   - {
  3926 + else if (mode == App.MODE_TRELLO) {
4692 3927 return this.trello;
4693 3928 }
4694   - else
4695   - {
  3929 + else {
4696 3930 return null;
4697 3931 }
4698 3932 };
... ... @@ -4703,124 +3937,95 @@ App.prototype.getPeerForMode = function(mode)
4703 3937 * @param {number} dx X-coordinate of the translation.
4704 3938 * @param {number} dy Y-coordinate of the translation.
4705 3939 */
4706   -App.prototype.createFile = function(title, data, libs, mode, done, replace, folderId, tempFile, clibs)
4707   -{
  3940 +App.prototype.createFile = function (title, data, libs, mode, done, replace, folderId, tempFile, clibs) {
4708 3941 mode = (tempFile) ? null : ((mode != null) ? mode : this.mode);
4709 3942
4710   - if (title != null && this.spinner.spin(document.body, mxResources.get('inserting')))
4711   - {
  3943 + if (title != null && this.spinner.spin(document.body, mxResources.get('inserting'))) {
4712 3944 data = (data != null) ? data : this.emptyDiagramXml;
4713 3945
4714   - var complete = mxUtils.bind(this, function()
4715   - {
  3946 + var complete = mxUtils.bind(this, function () {
4716 3947 this.spinner.stop();
4717 3948 });
4718 3949
4719   - var error = mxUtils.bind(this, function(resp)
4720   - {
  3950 + var error = mxUtils.bind(this, function (resp) {
4721 3951 complete();
4722 3952
4723   - if (resp == null && this.getCurrentFile() == null && this.dialog == null)
4724   - {
  3953 + if (resp == null && this.getCurrentFile() == null && this.dialog == null) {
4725 3954 this.showSplash();
4726 3955 }
4727   - else if (resp != null)
4728   - {
  3956 + else if (resp != null) {
4729 3957 this.handleError(resp);
4730 3958 }
4731 3959 });
4732 3960
4733   - try
4734   - {
4735   - if (mode == App.MODE_GOOGLE && this.drive != null)
4736   - {
4737   - if (folderId == null && this.stateArg != null && this.stateArg.folderId != null)
4738   - {
  3961 + try {
  3962 + if (mode == App.MODE_GOOGLE && this.drive != null) {
  3963 + if (folderId == null && this.stateArg != null && this.stateArg.folderId != null) {
4739 3964 folderId = this.stateArg.folderId;
4740 3965 }
4741 3966
4742   - this.drive.insertFile(title, data, folderId, mxUtils.bind(this, function(file)
4743   - {
  3967 + this.drive.insertFile(title, data, folderId, mxUtils.bind(this, function (file) {
4744 3968 complete();
4745 3969 this.fileCreated(file, libs, replace, done, clibs);
4746 3970 }), error);
4747 3971 }
4748   - else if (mode == App.MODE_GITHUB && this.gitHub != null)
4749   - {
4750   - this.gitHub.insertFile(title, data, mxUtils.bind(this, function(file)
4751   - {
  3972 + else if (mode == App.MODE_GITHUB && this.gitHub != null) {
  3973 + this.gitHub.insertFile(title, data, mxUtils.bind(this, function (file) {
4752 3974 complete();
4753 3975 this.fileCreated(file, libs, replace, done, clibs);
4754 3976 }), error, false, folderId);
4755 3977 }
4756   - else if (mode == App.MODE_GITLAB && this.gitLab != null)
4757   - {
4758   - this.gitLab.insertFile(title, data, mxUtils.bind(this, function(file)
4759   - {
  3978 + else if (mode == App.MODE_GITLAB && this.gitLab != null) {
  3979 + this.gitLab.insertFile(title, data, mxUtils.bind(this, function (file) {
4760 3980 complete();
4761 3981 this.fileCreated(file, libs, replace, done, clibs);
4762 3982 }), error, false, folderId);
4763 3983 }
4764   - else if (mode == App.MODE_TRELLO && this.trello != null)
4765   - {
4766   - this.trello.insertFile(title, data, mxUtils.bind(this, function(file)
4767   - {
  3984 + else if (mode == App.MODE_TRELLO && this.trello != null) {
  3985 + this.trello.insertFile(title, data, mxUtils.bind(this, function (file) {
4768 3986 complete();
4769 3987 this.fileCreated(file, libs, replace, done, clibs);
4770 3988 }), error, false, folderId);
4771 3989 }
4772   - else if (mode == App.MODE_DROPBOX && this.dropbox != null)
4773   - {
4774   - this.dropbox.insertFile(title, data, mxUtils.bind(this, function(file)
4775   - {
  3990 + else if (mode == App.MODE_DROPBOX && this.dropbox != null) {
  3991 + this.dropbox.insertFile(title, data, mxUtils.bind(this, function (file) {
4776 3992 complete();
4777 3993 this.fileCreated(file, libs, replace, done, clibs);
4778 3994 }), error);
4779 3995 }
4780   - else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null)
4781   - {
4782   - this.oneDrive.insertFile(title, data, mxUtils.bind(this, function(file)
4783   - {
  3996 + else if (mode == App.MODE_ONEDRIVE && this.oneDrive != null) {
  3997 + this.oneDrive.insertFile(title, data, mxUtils.bind(this, function (file) {
4784 3998 complete();
4785 3999 this.fileCreated(file, libs, replace, done, clibs);
4786 4000 }), error, false, folderId);
4787 4001 }
4788   - else if (mode == App.MODE_BROWSER)
4789   - {
4790   - StorageFile.insertFile(this, title, data, mxUtils.bind(this, function(file)
4791   - {
  4002 + else if (mode == App.MODE_BROWSER) {
  4003 + StorageFile.insertFile(this, title, data, mxUtils.bind(this, function (file) {
4792 4004 complete();
4793 4005 this.fileCreated(file, libs, replace, done, clibs);
4794 4006 }), error);
4795 4007 }
4796   - else if (!tempFile && mode == App.MODE_DEVICE && EditorUi.nativeFileSupport)
4797   - {
  4008 + else if (!tempFile && mode == App.MODE_DEVICE && EditorUi.nativeFileSupport) {
4798 4009 complete();
4799 4010
4800   - this.showSaveFilePicker(mxUtils.bind(this, function(fileHandle, desc)
4801   - {
  4011 + this.showSaveFilePicker(mxUtils.bind(this, function (fileHandle, desc) {
4802 4012 var file = new LocalFile(this, data, desc.name, null, fileHandle, desc);
4803 4013
4804   - file.saveFile(desc.name, false, mxUtils.bind(this, function()
4805   - {
  4014 + file.saveFile(desc.name, false, mxUtils.bind(this, function () {
4806 4015 this.fileCreated(file, libs, replace, done, clibs);
4807 4016 }), error, true);
4808   - }), mxUtils.bind(this, function(e)
4809   - {
4810   - if (e.name != 'AbortError')
4811   - {
  4017 + }), mxUtils.bind(this, function (e) {
  4018 + if (e.name != 'AbortError') {
4812 4019 error(e);
4813 4020 }
4814 4021 }), this.createFileSystemOptions(title));
4815 4022 }
4816   - else
4817   - {
  4023 + else {
4818 4024 complete();
4819 4025 this.fileCreated(new LocalFile(this, data, title, mode == null), libs, replace, done, clibs);
4820 4026 }
4821 4027 }
4822   - catch (e)
4823   - {
  4028 + catch (e) {
4824 4029 complete();
4825 4030 this.handleError(e);
4826 4031 }
... ... @@ -4833,32 +4038,27 @@ App.prototype.createFile = function(title, data, libs, mode, done, replace, fold
4833 4038 * @param {number} dx X-coordinate of the translation.
4834 4039 * @param {number} dy Y-coordinate of the translation.
4835 4040 */
4836   -App.prototype.fileCreated = function(file, libs, replace, done, clibs)
4837   -{
  4041 +App.prototype.fileCreated = function (file, libs, replace, done, clibs) {
4838 4042 var url = window.location.pathname;
4839 4043
4840   - if (libs != null && libs.length > 0)
4841   - {
  4044 + if (libs != null && libs.length > 0) {
4842 4045 url += '?libs=' + libs;
4843 4046 }
4844 4047
4845   - if (clibs != null && clibs.length > 0)
4846   - {
  4048 + if (clibs != null && clibs.length > 0) {
4847 4049 url += '?clibs=' + clibs;
4848 4050 }
4849 4051
4850 4052 url = this.getUrl(url);
4851 4053
4852 4054 // Always opens a new tab for local files to avoid losing changes
4853   - if (file.getMode() != App.MODE_DEVICE)
4854   - {
  4055 + if (file.getMode() != App.MODE_DEVICE) {
4855 4056 url += '#' + file.getHash();
4856 4057 }
4857 4058
4858 4059 // Makes sure to produce consistent output with finalized files via createFileData this needs
4859 4060 // to save the file again since it needs the newly created file ID for redirecting in HTML
4860   - if (this.spinner.spin(document.body, mxResources.get('inserting')))
4861   - {
  4061 + if (this.spinner.spin(document.body, mxResources.get('inserting'))) {
4862 4062 var data = file.getData();
4863 4063 var dataNode = (data.length > 0) ? this.editor.extractGraphModel(
4864 4064 mxUtils.parseXml(data).documentElement, true) : null;
... ... @@ -4867,8 +4067,7 @@ App.prototype.fileCreated = function(file, libs, replace, done, clibs)
4867 4067 var graph = null;
4868 4068
4869 4069 // Handles special case where SVG files need a rendered graph to be saved
4870   - if (dataNode != null && /\.svg$/i.test(file.getTitle()))
4871   - {
  4070 + if (dataNode != null && /\.svg$/i.test(file.getTitle())) {
4872 4071 graph = this.createTemporaryGraph(this.editor.graph.getStylesheet());
4873 4072 document.body.appendChild(graph.container);
4874 4073 node = this.decodeNodeIntoGraph(node, graph);
... ... @@ -4876,49 +4075,40 @@ App.prototype.fileCreated = function(file, libs, replace, done, clibs)
4876 4075
4877 4076 file.setData(this.createFileData(dataNode, graph, file, redirect));
4878 4077
4879   - if (graph != null)
4880   - {
  4078 + if (graph != null) {
4881 4079 graph.container.parentNode.removeChild(graph.container);
4882 4080 }
4883 4081
4884   - var complete = mxUtils.bind(this, function()
4885   - {
  4082 + var complete = mxUtils.bind(this, function () {
4886 4083 this.spinner.stop();
4887 4084 });
4888 4085
4889   - var fn = mxUtils.bind(this, function()
4890   - {
  4086 + var fn = mxUtils.bind(this, function () {
4891 4087 complete();
4892 4088
4893 4089 var currentFile = this.getCurrentFile();
4894 4090
4895   - if (replace == null && currentFile != null)
4896   - {
  4091 + if (replace == null && currentFile != null) {
4897 4092 replace = !currentFile.isModified() && currentFile.getMode() == null;
4898 4093 }
4899 4094
4900   - var fn3 = mxUtils.bind(this, function()
4901   - {
  4095 + var fn3 = mxUtils.bind(this, function () {
4902 4096 window.openFile = null;
4903 4097 this.fileLoaded(file);
4904 4098
4905   - if (replace)
4906   - {
  4099 + if (replace) {
4907 4100 file.addAllSavedStatus();
4908 4101 }
4909 4102
4910   - if (libs != null)
4911   - {
  4103 + if (libs != null) {
4912 4104 this.sidebar.showEntries(libs);
4913 4105 }
4914 4106
4915   - if (clibs != null)
4916   - {
  4107 + if (clibs != null) {
4917 4108 var temp = [];
4918 4109 var tokens = clibs.split(';');
4919 4110
4920   - for (var i = 0; i < tokens.length; i++)
4921   - {
  4111 + for (var i = 0; i < tokens.length; i++) {
4922 4112 temp.push(decodeURIComponent(tokens[i]));
4923 4113 }
4924 4114
... ... @@ -4926,67 +4116,53 @@ App.prototype.fileCreated = function(file, libs, replace, done, clibs)
4926 4116 }
4927 4117 });
4928 4118
4929   - var fn2 = mxUtils.bind(this, function()
4930   - {
4931   - if (replace || currentFile == null || !currentFile.isModified())
4932   - {
  4119 + var fn2 = mxUtils.bind(this, function () {
  4120 + if (replace || currentFile == null || !currentFile.isModified()) {
4933 4121 fn3();
4934 4122 }
4935   - else
4936   - {
  4123 + else {
4937 4124 this.confirm(mxResources.get('allChangesLost'), null, fn3,
4938 4125 mxResources.get('cancel'), mxResources.get('discardChanges'));
4939 4126 }
4940 4127 });
4941 4128
4942   - if (done != null)
4943   - {
  4129 + if (done != null) {
4944 4130 done();
4945 4131 }
4946 4132
4947 4133 // Opens the file in a new window
4948   - if (replace != null && !replace)
4949   - {
  4134 + if (replace != null && !replace) {
4950 4135 // Opens local file in a new window
4951   - if (file.constructor == LocalFile)
4952   - {
4953   - window.openFile = new OpenFile(function()
4954   - {
  4136 + if (file.constructor == LocalFile) {
  4137 + window.openFile = new OpenFile(function () {
4955 4138 window.openFile = null;
4956 4139 });
4957 4140
4958 4141 window.openFile.setData(file.getData(), file.getTitle(), file.getMode() == null);
4959 4142 }
4960 4143
4961   - if (done != null)
4962   - {
  4144 + if (done != null) {
4963 4145 done();
4964 4146 }
4965 4147
4966 4148 window.openWindow(url, null, fn2);
4967 4149 }
4968   - else
4969   - {
  4150 + else {
4970 4151 fn2();
4971 4152 }
4972 4153 });
4973 4154
4974 4155 // Updates data in memory for local files
4975   - if (file.constructor == LocalFile)
4976   - {
  4156 + if (file.constructor == LocalFile) {
4977 4157 fn();
4978 4158 }
4979   - else
4980   - {
4981   - file.saveFile(file.getTitle(), false, mxUtils.bind(this, function()
4982   - {
  4159 + else {
  4160 + file.saveFile(file.getTitle(), false, mxUtils.bind(this, function () {
4983 4161 fn();
4984   - }), mxUtils.bind(this, function(resp)
4985   - {
  4162 + }), mxUtils.bind(this, function (resp) {
4986 4163 complete();
4987 4164
4988   - if (resp == null || resp.name != 'AbortError')
4989   - {
  4165 + if (resp == null || resp.name != 'AbortError') {
4990 4166 this.handleError(resp);
4991 4167 }
4992 4168 }));
... ... @@ -5024,71 +4200,71 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
5024 4200
5025 4201 if (urlParams.userId) {
5026 4202 axios.get(`/api/yt/third/login/id/${urlParams.userId}`)
5027   - .then(res => {
5028   - const {token, refreshToken} = res.data || {}
5029   - GLOBAL_TOKEN.token = token
5030   - GLOBAL_TOKEN.refreshToken = refreshToken
5031   - getSaveContent()
5032   - })
  4203 + .then(res => {
  4204 + const { token, refreshToken } = res.data || {}
  4205 + GLOBAL_TOKEN.token = token
  4206 + GLOBAL_TOKEN.refreshToken = refreshToken
  4207 + getSaveContent()
  4208 + })
5033 4209 } else {
5034 4210 getSaveContent()
5035 4211 }
5036 4212 }
5037 4213
5038 4214 getToken()
5039   -
  4215 +
5040 4216 var updateButtonContainer = this.updateButtonContainer
5041 4217 // var lockUnlock = this.actions.actions.lockUnlock.funct
5042 4218 // var selectAll = this.actions.actions.selectAll.funct
5043 4219 function getUserPermission() {
5044   - defHttp.get('/yt/role/me/permissions')
5045   - .then(res => {
5046   - USER_PERMISSION.permission = res
5047   - console.log({USER_PERMISSION})
5048   - updateButtonContainer()
5049   - // var flag = hasSavePermission()
5050   - // if (!flag) {
5051   - // selectAll()
5052   - // lockUnlock()
5053   - // }
5054   - })
  4220 + defHttp.get('/yt/role/me/permissions')
  4221 + .then(res => {
  4222 + USER_PERMISSION.permission = res
  4223 + console.log({ USER_PERMISSION })
  4224 + updateButtonContainer()
  4225 + // var flag = hasSavePermission()
  4226 + // if (!flag) {
  4227 + // selectAll()
  4228 + // lockUnlock()
  4229 + // }
  4230 + })
5055 4231 }
5056 4232
5057 4233 // 调用API,获取保存的内容
5058 4234 function getSaveContent() {
5059   - defHttp.get('/yt/configuration/center/getConfigurationInfo/'+Editor.configurationId)
  4235 + defHttp.get('/yt/configuration/center/getConfigurationInfo/' + Editor.configurationId)
5060 4236 .then(function (response) {
5061   - console.log({response})
  4237 + console.log({ response })
5062 4238 const { platform } = response || {}
5063 4239 const pageSizeControl = PageSetupDialog.getFormats
5064 4240 PageSetupDialog.getFormats = function () {
5065 4241 if (platform === 'phone') {
5066   - return [
5067   - {key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667)},
5068   - {key: 'iPhone 8 Plus', title: 'iPhone 8 Plus', format: new mxRectangle(0, 0, 415, 737)},
5069   - {key: 'iPhone X/XS', title: 'iPhone X/XS', format: new mxRectangle(0, 0, 376, 813)},
5070   - {key: 'iPhone XR/XS Max', title: 'iPhone XR/XS Max', format: new mxRectangle(0, 0, 415, 897)},
5071   - {key: 'iPad 4', title: 'iPad 4', format: new mxRectangle(0, 0, 709, 1025)},
5072   - {key: 'Galaxy S9', title: 'Galaxy S9', format: new mxRectangle(0, 0, 361, 741)},
5073   - {key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741)},
5074   - {key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741)},
5075   - {key: 'Galaxy S10/S10+', title: 'Galaxy S10/S10+', format: new mxRectangle(0, 0, 413, 870)},
5076   - {key: 'Pixel 2', title: 'Pixel 2', format: new mxRectangle(0, 0, 413, 732)},
5077   - {key: 'Pixel 3', title: 'Pixel 3', format: new mxRectangle(0, 0, 413, 825)},
5078   - {key: 'Pixel 3', title: 'Pixel 3', format: new mxRectangle(0, 0, 413, 825)},
5079   - {key: 'Pixel XL', title: 'Pixel XL', format: new mxRectangle(0, 0, 413, 848)},
5080   - {key: 'custom', title: mxResources.get('custom'), format: null}
  4242 + return [
  4243 + { key: 'iPhone 8', title: 'iPhone 8', format: new mxRectangle(0, 0, 375, 667) },
  4244 + { key: 'iPhone 8 Plus', title: 'iPhone 8 Plus', format: new mxRectangle(0, 0, 415, 737) },
  4245 + { key: 'iPhone X/XS', title: 'iPhone X/XS', format: new mxRectangle(0, 0, 376, 813) },
  4246 + { key: 'iPhone XR/XS Max', title: 'iPhone XR/XS Max', format: new mxRectangle(0, 0, 415, 897) },
  4247 + { key: 'iPad 4', title: 'iPad 4', format: new mxRectangle(0, 0, 709, 1025) },
  4248 + { key: 'Galaxy S9', title: 'Galaxy S9', format: new mxRectangle(0, 0, 361, 741) },
  4249 + { key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741) },
  4250 + { key: 'Galaxy S10E', title: 'Galaxy S10E', format: new mxRectangle(0, 0, 361, 741) },
  4251 + { key: 'Galaxy S10/S10+', title: 'Galaxy S10/S10+', format: new mxRectangle(0, 0, 413, 870) },
  4252 + { key: 'Pixel 2', title: 'Pixel 2', format: new mxRectangle(0, 0, 413, 732) },
  4253 + { key: 'Pixel 3', title: 'Pixel 3', format: new mxRectangle(0, 0, 413, 825) },
  4254 + { key: 'Pixel 3', title: 'Pixel 3', format: new mxRectangle(0, 0, 413, 825) },
  4255 + { key: 'Pixel XL', title: 'Pixel XL', format: new mxRectangle(0, 0, 413, 848) },
  4256 + { key: 'custom', title: mxResources.get('custom'), format: null }
5081 4257 ]
5082 4258 }
5083 4259 return pageSizeControl.apply(this, arguments)
5084 4260 }
5085 4261 Editor.configurationName = response.configurationName + ".drawio";
5086   - if(response.configurationContentList.length > 0){
5087   - response.configurationContentList.forEach((item)=>{
  4262 + if (response.configurationContentList.length > 0) {
  4263 + response.configurationContentList.forEach((item) => {
5088 4264 Editor.configurationContentId = item.id;
5089   - if(item.content){
  4265 + if (item.content) {
5090 4266 Editor.defaultContent = item.content;
5091   - }else{
  4267 + } else {
5092 4268 //默认空白内容
5093 4269 Editor.defaultContent = EditorUi.prototype.emptyDiagramXml;
5094 4270 }
... ... @@ -5110,11 +4286,11 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
5110 4286 });
5111 4287 }
5112 4288
5113   -
  4289 +
5114 4290 this.hideDialog();
5115 4291 var fn2 = mxUtils.bind(this, function () {
5116 4292 //加载数据开始
5117   - var fileHandle = {kind: 'file', name: Editor.configurationName};
  4293 + var fileHandle = { kind: 'file', name: Editor.configurationName };
5118 4294 var file = {
5119 4295 name: Editor.configurationName,
5120 4296 type: "",
... ... @@ -5525,41 +4701,32 @@ App.prototype.loadFile = function (id, sameWindow, file, success, force) {
5525 4701 * @param {number} dx X-coordinate of the translation.
5526 4702 * @param {number} dy Y-coordinate of the translation.
5527 4703 */
5528   -App.prototype.getLibraryStorageHint = function(file)
5529   -{
  4704 +App.prototype.getLibraryStorageHint = function (file) {
5530 4705 var tip = file.getTitle();
5531 4706
5532   - if (file.constructor != LocalLibrary)
5533   - {
  4707 + if (file.constructor != LocalLibrary) {
5534 4708 tip += '\n' + file.getHash();
5535 4709 }
5536 4710
5537   - if (file.constructor == DriveLibrary)
5538   - {
  4711 + if (file.constructor == DriveLibrary) {
5539 4712 tip += ' (' + mxResources.get('googleDrive') + ')';
5540 4713 }
5541   - else if (file.constructor == GitHubLibrary)
5542   - {
  4714 + else if (file.constructor == GitHubLibrary) {
5543 4715 tip += ' (' + mxResources.get('github') + ')';
5544 4716 }
5545   - else if (file.constructor == TrelloLibrary)
5546   - {
  4717 + else if (file.constructor == TrelloLibrary) {
5547 4718 tip += ' (' + mxResources.get('trello') + ')';
5548 4719 }
5549   - else if (file.constructor == DropboxLibrary)
5550   - {
  4720 + else if (file.constructor == DropboxLibrary) {
5551 4721 tip += ' (' + mxResources.get('dropbox') + ')';
5552 4722 }
5553   - else if (file.constructor == OneDriveLibrary)
5554   - {
  4723 + else if (file.constructor == OneDriveLibrary) {
5555 4724 tip += ' (' + mxResources.get('oneDrive') + ')';
5556 4725 }
5557   - else if (file.constructor == StorageLibrary)
5558   - {
  4726 + else if (file.constructor == StorageLibrary) {
5559 4727 tip += ' (' + mxResources.get('browser') + ')';
5560 4728 }
5561   - else if (file.constructor == LocalLibrary)
5562   - {
  4729 + else if (file.constructor == LocalLibrary) {
5563 4730 tip += ' (' + mxResources.get('device') + ')';
5564 4731 }
5565 4732
... ... @@ -5569,17 +4736,13 @@ App.prototype.getLibraryStorageHint = function(file)
5569 4736 /**
5570 4737 * Updates action states depending on the selection.
5571 4738 */
5572   -App.prototype.restoreLibraries = function()
5573   -{
  4739 +App.prototype.restoreLibraries = function () {
5574 4740 var checked = [];
5575 4741
5576   - function addLibs(libs)
5577   - {
5578   - for (var i = 0; i < libs.length; i++)
5579   - {
  4742 + function addLibs(libs) {
  4743 + for (var i = 0; i < libs.length; i++) {
5580 4744 if (libs[i] != '' && mxUtils.indexOf(
5581   - checked, libs[i]) < 0)
5582   - {
  4745 + checked, libs[i]) < 0) {
5583 4746 checked.push(libs[i]);
5584 4747 }
5585 4748 }
... ... @@ -5593,20 +4756,15 @@ App.prototype.restoreLibraries = function()
5593 4756 /**
5594 4757 * Updates action states depending on the selection.
5595 4758 */
5596   -App.prototype.loadLibraries = function(libs, done)
5597   -{
5598   - if (this.sidebar != null)
5599   - {
5600   - if (this.loadedLibraries == null)
5601   - {
  4759 +App.prototype.loadLibraries = function (libs, done) {
  4760 + if (this.sidebar != null) {
  4761 + if (this.loadedLibraries == null) {
5602 4762 this.loadedLibraries = new Object();
5603 4763 }
5604 4764
5605 4765 // Ignores this library next time
5606   - var ignore = mxUtils.bind(this, function(id, keep)
5607   - {
5608   - if (!keep)
5609   - {
  4766 + var ignore = mxUtils.bind(this, function (id, keep) {
  4767 + if (!keep) {
5610 4768 mxSettings.removeCustomLibrary(id);
5611 4769 }
5612 4770
... ... @@ -5618,52 +4776,40 @@ App.prototype.loadLibraries = function(libs, done)
5618 4776 var idx = (libs.length > 0 && libs[0] == 'L.scratchpad') ? 1 : 0;
5619 4777
5620 4778 // Loads in order of libs array
5621   - var checkDone = mxUtils.bind(this, function()
5622   - {
5623   - if (waiting == 0)
5624   - {
5625   - if (libs != null)
5626   - {
5627   - for (var i = libs.length - 1; i >= 0; i--)
5628   - {
5629   - if (files[i] != null)
5630   - {
  4779 + var checkDone = mxUtils.bind(this, function () {
  4780 + if (waiting == 0) {
  4781 + if (libs != null) {
  4782 + for (var i = libs.length - 1; i >= 0; i--) {
  4783 + if (files[i] != null) {
5631 4784 this.loadLibrary(files[i], i <= idx);
5632 4785 }
5633 4786 }
5634 4787 }
5635 4788
5636   - if (done != null)
5637   - {
  4789 + if (done != null) {
5638 4790 done();
5639 4791 }
5640 4792 }
5641 4793 });
5642 4794
5643   - if (libs != null)
5644   - {
5645   - for (var i = 0; i < libs.length; i++)
5646   - {
  4795 + if (libs != null) {
  4796 + for (var i = 0; i < libs.length; i++) {
5647 4797 var name = encodeURIComponent(decodeURIComponent(libs[i]));
5648 4798
5649   - (mxUtils.bind(this, function(id, index)
5650   - {
  4799 + (mxUtils.bind(this, function (id, index) {
5651 4800 if (id != null && id.length > 0 && this.loadedLibraries[id] == null &&
5652   - this.sidebar.palettes[id] == null)
5653   - {
  4801 + this.sidebar.palettes[id] == null) {
5654 4802 // Waits for all libraries to load
5655 4803 this.loadedLibraries[id] = true;
5656 4804 waiting++;
5657 4805
5658   - var onload = mxUtils.bind(this, function(file)
5659   - {
  4806 + var onload = mxUtils.bind(this, function (file) {
5660 4807 files[index] = file;
5661 4808 waiting--;
5662 4809 checkDone();
5663 4810 });
5664 4811
5665   - var onerror = mxUtils.bind(this, function(keep)
5666   - {
  4812 + var onerror = mxUtils.bind(this, function (keep) {
5667 4813 ignore(id, keep);
5668 4814 waiting--;
5669 4815 checkDone();
... ... @@ -5671,170 +4817,127 @@ App.prototype.loadLibraries = function(libs, done)
5671 4817
5672 4818 var service = id.substring(0, 1);
5673 4819
5674   - if (service == 'L')
5675   - {
5676   - if (isLocalStorage || mxClient.IS_CHROMEAPP)
5677   - {
  4820 + if (service == 'L') {
  4821 + if (isLocalStorage || mxClient.IS_CHROMEAPP) {
5678 4822 // Make asynchronous for barrier to work
5679   - window.setTimeout(mxUtils.bind(this, function()
5680   - {
5681   - try
5682   - {
  4823 + window.setTimeout(mxUtils.bind(this, function () {
  4824 + try {
5683 4825 var name = decodeURIComponent(id.substring(1));
5684 4826
5685   - StorageFile.getFileContent(this, name, mxUtils.bind(this, function(xml)
5686   - {
5687   - if (name == '.scratchpad' && xml == null)
5688   - {
  4827 + StorageFile.getFileContent(this, name, mxUtils.bind(this, function (xml) {
  4828 + if (name == '.scratchpad' && xml == null) {
5689 4829 xml = this.emptyLibraryXml;
5690 4830 }
5691 4831
5692   - if (xml != null)
5693   - {
  4832 + if (xml != null) {
5694 4833 onload(new StorageLibrary(this, xml, name));
5695 4834 }
5696   - else
5697   - {
  4835 + else {
5698 4836 onerror();
5699 4837 }
5700 4838 }), onerror);
5701 4839 }
5702   - catch (e)
5703   - {
  4840 + catch (e) {
5704 4841 onerror();
5705 4842 }
5706 4843 }), 0);
5707 4844 }
5708 4845 }
5709   - else if (service == 'U')
5710   - {
  4846 + else if (service == 'U') {
5711 4847 var url = decodeURIComponent(id.substring(1));
5712 4848
5713   - if (!this.isOffline())
5714   - {
5715   - this.loadTemplate(url, mxUtils.bind(this, function(text)
5716   - {
5717   - if (text != null && text.length > 0)
5718   - {
  4849 + if (!this.isOffline()) {
  4850 + this.loadTemplate(url, mxUtils.bind(this, function (text) {
  4851 + if (text != null && text.length > 0) {
5719 4852 // LATER: Convert mxfile to mxlibrary using code from libraryLoaded
5720 4853 onload(new UrlLibrary(this, text, url));
5721 4854 }
5722   - else
5723   - {
  4855 + else {
5724 4856 onerror();
5725 4857 }
5726   - }), function()
5727   - {
  4858 + }), function () {
5728 4859 onerror();
5729 4860 }, null, true);
5730 4861 }
5731 4862 }
5732   - else if (service == 'R')
5733   - {
  4863 + else if (service == 'R') {
5734 4864 var libDesc = decodeURIComponent(id.substring(1));
5735 4865
5736   - try
5737   - {
  4866 + try {
5738 4867 libDesc = JSON.parse(libDesc);
5739 4868 var libObj = {
5740 4869 id: libDesc[0],
5741   - title: libDesc[1],
5742   - downloadUrl: libDesc[2]
  4870 + title: libDesc[1],
  4871 + downloadUrl: libDesc[2]
5743 4872 }
5744 4873
5745   - this.remoteInvoke('getFileContent', [libObj.downloadUrl], null, mxUtils.bind(this, function(libContent)
5746   - {
5747   - try
5748   - {
  4874 + this.remoteInvoke('getFileContent', [libObj.downloadUrl], null, mxUtils.bind(this, function (libContent) {
  4875 + try {
5749 4876 onload(new RemoteLibrary(this, libContent, libObj));
5750 4877 }
5751   - catch (e)
5752   - {
  4878 + catch (e) {
5753 4879 onerror();
5754 4880 }
5755   - }), function()
5756   - {
  4881 + }), function () {
5757 4882 onerror();
5758 4883 });
5759 4884 }
5760   - catch (e)
5761   - {
  4885 + catch (e) {
5762 4886 onerror();
5763 4887 }
5764 4888 }
5765   - else if (service == 'S' && this.loadDesktopLib != null)
5766   - {
5767   - try
5768   - {
5769   - this.loadDesktopLib(decodeURIComponent(id.substring(1)), function(desktopLib)
5770   - {
  4889 + else if (service == 'S' && this.loadDesktopLib != null) {
  4890 + try {
  4891 + this.loadDesktopLib(decodeURIComponent(id.substring(1)), function (desktopLib) {
5771 4892 onload(desktopLib);
5772 4893 }, onerror);
5773 4894 }
5774   - catch (e)
5775   - {
  4895 + catch (e) {
5776 4896 onerror();
5777 4897 }
5778 4898 }
5779   - else
5780   - {
  4899 + else {
5781 4900 var peer = null;
5782 4901
5783   - if (service == 'G')
5784   - {
5785   - if (this.drive != null && this.drive.user != null)
5786   - {
  4902 + if (service == 'G') {
  4903 + if (this.drive != null && this.drive.user != null) {
5787 4904 peer = this.drive;
5788 4905 }
5789 4906 }
5790   - else if (service == 'H')
5791   - {
5792   - if (this.gitHub != null && this.gitHub.getUser() != null)
5793   - {
  4907 + else if (service == 'H') {
  4908 + if (this.gitHub != null && this.gitHub.getUser() != null) {
5794 4909 peer = this.gitHub;
5795 4910 }
5796 4911 }
5797   - else if (service == 'T')
5798   - {
5799   - if (this.trello != null && this.trello.isAuthorized())
5800   - {
  4912 + else if (service == 'T') {
  4913 + if (this.trello != null && this.trello.isAuthorized()) {
5801 4914 peer = this.trello;
5802 4915 }
5803 4916 }
5804   - else if (service == 'D')
5805   - {
5806   - if (this.dropbox != null && this.dropbox.getUser() != null)
5807   - {
  4917 + else if (service == 'D') {
  4918 + if (this.dropbox != null && this.dropbox.getUser() != null) {
5808 4919 peer = this.dropbox;
5809 4920 }
5810 4921 }
5811   - else if (service == 'W')
5812   - {
5813   - if (this.oneDrive != null && this.oneDrive.getUser() != null)
5814   - {
  4922 + else if (service == 'W') {
  4923 + if (this.oneDrive != null && this.oneDrive.getUser() != null) {
5815 4924 peer = this.oneDrive;
5816 4925 }
5817 4926 }
5818 4927
5819   - if (peer != null)
5820   - {
5821   - peer.getLibrary(decodeURIComponent(id.substring(1)), mxUtils.bind(this, function(file)
5822   - {
5823   - try
5824   - {
  4928 + if (peer != null) {
  4929 + peer.getLibrary(decodeURIComponent(id.substring(1)), mxUtils.bind(this, function (file) {
  4930 + try {
5825 4931 onload(file);
5826 4932 }
5827   - catch (e)
5828   - {
  4933 + catch (e) {
5829 4934 onerror();
5830 4935 }
5831   - }), function(resp)
5832   - {
  4936 + }), function (resp) {
5833 4937 onerror();
5834 4938 });
5835 4939 }
5836   - else
5837   - {
  4940 + else {
5838 4941 onerror(true);
5839 4942 }
5840 4943 }
... ... @@ -5844,8 +4947,7 @@ App.prototype.loadLibraries = function(libs, done)
5844 4947
5845 4948 checkDone();
5846 4949 }
5847   - else
5848   - {
  4950 + else {
5849 4951 checkDone();
5850 4952 }
5851 4953 }
... ... @@ -5857,32 +4959,25 @@ App.prototype.loadLibraries = function(libs, done)
5857 4959 * @param {number} dx X-coordinate of the translation.
5858 4960 * @param {number} dy Y-coordinate of the translation.
5859 4961 */
5860   -App.prototype.updateButtonContainer = function()
5861   -{
5862   - if (this.buttonContainer != null)
5863   - {
  4962 +App.prototype.updateButtonContainer = function () {
  4963 + if (this.buttonContainer != null) {
5864 4964 var file = this.getCurrentFile();
5865 4965
5866   - if (urlParams['embed'] == '1')
5867   - {
5868   - if (uiTheme == 'atlas' || urlParams['atlas'] == '1')
5869   - {
  4966 + if (urlParams['embed'] == '1') {
  4967 + if (uiTheme == 'atlas' || urlParams['atlas'] == '1') {
5870 4968 this.buttonContainer.style.paddingRight = '12px';
5871 4969 this.buttonContainer.style.paddingTop = '6px';
5872   - this.buttonContainer.style.right = urlParams['noLangIcon'] == '1'? '0' : '25px';
  4970 + this.buttonContainer.style.right = urlParams['noLangIcon'] == '1' ? '0' : '25px';
5873 4971 }
5874   - else if (uiTheme != 'min')
5875   - {
  4972 + else if (uiTheme != 'min') {
5876 4973 this.buttonContainer.style.paddingRight = '38px';
5877 4974 this.buttonContainer.style.paddingTop = '6px';
5878 4975 }
5879 4976 }
5880 4977
5881 4978 // Comments
5882   - if (this.commentsSupported() && urlParams['sketch'] != '1')
5883   - {
5884   - if (this.commentButton == null)
5885   - {
  4979 + if (this.commentsSupported() && urlParams['sketch'] != '1') {
  4980 + if (this.commentButton == null) {
5886 4981 this.commentButton = document.createElement('a');
5887 4982 this.commentButton.setAttribute('title', mxResources.get('comments'));
5888 4983 this.commentButton.className = 'geToolbarButton';
... ... @@ -5891,39 +4986,32 @@ App.prototype.updateButtonContainer = function()
5891 4986 'background-position:center center;background-repeat:no-repeat;background-image:' +
5892 4987 'url(' + Editor.commentImage + ');';
5893 4988
5894   - if (uiTheme == 'atlas')
5895   - {
  4989 + if (uiTheme == 'atlas') {
5896 4990 this.commentButton.style.marginRight = '10px';
5897 4991 this.commentButton.style.marginTop = '-3px';
5898 4992 }
5899   - else if (uiTheme == 'min')
5900   - {
  4993 + else if (uiTheme == 'min') {
5901 4994 this.commentButton.style.marginTop = '1px';
5902 4995 }
5903   - else if (urlParams['atlas'] == '1')
5904   - {
  4996 + else if (urlParams['atlas'] == '1') {
5905 4997 this.commentButton.style.marginTop = '-2px';
5906 4998 }
5907   - else
5908   - {
  4999 + else {
5909 5000 this.commentButton.style.marginTop = '-5px';
5910 5001 }
5911 5002
5912   - mxEvent.addListener(this.commentButton, 'click', mxUtils.bind(this, function()
5913   - {
  5003 + mxEvent.addListener(this.commentButton, 'click', mxUtils.bind(this, function () {
5914 5004 this.actions.get('comments').funct();
5915 5005 }));
5916 5006
5917 5007 this.buttonContainer.appendChild(this.commentButton);
5918 5008
5919   - if (uiTheme == 'dark' || uiTheme == 'atlas')
5920   - {
  5009 + if (uiTheme == 'dark' || uiTheme == 'atlas') {
5921 5010 this.commentButton.style.filter = 'invert(100%)';
5922 5011 }
5923 5012 }
5924 5013 }
5925   - else if (this.commentButton != null)
5926   - {
  5014 + else if (this.commentButton != null) {
5927 5015 this.commentButton.parentNode.removeChild(this.commentButton);
5928 5016 this.commentButton = null;
5929 5017 }
... ... @@ -5931,12 +5019,9 @@ App.prototype.updateButtonContainer = function()
5931 5019 // Share
5932 5020 if (urlParams['embed'] != '1' && this.getServiceName() == 'draw.io' &&
5933 5021 !mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp &&
5934   - !this.isOfflineApp())
5935   - {
5936   - if (file != null)
5937   - {
5938   - if (this.shareButton == null)
5939   - {
  5022 + !this.isOfflineApp()) {
  5023 + if (file != null) {
  5024 + if (this.shareButton == null) {
5940 5025 // TODO thingsKit 锁定 / 解锁 按钮
5941 5026 this.lockButton = document.createElement('div');
5942 5027 this.lockButton.className = 'geBtn gePrimaryBtn';
... ... @@ -5950,11 +5035,10 @@ App.prototype.updateButtonContainer = function()
5950 5035 this.lockButton.style.cssFloat = 'right';
5951 5036 this.lockButton.setAttribute('title', '锁定 / 解锁');
5952 5037 mxUtils.write(this.lockButton, '锁定 / 解锁');
5953   - mxEvent.addListener(this.lockButton, 'click', mxUtils.bind(this, function()
5954   - {
5955   - if (this.actions.actions.lockUnlock.enabled){
  5038 + mxEvent.addListener(this.lockButton, 'click', mxUtils.bind(this, function () {
  5039 + if (this.actions.actions.lockUnlock.enabled) {
5956 5040 this.actions.actions.lockUnlock.funct()
5957   - }
  5041 + }
5958 5042 }));
5959 5043 this.buttonContainer.appendChild(this.lockButton);
5960 5044
... ... @@ -5971,9 +5055,8 @@ App.prototype.updateButtonContainer = function()
5971 5055 this.shareButton.style.cssFloat = 'right';
5972 5056 this.shareButton.setAttribute('title', '预览');
5973 5057 mxUtils.write(this.shareButton, '预览');
5974   - mxEvent.addListener(this.shareButton, 'click', mxUtils.bind(this, function()
5975   - {
5976   - const href = window.location.href + '&lightbox=1'
  5058 + mxEvent.addListener(this.shareButton, 'click', mxUtils.bind(this, function () {
  5059 + const href = window.location.href + '&lightbox=1'
5977 5060 window.open(href)
5978 5061 }));
5979 5062 this.buttonContainer.appendChild(this.shareButton);
... ... @@ -5992,8 +5075,7 @@ App.prototype.updateButtonContainer = function()
5992 5075 this.saveButton.setAttribute('title', '保存');
5993 5076 this.saveButton.setAttribute('id', 'thingskitSaveButton');
5994 5077 mxUtils.write(this.saveButton, '保存');
5995   - mxEvent.addListener(this.saveButton, 'click', mxUtils.bind(this, function()
5996   - {
  5078 + mxEvent.addListener(this.saveButton, 'click', mxUtils.bind(this, function () {
5997 5079 this.currentFile.ui.actions.get(
5998 5080 (this.currentFile.mode == null || !this.currentFile.isEditable())
5999 5081 ? 'saveAs'
... ... @@ -6001,7 +5083,7 @@ App.prototype.updateButtonContainer = function()
6001 5083 .funct();
6002 5084 }));
6003 5085 this.buttonContainer.appendChild(this.saveButton);
6004   -
  5086 +
6005 5087
6006 5088
6007 5089 // this.shareButton = document.createElement('div');
... ... @@ -6041,8 +5123,7 @@ App.prototype.updateButtonContainer = function()
6041 5123 // this.buttonContainer.appendChild(this.shareButton);
6042 5124 }
6043 5125 }
6044   - else if (this.shareButton != null)
6045   - {
  5126 + else if (this.shareButton != null) {
6046 5127 this.shareButton.parentNode.removeChild(this.shareButton);
6047 5128 this.shareButton = null;
6048 5129 this.saveButton.parentNode.removeChild(this.saveButton);
... ... @@ -6063,17 +5144,15 @@ App.prototype.updateButtonContainer = function()
6063 5144 }
6064 5145 } else {
6065 5146 if (!hasSavePermission()) {
6066   - var el = document.getElementById('thingskitSaveButton')
  5147 + var el = document.getElementById('thingskitSaveButton')
6067 5148 el && el.remove()
6068 5149 }
6069 5150 }
6070 5151 };
6071 5152
6072 5153
6073   -App.prototype.fetchAndShowNotification = function(target, subtarget)
6074   -{
6075   - if (this.fetchingNotif)
6076   - {
  5154 +App.prototype.fetchAndShowNotification = function (target, subtarget) {
  5155 + if (this.fetchingNotif) {
6077 5156 return;
6078 5157 }
6079 5158
... ... @@ -6081,53 +5160,44 @@ App.prototype.fetchAndShowNotification = function(target, subtarget)
6081 5160 var cachedNotifKey = '.notifCache';
6082 5161 var cachedNotif = null;
6083 5162
6084   - var processNotif = mxUtils.bind(this, function(notifs)
6085   - {
6086   - notifs = notifs.filter(function(notif)
6087   - {
  5163 + var processNotif = mxUtils.bind(this, function (notifs) {
  5164 + notifs = notifs.filter(function (notif) {
6088 5165 return !notif.targets || notif.targets.indexOf(target) > -1 ||
6089   - (subtarget != null && notif.targets.indexOf(subtarget) > -1);
  5166 + (subtarget != null && notif.targets.indexOf(subtarget) > -1);
6090 5167 });
6091 5168
6092 5169 var lsReadFlag = target + 'NotifReadTS';
6093 5170 var lastRead = (localStorage != null) ? parseInt(localStorage.getItem(lsReadFlag)) : true;
6094 5171
6095   - for (var i = 0; i < notifs.length; i++)
6096   - {
  5172 + for (var i = 0; i < notifs.length; i++) {
6097 5173 notifs[i].isNew = (!lastRead || notifs[i].timestamp > lastRead);
6098 5174 }
6099 5175
6100 5176 this.showNotification(notifs, lsReadFlag);
6101 5177 });
6102 5178
6103   - try
6104   - {
6105   - if (localStorage != null)
6106   - {
  5179 + try {
  5180 + if (localStorage != null) {
6107 5181 cachedNotif = JSON.parse(localStorage.getItem(cachedNotifKey));
6108 5182 }
6109 5183 }
6110   - catch(e) {} //Ignore
  5184 + catch (e) { } //Ignore
6111 5185
6112 5186 if (cachedNotif == null || cachedNotif.ts + 24 * 60 * 60 * 1000 < Date.now()) //Cache for one day
6113 5187 {
6114 5188 this.fetchingNotif = true;
6115 5189 //Fetch all notifications and store them, then filter client-side
6116   - mxUtils.get(NOTIFICATIONS_URL, mxUtils.bind(this, function(req)
6117   - {
6118   - if (req.getStatus() >= 200 && req.getStatus() <= 299)
6119   - {
6120   - var notifs = JSON.parse(req.getText());
  5190 + mxUtils.get(NOTIFICATIONS_URL, mxUtils.bind(this, function (req) {
  5191 + if (req.getStatus() >= 200 && req.getStatus() <= 299) {
  5192 + var notifs = JSON.parse(req.getText());
6121 5193
6122 5194 //Process and sort
6123   - notifs.sort(function(a, b)
6124   - {
  5195 + notifs.sort(function (a, b) {
6125 5196 return b.timestamp - a.timestamp;
6126 5197 });
6127 5198
6128   - if (isLocalStorage)
6129   - {
6130   - localStorage.setItem(cachedNotifKey, JSON.stringify({ts: Date.now(), notifs: notifs}));
  5199 + if (isLocalStorage) {
  5200 + localStorage.setItem(cachedNotifKey, JSON.stringify({ ts: Date.now(), notifs: notifs }));
6131 5201 }
6132 5202
6133 5203 this.fetchingNotif = false;
... ... @@ -6135,33 +5205,26 @@ App.prototype.fetchAndShowNotification = function(target, subtarget)
6135 5205 }
6136 5206 }));
6137 5207 }
6138   - else
6139   - {
  5208 + else {
6140 5209 processNotif(cachedNotif.notifs);
6141 5210 }
6142 5211 };
6143 5212
6144   -App.prototype.showNotification = function(notifs, lsReadFlag)
6145   -{
  5213 +App.prototype.showNotification = function (notifs, lsReadFlag) {
6146 5214 var newCount = notifs.length;
6147 5215
6148   - if (uiTheme == 'min')
6149   - {
  5216 + if (uiTheme == 'min') {
6150 5217 newCount = 0;
6151 5218
6152   - for (var i = 0; i < notifs.length; i++)
6153   - {
6154   - if (notifs[i].isNew)
6155   - {
  5219 + for (var i = 0; i < notifs.length; i++) {
  5220 + if (notifs[i].isNew) {
6156 5221 newCount++;
6157 5222 }
6158 5223 }
6159 5224 }
6160 5225
6161   - if (newCount == 0)
6162   - {
6163   - if (this.notificationBtn != null)
6164   - {
  5226 + if (newCount == 0) {
  5227 + if (this.notificationBtn != null) {
6165 5228 this.notificationBtn.style.display = 'none';
6166 5229 this.editor.fireEvent(new mxEventObject('statusChanged'));
6167 5230 }
... ... @@ -6169,51 +5232,43 @@ App.prototype.showNotification = function(notifs, lsReadFlag)
6169 5232 return;
6170 5233 }
6171 5234
6172   - function shouldAnimate(newNotif)
6173   - {
  5235 + function shouldAnimate(newNotif) {
6174 5236 var countEl = document.querySelector('.geNotification-count');
6175 5237
6176   - if (countEl == null)
6177   - {
  5238 + if (countEl == null) {
6178 5239 return;
6179 5240 }
6180 5241
6181 5242 countEl.innerHTML = newNotif;
6182   - countEl.style.display = newNotif == 0? 'none' : '';
  5243 + countEl.style.display = newNotif == 0 ? 'none' : '';
6183 5244 var notifBell = document.querySelector('.geNotification-bell');
6184   - notifBell.style.animation = newNotif == 0? 'none' : '';
6185   - notifBell.className = 'geNotification-bell' + (newNotif == 0? ' geNotification-bellOff' : '');
6186   - document.querySelector('.geBell-rad').style.animation = newNotif == 0? 'none' : '';
  5245 + notifBell.style.animation = newNotif == 0 ? 'none' : '';
  5246 + notifBell.className = 'geNotification-bell' + (newNotif == 0 ? ' geNotification-bellOff' : '');
  5247 + document.querySelector('.geBell-rad').style.animation = newNotif == 0 ? 'none' : '';
6187 5248 }
6188 5249
6189   - var markAllAsRead = mxUtils.bind(this, function()
6190   - {
  5250 + var markAllAsRead = mxUtils.bind(this, function () {
6191 5251 this.notificationWin.style.display = 'none';
6192 5252 var unread = this.notificationWin.querySelectorAll('.circle.active');
6193 5253
6194   - for (var i = 0; i < unread.length; i++)
6195   - {
  5254 + for (var i = 0; i < unread.length; i++) {
6196 5255 unread[i].className = 'circle';
6197 5256 }
6198 5257
6199   - if (isLocalStorage && notifs[0])
6200   - {
  5258 + if (isLocalStorage && notifs[0]) {
6201 5259 localStorage.setItem(lsReadFlag, notifs[0].timestamp);
6202 5260 }
6203 5261 });
6204 5262
6205   - if (this.notificationBtn == null)
6206   - {
  5263 + if (this.notificationBtn == null) {
6207 5264 this.notificationBtn = document.createElement('div');
6208 5265 this.notificationBtn.className = 'geNotification-box';
6209 5266
6210   - if (uiTheme == 'min')
6211   - {
  5267 + if (uiTheme == 'min') {
6212 5268 this.notificationBtn.style.width = '30px';
6213 5269 this.notificationBtn.style.top = '4px';
6214 5270 }
6215   - else if (urlParams['atlas'] == '1')
6216   - {
  5271 + else if (urlParams['atlas'] == '1') {
6217 5272 this.notificationBtn.style.top = '2px';
6218 5273 }
6219 5274
... ... @@ -6223,7 +5278,7 @@ App.prototype.showNotification = function(notifs, lsReadFlag)
6223 5278
6224 5279 var notifBell = document.createElement('div');
6225 5280 notifBell.className = 'geNotification-bell';
6226   - notifBell.style.opacity = uiTheme == 'min'? '0.5' : '';
  5281 + notifBell.style.opacity = uiTheme == 'min' ? '0.5' : '';
6227 5282 var bellPart = document.createElement('span');
6228 5283 bellPart.className = 'geBell-top';
6229 5284 notifBell.appendChild(bellPart);
... ... @@ -6266,10 +5321,8 @@ App.prototype.showNotification = function(notifs, lsReadFlag)
6266 5321 winBody.appendChild(notifList);
6267 5322 this.notificationWin.appendChild(winBody);
6268 5323
6269   - mxEvent.addListener(this.notificationBtn, 'click', mxUtils.bind(this, function()
6270   - {
6271   - if (this.notificationWin.style.display == 'none')
6272   - {
  5324 + mxEvent.addListener(this.notificationBtn, 'click', mxUtils.bind(this, function () {
  5325 + if (this.notificationWin.style.display == 'none') {
6273 5326 this.notificationWin.style.display = '';
6274 5327 document.querySelector('.notifications').scrollTop = 0;
6275 5328 var r = this.notificationBtn.getBoundingClientRect();
... ... @@ -6277,36 +5330,29 @@ App.prototype.showNotification = function(notifs, lsReadFlag)
6277 5330 this.notificationWin.style.left = (r.right - this.notificationWin.clientWidth) + 'px';
6278 5331 shouldAnimate(0); //Stop animation once notifications are open
6279 5332 }
6280   - else
6281   - {
  5333 + else {
6282 5334 markAllAsRead();
6283 5335 }
6284 5336 }));
6285 5337
6286 5338 mxEvent.addListener(winClose, 'click', markAllAsRead);
6287 5339 }
6288   - else
6289   - {
  5340 + else {
6290 5341 this.notificationBtn.style.display = ''; //In case it was hidden
6291 5342 }
6292 5343
6293 5344 var newNotif = 0;
6294 5345 var notifListEl = document.getElementById('geNotifList');
6295 5346
6296   - if (notifListEl == null)
6297   - {
  5347 + if (notifListEl == null) {
6298 5348 return; //This shouldn't happen and no meaning of continuing
6299 5349 }
6300   - else
6301   - {
  5350 + else {
6302 5351 notifListEl.innerHTML = '<div class="line"></div>';
6303 5352
6304   - for (var i = 0; i < notifs.length; i++)
6305   - {
6306   - (function(editorUi, notif)
6307   - {
6308   - if (notif.isNew)
6309   - {
  5353 + for (var i = 0; i < notifs.length; i++) {
  5354 + (function (editorUi, notif) {
  5355 + if (notif.isNew) {
6310 5356 newNotif++;
6311 5357 }
6312 5358
... ... @@ -6315,18 +5361,15 @@ App.prototype.showNotification = function(notifs, lsReadFlag)
6315 5361 var ts = new Date(notif.timestamp);
6316 5362 var str = editorUi.timeSince(ts);
6317 5363
6318   - if (str == null)
6319   - {
  5364 + if (str == null) {
6320 5365 str = mxResources.get('lessThanAMinute');
6321 5366 }
6322 5367
6323   - notifEl.innerHTML = '<div class="circle' + (notif.isNew? ' active' : '') + '"></div><span class="time">' +
6324   - mxUtils.htmlEntities(mxResources.get('timeAgo', [str], '{1} ago')) + '</span>' +
6325   - '<p>' + mxUtils.htmlEntities(notif.content) + '</p>';
6326   - if (notif.link)
6327   - {
6328   - mxEvent.addListener(notifEl, 'click', function()
6329   - {
  5368 + notifEl.innerHTML = '<div class="circle' + (notif.isNew ? ' active' : '') + '"></div><span class="time">' +
  5369 + mxUtils.htmlEntities(mxResources.get('timeAgo', [str], '{1} ago')) + '</span>' +
  5370 + '<p>' + mxUtils.htmlEntities(notif.content) + '</p>';
  5371 + if (notif.link) {
  5372 + mxEvent.addListener(notifEl, 'click', function () {
6330 5373 window.open(notif.link, 'notifWin');
6331 5374 });
6332 5375 }
... ... @@ -6345,34 +5388,26 @@ App.prototype.showNotification = function(notifs, lsReadFlag)
6345 5388 * @param {number} dx X-coordinate of the translation.
6346 5389 * @param {number} dy Y-coordinate of the translation.
6347 5390 */
6348   -App.prototype.save = function(name, done)
6349   -{
  5391 +App.prototype.save = function (name, done) {
6350 5392 var file = this.getCurrentFile();
6351   - if (file != null && this.spinner.spin(document.body, mxResources.get('saving')))
6352   - {
  5393 + if (file != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
6353 5394 this.editor.setStatus('');
6354 5395
6355   - if (this.editor.graph.isEditing())
6356   - {
  5396 + if (this.editor.graph.isEditing()) {
6357 5397 this.editor.graph.stopEditing();
6358 5398 }
6359 5399
6360   - var success = mxUtils.bind(this, function()
6361   - {
  5400 + var success = mxUtils.bind(this, function () {
6362 5401 file.handleFileSuccess(true);
6363 5402
6364   - if (done != null)
6365   - {
  5403 + if (done != null) {
6366 5404 done();
6367 5405 }
6368 5406 });
6369 5407
6370   - var error = mxUtils.bind(this, function(err)
6371   - {
6372   - if (file.isModified())
6373   - {
6374   - Editor.addRetryToError(err, mxUtils.bind(this, function()
6375   - {
  5408 + var error = mxUtils.bind(this, function (err) {
  5409 + if (file.isModified()) {
  5410 + Editor.addRetryToError(err, mxUtils.bind(this, function () {
6376 5411 this.save(name, done);
6377 5412 }));
6378 5413 }
... ... @@ -6380,21 +5415,17 @@ App.prototype.save = function(name, done)
6380 5415 file.handleFileError(err, err == null || err.name != 'AbortError');
6381 5416 });
6382 5417
6383   - try
6384   - {
6385   - if (name == file.getTitle())
6386   - {
  5418 + try {
  5419 + if (name == file.getTitle()) {
6387 5420 file.save(true, success, error);
6388 5421 }
6389   - else
6390   - {
  5422 + else {
6391 5423 file.saveAs(name, success, error)
6392 5424 }
6393 5425
6394   - console.log('file',file)
  5426 + console.log('file', file)
6395 5427 }
6396   - catch (err)
6397   - {
  5428 + catch (err) {
6398 5429 error(err);
6399 5430 }
6400 5431 }
... ... @@ -6405,24 +5436,19 @@ App.prototype.save = function(name, done)
6405 5436 * if a valid folder was chosen for a mode that supports it. No callback
6406 5437 * is made if no folder was chosen for a mode that supports it.
6407 5438 */
6408   -App.prototype.pickFolder = function(mode, fn, enabled, direct, force)
6409   -{
  5439 +App.prototype.pickFolder = function (mode, fn, enabled, direct, force) {
6410 5440 enabled = (enabled != null) ? enabled : true;
6411 5441 var resume = this.spinner.pause();
6412 5442
6413   - if (enabled && mode == App.MODE_GOOGLE && this.drive != null)
6414   - {
  5443 + if (enabled && mode == App.MODE_GOOGLE && this.drive != null) {
6415 5444 // Shows a save dialog
6416   - this.drive.pickFolder(mxUtils.bind(this, function(evt)
6417   - {
  5445 + this.drive.pickFolder(mxUtils.bind(this, function (evt) {
6418 5446 resume();
6419 5447
6420   - if (evt.action == google.picker.Action.PICKED)
6421   - {
  5448 + if (evt.action == google.picker.Action.PICKED) {
6422 5449 var folderId = null;
6423 5450
6424   - if (evt.docs != null && evt.docs.length > 0 && evt.docs[0].type == 'folder')
6425   - {
  5451 + if (evt.docs != null && evt.docs.length > 0 && evt.docs[0].type == 'folder') {
6426 5452 folderId = evt.docs[0].id;
6427 5453 }
6428 5454
... ... @@ -6430,46 +5456,36 @@ App.prototype.pickFolder = function(mode, fn, enabled, direct, force)
6430 5456 }
6431 5457 }), force);
6432 5458 }
6433   - else if (enabled && mode == App.MODE_ONEDRIVE && this.oneDrive != null)
6434   - {
6435   - this.oneDrive.pickFolder(mxUtils.bind(this, function(files)
6436   - {
  5459 + else if (enabled && mode == App.MODE_ONEDRIVE && this.oneDrive != null) {
  5460 + this.oneDrive.pickFolder(mxUtils.bind(this, function (files) {
6437 5461 var folderId = null;
6438 5462 resume();
6439 5463
6440   - if (files != null && files.value != null && files.value.length > 0)
6441   - {
  5464 + if (files != null && files.value != null && files.value.length > 0) {
6442 5465 folderId = OneDriveFile.prototype.getIdOf(files.value[0]);
6443   - fn(folderId);
  5466 + fn(folderId);
6444 5467 }
6445 5468 }), direct);
6446 5469 }
6447   - else if (enabled && mode == App.MODE_GITHUB && this.gitHub != null)
6448   - {
6449   - this.gitHub.pickFolder(mxUtils.bind(this, function(folderPath)
6450   - {
  5470 + else if (enabled && mode == App.MODE_GITHUB && this.gitHub != null) {
  5471 + this.gitHub.pickFolder(mxUtils.bind(this, function (folderPath) {
6451 5472 resume();
6452 5473 fn(folderPath);
6453 5474 }));
6454 5475 }
6455   - else if (enabled && mode == App.MODE_GITLAB && this.gitLab != null)
6456   - {
6457   - this.gitLab.pickFolder(mxUtils.bind(this, function(folderPath)
6458   - {
  5476 + else if (enabled && mode == App.MODE_GITLAB && this.gitLab != null) {
  5477 + this.gitLab.pickFolder(mxUtils.bind(this, function (folderPath) {
6459 5478 resume();
6460 5479 fn(folderPath);
6461 5480 }));
6462 5481 }
6463   - else if (enabled && mode == App.MODE_TRELLO && this.trello != null)
6464   - {
6465   - this.trello.pickFolder(mxUtils.bind(this, function(cardId)
6466   - {
  5482 + else if (enabled && mode == App.MODE_TRELLO && this.trello != null) {
  5483 + this.trello.pickFolder(mxUtils.bind(this, function (cardId) {
6467 5484 resume();
6468 5485 fn(cardId);
6469 5486 }));
6470 5487 }
6471   - else
6472   - {
  5488 + else {
6473 5489 EditorUi.prototype.pickFolder.apply(this, arguments);
6474 5490 }
6475 5491 };
... ... @@ -6477,136 +5493,107 @@ App.prototype.pickFolder = function(mode, fn, enabled, direct, force)
6477 5493 /**
6478 5494 *
6479 5495 */
6480   -App.prototype.exportFile = function(data, filename, mimeType, base64Encoded, mode, folderId)
6481   -{
6482   - if (mode == App.MODE_DROPBOX)
6483   - {
6484   - if (this.dropbox != null && this.spinner.spin(document.body, mxResources.get('saving')))
6485   - {
  5496 +App.prototype.exportFile = function (data, filename, mimeType, base64Encoded, mode, folderId) {
  5497 + if (mode == App.MODE_DROPBOX) {
  5498 + if (this.dropbox != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
6486 5499 // LATER: Add folder picker
6487 5500 this.dropbox.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) :
6488   - data, mxUtils.bind(this, function()
6489   - {
6490   - this.spinner.stop();
6491   - }), mxUtils.bind(this, function(resp)
6492   - {
6493   - this.spinner.stop();
6494   - this.handleError(resp);
6495   - }));
  5501 + data, mxUtils.bind(this, function () {
  5502 + this.spinner.stop();
  5503 + }), mxUtils.bind(this, function (resp) {
  5504 + this.spinner.stop();
  5505 + this.handleError(resp);
  5506 + }));
6496 5507 }
6497 5508 }
6498   - else if (mode == App.MODE_GOOGLE)
6499   - {
6500   - if (this.drive != null && this.spinner.spin(document.body, mxResources.get('saving')))
6501   - {
6502   - this.drive.insertFile(filename, data, folderId, mxUtils.bind(this, function(resp)
6503   - {
  5509 + else if (mode == App.MODE_GOOGLE) {
  5510 + if (this.drive != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
  5511 + this.drive.insertFile(filename, data, folderId, mxUtils.bind(this, function (resp) {
6504 5512 // TODO: Add callback with url param for clickable status message
6505 5513 // "File exported. Click here to open folder."
6506   -// this.editor.setStatus('<div class="geStatusMessage">' +
6507   -// mxResources.get('saved') + '</div>');
6508   -//
6509   -// // Installs click handler for opening
6510   -// if (this.statusContainer != null)
6511   -// {
6512   -// var links = this.statusContainer.getElementsByTagName('div');
6513   -//
6514   -// if (links.length > 0)
6515   -// {
6516   -// links[0].style.cursor = 'pointer';
6517   -//
6518   -// mxEvent.addListener(links[0], 'click', mxUtils.bind(this, function()
6519   -// {
6520   -// if (resp != null && resp.id != null)
6521   -// {
6522   -// window.open('https://drive.google.com/open?id=' + resp.id);
6523   -// }
6524   -// }));
6525   -// }
6526   -// }
  5514 + // this.editor.setStatus('<div class="geStatusMessage">' +
  5515 + // mxResources.get('saved') + '</div>');
  5516 + //
  5517 + // // Installs click handler for opening
  5518 + // if (this.statusContainer != null)
  5519 + // {
  5520 + // var links = this.statusContainer.getElementsByTagName('div');
  5521 + //
  5522 + // if (links.length > 0)
  5523 + // {
  5524 + // links[0].style.cursor = 'pointer';
  5525 + //
  5526 + // mxEvent.addListener(links[0], 'click', mxUtils.bind(this, function()
  5527 + // {
  5528 + // if (resp != null && resp.id != null)
  5529 + // {
  5530 + // window.open('https://drive.google.com/open?id=' + resp.id);
  5531 + // }
  5532 + // }));
  5533 + // }
  5534 + // }
6527 5535
6528 5536 this.spinner.stop();
6529   - }), mxUtils.bind(this, function(resp)
6530   - {
  5537 + }), mxUtils.bind(this, function (resp) {
6531 5538 this.spinner.stop();
6532 5539 this.handleError(resp);
6533 5540 }), mimeType, base64Encoded);
6534 5541 }
6535 5542 }
6536   - else if (mode == App.MODE_ONEDRIVE)
6537   - {
6538   - if (this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('saving')))
6539   - {
  5543 + else if (mode == App.MODE_ONEDRIVE) {
  5544 + if (this.oneDrive != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
6540 5545 // KNOWN: OneDrive does not show .svg extension
6541 5546 this.oneDrive.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) :
6542   - data, mxUtils.bind(this, function()
6543   - {
6544   - this.spinner.stop();
6545   - }), mxUtils.bind(this, function(resp)
6546   - {
6547   - this.spinner.stop();
6548   - this.handleError(resp);
6549   - }), false, folderId);
  5547 + data, mxUtils.bind(this, function () {
  5548 + this.spinner.stop();
  5549 + }), mxUtils.bind(this, function (resp) {
  5550 + this.spinner.stop();
  5551 + this.handleError(resp);
  5552 + }), false, folderId);
6550 5553 }
6551 5554 }
6552   - else if (mode == App.MODE_GITHUB)
6553   - {
6554   - if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving')))
6555   - {
  5555 + else if (mode == App.MODE_GITHUB) {
  5556 + if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
6556 5557 // Must insert file as library to force the file to be written
6557   - this.gitHub.insertFile(filename, data, mxUtils.bind(this, function()
6558   - {
  5558 + this.gitHub.insertFile(filename, data, mxUtils.bind(this, function () {
6559 5559 this.spinner.stop();
6560   - }), mxUtils.bind(this, function(resp)
6561   - {
  5560 + }), mxUtils.bind(this, function (resp) {
6562 5561 this.spinner.stop();
6563 5562 this.handleError(resp);
6564 5563 }), true, folderId, base64Encoded);
6565 5564 }
6566 5565 }
6567   - else if (mode == App.MODE_GITLAB)
6568   - {
6569   - if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving')))
6570   - {
  5566 + else if (mode == App.MODE_GITLAB) {
  5567 + if (this.gitHub != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
6571 5568 // Must insert file as library to force the file to be written
6572   - this.gitLab.insertFile(filename, data, mxUtils.bind(this, function()
6573   - {
  5569 + this.gitLab.insertFile(filename, data, mxUtils.bind(this, function () {
6574 5570 this.spinner.stop();
6575   - }), mxUtils.bind(this, function(resp)
6576   - {
  5571 + }), mxUtils.bind(this, function (resp) {
6577 5572 this.spinner.stop();
6578 5573 this.handleError(resp);
6579 5574 }), true, folderId, base64Encoded);
6580 5575 }
6581 5576 }
6582   - else if (mode == App.MODE_TRELLO)
6583   - {
6584   - if (this.trello != null && this.spinner.spin(document.body, mxResources.get('saving')))
6585   - {
  5577 + else if (mode == App.MODE_TRELLO) {
  5578 + if (this.trello != null && this.spinner.spin(document.body, mxResources.get('saving'))) {
6586 5579 this.trello.insertFile(filename, (base64Encoded) ? this.base64ToBlob(data, mimeType) :
6587   - data, mxUtils.bind(this, function()
6588   - {
6589   - this.spinner.stop();
6590   - }), mxUtils.bind(this, function(resp)
6591   - {
6592   - this.spinner.stop();
6593   - this.handleError(resp);
6594   - }), false, folderId);
  5580 + data, mxUtils.bind(this, function () {
  5581 + this.spinner.stop();
  5582 + }), mxUtils.bind(this, function (resp) {
  5583 + this.spinner.stop();
  5584 + this.handleError(resp);
  5585 + }), false, folderId);
6595 5586 }
6596 5587 }
6597   - else if (mode == App.MODE_BROWSER)
6598   - {
6599   - var fn = mxUtils.bind(this, function()
6600   - {
  5588 + else if (mode == App.MODE_BROWSER) {
  5589 + var fn = mxUtils.bind(this, function () {
6601 5590 localStorage.setItem(filename, data);
6602 5591 });
6603 5592
6604   - if (localStorage.getItem(filename) == null)
6605   - {
  5593 + if (localStorage.getItem(filename) == null) {
6606 5594 fn();
6607 5595 }
6608   - else
6609   - {
  5596 + else {
6610 5597 this.confirm(mxResources.get('replaceIt', [filename]), fn);
6611 5598 }
6612 5599 }
... ... @@ -6618,14 +5605,11 @@ App.prototype.exportFile = function(data, filename, mimeType, base64Encoded, mod
6618 5605 * @param {number} dx X-coordinate of the translation.
6619 5606 * @param {number} dy Y-coordinate of the translation.
6620 5607 */
6621   -App.prototype.descriptorChanged = function()
6622   -{
  5608 +App.prototype.descriptorChanged = function () {
6623 5609 var file = this.getCurrentFile();
6624 5610
6625   - if (file != null)
6626   - {
6627   - if (this.fname != null)
6628   - {
  5611 + if (file != null) {
  5612 + if (this.fname != null) {
6629 5613 this.fnameWrapper.style.display = 'block';
6630 5614 this.fname.innerHTML = '';
6631 5615 var filename = (file.getTitle() != null) ? file.getTitle() : this.defaultFilename;
... ... @@ -6636,25 +5620,21 @@ App.prototype.descriptorChanged = function()
6636 5620 var graph = this.editor.graph;
6637 5621 var editable = file.isEditable() && !file.invalidChecksum;
6638 5622
6639   - if (graph.isEnabled() && !editable)
6640   - {
  5623 + if (graph.isEnabled() && !editable) {
6641 5624 graph.reset();
6642 5625 }
6643 5626
6644 5627 graph.setEnabled(editable);
6645 5628
6646 5629 // Ignores title and hash for revisions
6647   - if (urlParams['rev'] == null)
6648   - {
  5630 + if (urlParams['rev'] == null) {
6649 5631 this.updateDocumentTitle();
6650 5632 var newHash = file.getHash();
6651 5633
6652   - if (newHash.length > 0)
6653   - {
  5634 + if (newHash.length > 0) {
6654 5635 window.location.hash = newHash;
6655 5636 }
6656   - else if (window.location.hash.length > 0)
6657   - {
  5637 + else if (window.location.hash.length > 0) {
6658 5638 window.location.hash = '';
6659 5639 }
6660 5640 }
... ... @@ -6665,8 +5645,7 @@ App.prototype.descriptorChanged = function()
6665 5645 // Refresh if editable state has changed
6666 5646 if (this.format != null && (file == null ||
6667 5647 this.fileEditable != file.isEditable()) &&
6668   - this.editor.graph.isSelectionEmpty())
6669   - {
  5648 + this.editor.graph.isSelectionEmpty()) {
6670 5649 this.format.refresh();
6671 5650 this.fileEditable = (file != null) ? file.isEditable() : null;
6672 5651 }
... ... @@ -6677,36 +5656,27 @@ App.prototype.descriptorChanged = function()
6677 5656 /**
6678 5657 * Adds the listener for automatically saving the diagram for local changes.
6679 5658 */
6680   -App.prototype.showAuthDialog = function(peer, showRememberOption, fn, closeFn)
6681   -{
  5659 +App.prototype.showAuthDialog = function (peer, showRememberOption, fn, closeFn) {
6682 5660 var resume = this.spinner.pause();
6683 5661
6684   - this.showDialog(new AuthDialog(this, peer, showRememberOption, mxUtils.bind(this, function(remember)
6685   - {
6686   - try
6687   - {
6688   - if (fn != null)
6689   - {
6690   - fn(remember, mxUtils.bind(this, function()
6691   - {
  5662 + this.showDialog(new AuthDialog(this, peer, showRememberOption, mxUtils.bind(this, function (remember) {
  5663 + try {
  5664 + if (fn != null) {
  5665 + fn(remember, mxUtils.bind(this, function () {
6692 5666 this.hideDialog();
6693 5667 resume();
6694 5668 }));
6695 5669 }
6696 5670 }
6697   - catch (e)
6698   - {
  5671 + catch (e) {
6699 5672 this.editor.setStatus(mxUtils.htmlEntities(e.message));
6700 5673 }
6701   - })).container, 300, (showRememberOption) ? 180 : 140, true, true, mxUtils.bind(this, function(cancel)
6702   - {
6703   - if (closeFn != null)
6704   - {
  5674 + })).container, 300, (showRememberOption) ? 180 : 140, true, true, mxUtils.bind(this, function (cancel) {
  5675 + if (closeFn != null) {
6705 5676 closeFn(cancel);
6706 5677 }
6707 5678
6708   - if (cancel && this.getCurrentFile() == null && this.dialog == null)
6709   - {
  5679 + if (cancel && this.getCurrentFile() == null && this.dialog == null) {
6710 5680 this.showSplash();
6711 5681 }
6712 5682 }));
... ... @@ -6717,193 +5687,149 @@ App.prototype.showAuthDialog = function(peer, showRememberOption, fn, closeFn)
6717 5687 * readXml argument is used for import. Default is false. The optional
6718 5688 * readLibrary argument is used for reading libraries. Default is false.
6719 5689 */
6720   -App.prototype.convertFile = function(url, filename, mimeType, extension, success, error, executeRequest, headers)
6721   -{
  5690 +App.prototype.convertFile = function (url, filename, mimeType, extension, success, error, executeRequest, headers) {
6722 5691 var name = filename;
6723 5692
6724 5693 // SVG file extensions are valid and needed for image import
6725   - if (!/\.svg$/i.test(name))
6726   - {
  5694 + if (!/\.svg$/i.test(name)) {
6727 5695 name = name.substring(0, filename.lastIndexOf('.')) + extension;
6728 5696 }
6729 5697
6730 5698 var gitHubUrl = false;
6731 5699
6732   - if (this.gitHub != null && url.substring(0, this.gitHub.baseUrl.length) == this.gitHub.baseUrl)
6733   - {
  5700 + if (this.gitHub != null && url.substring(0, this.gitHub.baseUrl.length) == this.gitHub.baseUrl) {
6734 5701 gitHubUrl = true;
6735 5702 }
6736 5703
6737 5704 // Workaround for wrong binary response with VSD(X) & VDX files
6738 5705 if (/\.v(dx|sdx?)$/i.test(filename) && Graph.fileSupport && new XMLHttpRequest().upload &&
6739   - typeof new XMLHttpRequest().responseType === 'string')
6740   - {
  5706 + typeof new XMLHttpRequest().responseType === 'string') {
6741 5707 var req = new XMLHttpRequest();
6742 5708 req.open('GET', url, true);
6743 5709
6744   - if (!gitHubUrl)
6745   - {
  5710 + if (!gitHubUrl) {
6746 5711 req.responseType = 'blob';
6747 5712 }
6748 5713
6749   - if (headers)
6750   - {
6751   - for (var key in headers)
6752   - {
  5714 + if (headers) {
  5715 + for (var key in headers) {
6753 5716 req.setRequestHeader(key, headers[key]);
6754 5717 }
6755 5718 }
6756 5719
6757   - req.onload = mxUtils.bind(this, function()
6758   - {
6759   - if (req.status >= 200 && req.status <= 299)
6760   - {
  5720 + req.onload = mxUtils.bind(this, function () {
  5721 + if (req.status >= 200 && req.status <= 299) {
6761 5722 var blob = null;
6762 5723
6763   - if (gitHubUrl)
6764   - {
  5724 + if (gitHubUrl) {
6765 5725 var file = JSON.parse(req.responseText);
6766 5726 blob = this.base64ToBlob(file.content, 'application/octet-stream');
6767 5727 }
6768   - else
6769   - {
6770   - blob = new Blob([req.response], {type: 'application/octet-stream'});
  5728 + else {
  5729 + blob = new Blob([req.response], { type: 'application/octet-stream' });
6771 5730 }
6772 5731
6773   - this.importVisio(blob, mxUtils.bind(this, function(xml)
6774   - {
  5732 + this.importVisio(blob, mxUtils.bind(this, function (xml) {
6775 5733 success(new LocalFile(this, xml, name, true));
6776 5734 }), error, filename)
6777 5735 }
6778   - else if (error != null)
6779   - {
6780   - error({message: mxResources.get('errorLoadingFile')});
  5736 + else if (error != null) {
  5737 + error({ message: mxResources.get('errorLoadingFile') });
6781 5738 }
6782 5739 });
6783 5740
6784 5741 req.onerror = error;
6785 5742 req.send();
6786 5743 }
6787   - else
6788   - {
6789   - var handleData = mxUtils.bind(this, function(data)
6790   - {
6791   - try
6792   - {
6793   - if (/\.pdf$/i.test(filename))
6794   - {
  5744 + else {
  5745 + var handleData = mxUtils.bind(this, function (data) {
  5746 + try {
  5747 + if (/\.pdf$/i.test(filename)) {
6795 5748 var temp = Editor.extractGraphModelFromPdf(data);
6796 5749
6797   - if (temp != null && temp.length > 0)
6798   - {
  5750 + if (temp != null && temp.length > 0) {
6799 5751 success(new LocalFile(this, temp, name, true));
6800 5752 }
6801 5753 }
6802   - else if (/\.png$/i.test(filename))
6803   - {
  5754 + else if (/\.png$/i.test(filename)) {
6804 5755 var temp = this.extractGraphModelFromPng(data);
6805 5756
6806   - if (temp != null)
6807   - {
  5757 + if (temp != null) {
6808 5758 success(new LocalFile(this, temp, name, true));
6809 5759 }
6810   - else
6811   - {
  5760 + else {
6812 5761 success(new LocalFile(this, data, filename, true));
6813 5762 }
6814 5763 }
6815   - else if (Graph.fileSupport && new XMLHttpRequest().upload && this.isRemoteFileFormat(data, url))
6816   - {
6817   - this.parseFileData(data, mxUtils.bind(this, function(xhr)
6818   - {
6819   - if (xhr.readyState == 4)
6820   - {
6821   - if (xhr.status >= 200 && xhr.status <= 299)
6822   - {
  5764 + else if (Graph.fileSupport && new XMLHttpRequest().upload && this.isRemoteFileFormat(data, url)) {
  5765 + this.parseFileData(data, mxUtils.bind(this, function (xhr) {
  5766 + if (xhr.readyState == 4) {
  5767 + if (xhr.status >= 200 && xhr.status <= 299) {
6823 5768 success(new LocalFile(this, xhr.responseText, name, true));
6824 5769 }
6825   - else if (error != null)
6826   - {
6827   - error({message: mxResources.get('errorLoadingFile')});
  5770 + else if (error != null) {
  5771 + error({ message: mxResources.get('errorLoadingFile') });
6828 5772 }
6829 5773 }
6830 5774 }), filename);
6831 5775 }
6832   - else
6833   - {
  5776 + else {
6834 5777 success(new LocalFile(this, data, name, true));
6835 5778 }
6836 5779 }
6837   - catch (e)
6838   - {
6839   - if (error != null)
6840   - {
  5780 + catch (e) {
  5781 + if (error != null) {
6841 5782 error(e);
6842 5783 }
6843 5784 }
6844 5785 });
6845 5786
6846 5787 var binary = /\.png$/i.test(filename) || /\.jpe?g$/i.test(filename) ||
6847   - /\.pdf$/i.test(filename) || (mimeType != null &&
6848   - mimeType.substring(0, 6) == 'image/');
  5788 + /\.pdf$/i.test(filename) || (mimeType != null &&
  5789 + mimeType.substring(0, 6) == 'image/');
6849 5790
6850 5791 // NOTE: Cannot force non-binary request via loadUrl so needs separate
6851 5792 // code as decoding twice on content with binary data did not work
6852   - if (gitHubUrl)
6853   - {
6854   - mxUtils.get(url, mxUtils.bind(this, function(req)
6855   - {
6856   - if (req.getStatus() >= 200 && req.getStatus() <= 299)
6857   - {
6858   - if (success != null)
6859   - {
6860   - var file = JSON.parse(req.getText());
6861   - var data = file.content;
6862   -
6863   - if (file.encoding === 'base64')
6864   - {
6865   - if (/\.png$/i.test(filename))
6866   - {
6867   - data = 'data:image/png;base64,' + data;
6868   - }
6869   - else if (/\.pdf$/i.test(filename))
6870   - {
6871   - data = 'data:application/pdf;base64,' + data;
6872   - }
6873   - else
6874   - {
6875   - // Workaround for character encoding issues in IE10/11
6876   - data = (window.atob && !mxClient.IS_IE && !mxClient.IS_IE11) ? atob(data) : Base64.decode(data);
6877   - }
6878   - }
6879   -
6880   - handleData(data);
6881   - }
6882   - }
6883   - else if (error != null)
6884   - {
6885   - error({code: App.ERROR_UNKNOWN});
6886   - }
6887   - }), function()
6888   - {
6889   - if (error != null)
6890   - {
6891   - error({code: App.ERROR_UNKNOWN});
6892   - }
6893   - }, false, this.timeout, function()
6894   - {
6895   - if (error != null)
6896   - {
6897   - error({code: App.ERROR_TIMEOUT, retry: fn});
6898   - }
6899   - }, headers);
6900   - }
6901   - else if (executeRequest != null)
6902   - {
  5793 + if (gitHubUrl) {
  5794 + mxUtils.get(url, mxUtils.bind(this, function (req) {
  5795 + if (req.getStatus() >= 200 && req.getStatus() <= 299) {
  5796 + if (success != null) {
  5797 + var file = JSON.parse(req.getText());
  5798 + var data = file.content;
  5799 +
  5800 + if (file.encoding === 'base64') {
  5801 + if (/\.png$/i.test(filename)) {
  5802 + data = 'data:image/png;base64,' + data;
  5803 + }
  5804 + else if (/\.pdf$/i.test(filename)) {
  5805 + data = 'data:application/pdf;base64,' + data;
  5806 + }
  5807 + else {
  5808 + // Workaround for character encoding issues in IE10/11
  5809 + data = (window.atob && !mxClient.IS_IE && !mxClient.IS_IE11) ? atob(data) : Base64.decode(data);
  5810 + }
  5811 + }
  5812 +
  5813 + handleData(data);
  5814 + }
  5815 + }
  5816 + else if (error != null) {
  5817 + error({ code: App.ERROR_UNKNOWN });
  5818 + }
  5819 + }), function () {
  5820 + if (error != null) {
  5821 + error({ code: App.ERROR_UNKNOWN });
  5822 + }
  5823 + }, false, this.timeout, function () {
  5824 + if (error != null) {
  5825 + error({ code: App.ERROR_TIMEOUT, retry: fn });
  5826 + }
  5827 + }, headers);
  5828 + }
  5829 + else if (executeRequest != null) {
6903 5830 executeRequest(url, handleData, error, binary);
6904 5831 }
6905   - else
6906   - {
  5832 + else {
6907 5833 this.editor.loadUrl(url, handleData, error, binary, null, null, null, headers);
6908 5834 }
6909 5835 }
... ... @@ -6912,10 +5838,8 @@ App.prototype.convertFile = function(url, filename, mimeType, extension, success
6912 5838 /**
6913 5839 * Adds the listener for automatically saving the diagram for local changes.
6914 5840 */
6915   -App.prototype.updateHeader = function()
6916   -{
6917   - if (this.menubar != null)
6918   - {
  5841 +App.prototype.updateHeader = function () {
  5842 + if (this.menubar != null) {
6919 5843 this.appIcon = document.createElement('a');
6920 5844 this.appIcon.style.display = 'block';
6921 5845 this.appIcon.style.position = 'absolute';
... ... @@ -6925,15 +5849,13 @@ App.prototype.updateHeader = function()
6925 5849 this.appIcon.style.opacity = '0.85';
6926 5850 this.appIcon.style.borderRadius = '3px';
6927 5851
6928   - if (uiTheme != 'dark')
6929   - {
  5852 + if (uiTheme != 'dark') {
6930 5853 // this.appIcon.style.backgroundColor = '#f08705';
6931 5854 }
6932 5855
6933 5856 mxEvent.disableContextMenu(this.appIcon);
6934 5857
6935   - mxEvent.addListener(this.appIcon, 'click', mxUtils.bind(this, function(evt)
6936   - {
  5858 + mxEvent.addListener(this.appIcon, 'click', mxUtils.bind(this, function (evt) {
6937 5859 // this.appIconClicked(evt);
6938 5860 }));
6939 5861
... ... @@ -6942,7 +5864,7 @@ App.prototype.updateHeader = function()
6942 5864 //this.appIcon.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src=' + IMAGE_PATH + '/logo-white.png,sizingMethod=\'scale\')';
6943 5865 var logo = (!mxClient.IS_SVG) ? 'url(\'' + IMAGE_PATH + '/logo-white.png\')' :
6944 5866 ((uiTheme == 'dark') ? 'url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjxzdmcKICAgeG1sbnM6ZGM9Imh0dHA6Ly9wdXJsLm9yZy9kYy9lbGVtZW50cy8xLjEvIgogICB4bWxuczpjYz0iaHR0cDovL2NyZWF0aXZlY29tbW9ucy5vcmcvbnMjIgogICB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgeG1sOnNwYWNlPSJwcmVzZXJ2ZSIKICAgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzA2LjE4NSAxMjAuMjk2IgogICB2aWV3Qm94PSIyNCAyNiA2OCA2OCIKICAgeT0iMHB4IgogICB4PSIwcHgiCiAgIHZlcnNpb249IjEuMSI+CiAgIAkgPGc+PGxpbmUKICAgICAgIHkyPSI3Mi4zOTQiCiAgICAgICB4Mj0iNDEuMDYxIgogICAgICAgeTE9IjQzLjM4NCIKICAgICAgIHgxPSI1OC4wNjkiCiAgICAgICBzdHJva2UtbWl0ZXJsaW1pdD0iMTAiCiAgICA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sODIuMSw4NC41VjIxNS40eiIvPgo8cGF0aCBjbGFzcz0ic3QyIiBkPSJNMTg0LjYsMTI1LjhoLTIzLjdsLTI1LTQyLjdjNS43LTEuMiw5LjgtNi4yLDkuNy0xMlYzOWMwLTYuOC01LjQtMTIuMy0xMi4yLTEyLjNoLTAuMUg5MS42CgljLTYuOCwwLTEyLjMsNS40LTEyLjMsMTIuMlYzOXYzMi4xYzAsNS44LDQsMTAuOCw5LjcsMTJsLTI1LDQyLjdINDAuNGMtNi44LDAtMTIuMyw1LjQtMTIuMywxMi4ydjAuMXYzMi4xCgljMCw2LjgsNS40LDEyLjMsMTIuMiwxMi4zaDAuMWg0MS43YzYuOCwwLDEyLjMtNS40LDEyLjMtMTIuMnYtMC4xdi0zMi4xYzAtNi44LTUuNC0xMi4zLTEyLjItMTIuM2gtMC4xaC00bDI0LjgtNDIuNGgxOS4zCglsMjQuOSw0Mi40SDE0M2MtNi44LDAtMTIuMyw1LjQtMTIuMywxMi4ydjAuMXYzMi4xYzAsNi44LDUuNCwxMi4zLDEyLjIsMTIuM2gwLjFoNDEuN2M2LjgsMCwxMi4zLTUuNCwxMi4zLTEyLjJ2LTAuMXYtMzIuMQoJYzAtNi44LTUuNC0xMi4zLTEyLjItMTIuM0MxODQuNywxMjUuOCwxODQuNywxMjUuOCwxODQuNiwxMjUuOHoiLz4KPC9zdmc+Cg==)');
6946 5868 // this.appIcon.style.backgroundImage = logo;
6947 5869 this.appIcon.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAYAAACLz2ctAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgB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U9lBiJUF0MoCaGVlAbSyAFpZWQCtLIBWVhZAKwuglZUF0MoCaGVlAbSyAFpZWQCtLIBWVhZAKwuglZUF0MoCaGVlAbSyAFpZWQCtLIBWVhZAKwuglZUF0MoCaGVVV/8/AKGiojO76Zy3AAAAAElFTkSuQmCC)';
6948 5870 this.appIcon.style.backgroundPosition = 'center center';
... ... @@ -6951,56 +5873,46 @@ App.prototype.updateHeader = function()
6951 5873
6952 5874 mxUtils.setPrefixedStyle(this.appIcon.style, 'transition', 'all 125ms linear');
6953 5875
6954   - mxEvent.addListener(this.appIcon, 'mouseover', mxUtils.bind(this, function()
6955   - {
  5876 + mxEvent.addListener(this.appIcon, 'mouseover', mxUtils.bind(this, function () {
6956 5877 var file = this.getCurrentFile();
6957 5878
6958   - if (file != null)
6959   - {
  5879 + if (file != null) {
6960 5880 var mode = file.getMode();
6961 5881
6962   - if (mode == App.MODE_GOOGLE)
6963   - {
  5882 + if (mode == App.MODE_GOOGLE) {
6964 5883 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/google-drive-logo-white.svg)';
6965 5884 this.appIcon.style.backgroundSize = '70% 70%';
6966 5885 }
6967   - else if (mode == App.MODE_DROPBOX)
6968   - {
  5886 + else if (mode == App.MODE_DROPBOX) {
6969 5887 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/dropbox-logo-white.svg)';
6970 5888 this.appIcon.style.backgroundSize = '70% 70%';
6971 5889 }
6972   - else if (mode == App.MODE_ONEDRIVE)
6973   - {
  5890 + else if (mode == App.MODE_ONEDRIVE) {
6974 5891 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/onedrive-logo-white.svg)';
6975 5892 this.appIcon.style.backgroundSize = '70% 70%';
6976 5893 }
6977   - else if (mode == App.MODE_GITHUB)
6978   - {
  5894 + else if (mode == App.MODE_GITHUB) {
6979 5895 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/github-logo-white.svg)';
6980 5896 this.appIcon.style.backgroundSize = '70% 70%';
6981 5897 }
6982   - else if (mode == App.MODE_GITLAB)
6983   - {
  5898 + else if (mode == App.MODE_GITLAB) {
6984 5899 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/gitlab-logo-white.svg)';
6985 5900 this.appIcon.style.backgroundSize = '100% 100%';
6986 5901 }
6987   - else if (mode == App.MODE_TRELLO)
6988   - {
  5902 + else if (mode == App.MODE_TRELLO) {
6989 5903 this.appIcon.style.backgroundImage = 'url(' + IMAGE_PATH + '/trello-logo-white-orange.svg)';
6990 5904 this.appIcon.style.backgroundSize = '70% 70%';
6991 5905 }
6992 5906 }
6993 5907 }));
6994 5908
6995   - mxEvent.addListener(this.appIcon, 'mouseout', mxUtils.bind(this, function()
6996   - {
  5909 + mxEvent.addListener(this.appIcon, 'mouseout', mxUtils.bind(this, function () {
6997 5910 // this.appIcon.style.backgroundImage = logo;
6998 5911 this.appIcon.style.backgroundImage = 'url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAKAAAACgCAYAAACLz2ctAAAACXBIWXMAAAsTAAALEwEAmpwYAAAKTWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVN3WJP3Fj7f92UPVkLY8LGXbIEAIiOsCMgQWaIQkgBhhBASQMWFiApWFBURnEhVxILVCkidiOKgKLhnQYqIWotVXDjuH9yntX167+3t+9f7vOec5/zOec8PgBESJpHmomoAOVKFPDrYH49PSMTJvYACFUjgBCAQ5svCZwXFAADwA3l4fnSwP/wBr28AAgBw1S4kEsfh/4O6UCZXACCRAOAiEucLAZBSAMguVMgUAMgYALBTs2QKAJQAAGx5fEIiAKoNAOz0ST4FANipk9wXANiiHKkIAI0BAJkoRyQCQLsAYFWBUiwCwMIAoKxAIi4EwK4BgFm2MkcCgL0FAHaOWJAPQGAAgJlCLMwAIDgCAEMeE80DIEwDoDDSv+CpX3CFuEgBAMDLlc2XS9IzFLiV0Bp38vDg4iHiwmyxQmEXKRBmCeQinJebIxNI5wNMzgwAABr50c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BB5sJ5Y55wJ7qL5sB6AVC0CoCG64K1KqLrhF82AyE4+KFLWyJdJ4bimWhO5iIzxjzhTvRKrbutB7zaMlsXrAfh/egWKSMjThcZurg10v3CLfFMqKhy4bwxT7g/iNi7LIBX00GarwvWqgC8Bvi6QU8Ymrg+0nP0JYmMV5Q5w57we8C+VgZQXGvgN6EuWKsyesbkSVPp2EV6lzeHe46NJmZCRZUN56QpT3gjuoFh5BqOgKvqqGquzNcF60H4ZnSfnqGBie9d3hzuOp6MZ8MlslFznvBG9CKZ+65RAFvwK9GcumA9CH8DfRWbEU/oIUMT14e7n78lkQ0VyUWyxjzhAHpmp9+WYa7WoLg5dcF6EBocHes64dSmUM/zt8ZnPF/lvLwyOTp+arF0bCOgySjYvLpgPXbuBT5nzhP67uSmcPfR0Xg2VFLZSE6aioTb0EX1Wy2ATQ+BTa0L1nk33gr8hSkIHXxvclO46/hIPO+VVNZgnXAzuk6YbAUA524Us3YjGL9pW29uXbAehG8xAWEFBhfpTWwOd73wkkTOK6tMJKeUoUi4I/CEg2sNYJSrfPFzjTpp5kqhza8L1tNb0B3LBiBUePju1MZw3/O3dXS4vhKeuVW5tqFvCHlvVfHgqiuHLlbuRc95rmTAIUBIhJgMXuss40tUyTACfRehMXQ7fPNGSD74myRdn+2g9GAZFVGVu3E2U28GJtEroRZYZZ2qcrA8fDHVF+JnI/H0jmdzYa+sIr4rVIP3O5bAduAj6BsAHRVKXRM33rZqU9lBiJUF0MoCaGVlAbSyAFpZWQCtLIBWVhZAKwuglZUF0MoCaGVlAbSyAFpZWQCtLIBWVhZAKwuglZUF0MoCaGVlAbSyAFpZWQCtLIBWVhZAKwuglZUF0MoCaGVVV/8/AKGiojO76Zy3AAAAAElFTkSuQmCC)';
6999 5912 this.appIcon.style.backgroundSize = '90% 90%';
7000 5913 }));
7001 5914
7002   - if (urlParams['embed'] != '1')
7003   - {
  5915 + if (urlParams['embed'] != '1') {
7004 5916 this.menubarContainer.appendChild(this.appIcon);
7005 5917 }
7006 5918
... ... @@ -7025,20 +5937,16 @@ App.prototype.updateHeader = function()
7025 5937 this.fname.style.display = 'none';
7026 5938
7027 5939 // Prevents focus
7028   - mxEvent.addListener(this.fname, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown',
7029   - mxUtils.bind(this, function(evt)
7030   - {
7031   - evt.preventDefault();
7032   - }));
  5940 + mxEvent.addListener(this.fname, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown',
  5941 + mxUtils.bind(this, function (evt) {
  5942 + evt.preventDefault();
  5943 + }));
7033 5944
7034   - mxEvent.addListener(this.fname, 'click', mxUtils.bind(this, function(evt)
7035   - {
  5945 + mxEvent.addListener(this.fname, 'click', mxUtils.bind(this, function (evt) {
7036 5946 var file = this.getCurrentFile();
7037 5947
7038   - if (file != null && file.isRenamable())
7039   - {
7040   - if (this.editor.graph.isEditing())
7041   - {
  5948 + if (file != null && file.isRenamable()) {
  5949 + if (this.editor.graph.isEditing()) {
7042 5950 this.editor.graph.stopEditing();
7043 5951 }
7044 5952
... ... @@ -7050,8 +5958,7 @@ App.prototype.updateHeader = function()
7050 5958
7051 5959 this.fnameWrapper.appendChild(this.fname);
7052 5960
7053   - if (urlParams['embed'] != '1')
7054   - {
  5961 + if (urlParams['embed'] != '1') {
7055 5962 this.menubarContainer.appendChild(this.fnameWrapper);
7056 5963
7057 5964 this.menubar.container.style.position = 'absolute';
... ... @@ -7079,35 +5986,31 @@ App.prototype.updateHeader = function()
7079 5986 this.toggleFormatElement.style.backgroundRepeat = 'no-repeat';
7080 5987 this.toolbarContainer.appendChild(this.toggleFormatElement);
7081 5988
7082   - if (uiTheme == 'dark')
7083   - {
  5989 + if (uiTheme == 'dark') {
7084 5990 this.toggleFormatElement.style.filter = 'invert(100%)';
7085 5991 }
7086 5992
7087 5993 // Prevents focus
7088   - mxEvent.addListener(this.toggleFormatElement, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown',
7089   - mxUtils.bind(this, function(evt)
7090   - {
7091   - evt.preventDefault();
7092   - }));
  5994 + mxEvent.addListener(this.toggleFormatElement, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown',
  5995 + mxUtils.bind(this, function (evt) {
  5996 + evt.preventDefault();
  5997 + }));
7093 5998
7094   - mxEvent.addListener(this.toggleFormatElement, 'click', mxUtils.bind(this, function(evt)
7095   - {
7096   - EditorUi.logEvent({category: 'TOOLBAR-ACTION-',
7097   - action: 'formatPanel'});
  5999 + mxEvent.addListener(this.toggleFormatElement, 'click', mxUtils.bind(this, function (evt) {
  6000 + EditorUi.logEvent({
  6001 + category: 'TOOLBAR-ACTION-',
  6002 + action: 'formatPanel'
  6003 + });
7098 6004
7099 6005 this.actions.get('formatPanel').funct();
7100 6006 mxEvent.consume(evt);
7101 6007 }));
7102 6008
7103   - var toggleFormatPanel = mxUtils.bind(this, function()
7104   - {
7105   - if (this.formatWidth > 0)
7106   - {
  6009 + var toggleFormatPanel = mxUtils.bind(this, function () {
  6010 + if (this.formatWidth > 0) {
7107 6011 this.toggleFormatElement.style.backgroundImage = 'url(\'' + this.formatShowImage + '\')';
7108 6012 }
7109   - else
7110   - {
  6013 + else {
7111 6014 this.toggleFormatElement.style.backgroundImage = 'url(\'' + this.formatHideImage + '\')';
7112 6015 }
7113 6016 });
... ... @@ -7133,39 +6036,35 @@ App.prototype.updateHeader = function()
7133 6036
7134 6037 // Prevents focus
7135 6038 mxEvent.addListener(this.fullscreenElement, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown',
7136   - mxUtils.bind(this, function(evt)
7137   - {
7138   - evt.preventDefault();
7139   - }));
  6039 + mxUtils.bind(this, function (evt) {
  6040 + evt.preventDefault();
  6041 + }));
7140 6042
7141 6043 // Some style changes in Atlas theme
7142   - if (uiTheme == 'atlas')
7143   - {
  6044 + if (uiTheme == 'atlas') {
7144 6045 mxUtils.setOpacity(this.toggleFormatElement, 70);
7145 6046 mxUtils.setOpacity(this.fullscreenElement, 70);
7146 6047 }
7147 6048
7148 6049 var initialPosition = this.hsplitPosition;
7149 6050
7150   - if (uiTheme == 'dark')
7151   - {
  6051 + if (uiTheme == 'dark') {
7152 6052 this.fullscreenElement.style.filter = 'invert(100%)';
7153 6053 }
7154 6054
7155   - mxEvent.addListener(this.fullscreenElement, 'click', mxUtils.bind(this, function(evt)
7156   - {
  6055 + mxEvent.addListener(this.fullscreenElement, 'click', mxUtils.bind(this, function (evt) {
7157 6056 var visible = this.fullscreenMode;
7158 6057
7159   - EditorUi.logEvent({category: 'TOOLBAR-ACTION-',
7160   - action: 'fullscreen' , currentstate: visible});
  6058 + EditorUi.logEvent({
  6059 + category: 'TOOLBAR-ACTION-',
  6060 + action: 'fullscreen', currentstate: visible
  6061 + });
7161 6062
7162   - if (uiTheme != 'atlas' && urlParams['embed'] != '1')
7163   - {
  6063 + if (uiTheme != 'atlas' && urlParams['embed'] != '1') {
7164 6064 this.toggleCompactMode(visible);
7165 6065 }
7166 6066
7167   - if (!visible)
7168   - {
  6067 + if (!visible) {
7169 6068 initialPosition = this.hsplitPosition;
7170 6069 }
7171 6070
... ... @@ -7178,8 +6077,7 @@ App.prototype.updateHeader = function()
7178 6077 /**
7179 6078 * Adds compact UI toggle.
7180 6079 */
7181   - if (urlParams['embed'] != '1')
7182   - {
  6080 + if (urlParams['embed'] != '1') {
7183 6081 this.toggleElement = document.createElement('a');
7184 6082 this.toggleElement.setAttribute('title', mxResources.get('collapseExpand'));
7185 6083 this.toggleElement.className = 'geButton';
... ... @@ -7198,37 +6096,33 @@ App.prototype.updateHeader = function()
7198 6096 this.toggleElement.style.backgroundPosition = '50% 50%';
7199 6097 this.toggleElement.style.backgroundRepeat = 'no-repeat';
7200 6098
7201   - if (uiTheme == 'dark')
7202   - {
  6099 + if (uiTheme == 'dark') {
7203 6100 this.toggleElement.style.filter = 'invert(100%)';
7204 6101 }
7205 6102
7206 6103 // Prevents focus
7207 6104 mxEvent.addListener(this.toggleElement, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown',
7208   - mxUtils.bind(this, function(evt)
7209   - {
7210   - evt.preventDefault();
7211   - }));
  6105 + mxUtils.bind(this, function (evt) {
  6106 + evt.preventDefault();
  6107 + }));
7212 6108
7213 6109 // Toggles compact mode
7214   - mxEvent.addListener(this.toggleElement, 'click', mxUtils.bind(this, function(evt)
7215   - {
7216   - EditorUi.logEvent({category: 'TOOLBAR-ACTION-',
7217   - action: 'toggleUI'});
  6110 + mxEvent.addListener(this.toggleElement, 'click', mxUtils.bind(this, function (evt) {
  6111 + EditorUi.logEvent({
  6112 + category: 'TOOLBAR-ACTION-',
  6113 + action: 'toggleUI'
  6114 + });
7218 6115 this.toggleCompactMode();
7219 6116 mxEvent.consume(evt);
7220 6117 }));
7221 6118
7222   - if (uiTheme != 'atlas')
7223   - {
  6119 + if (uiTheme != 'atlas') {
7224 6120 this.toolbarContainer.appendChild(this.toggleElement);
7225 6121 }
7226 6122
7227 6123 // Enable compact mode for small screens except for Firefox where the height is wrong
7228   - if (!mxClient.IS_FF && screen.height <= 740 && typeof this.toggleElement.click !== 'undefined')
7229   - {
7230   - window.setTimeout(mxUtils.bind(this, function()
7231   - {
  6124 + if (!mxClient.IS_FF && screen.height <= 740 && typeof this.toggleElement.click !== 'undefined') {
  6125 + window.setTimeout(mxUtils.bind(this, function () {
7232 6126 this.toggleElement.click();
7233 6127 }), 0);
7234 6128 }
... ... @@ -7241,12 +6135,10 @@ App.prototype.updateHeader = function()
7241 6135 * 添加侦听器用于自动保存本地更改的关系图
7242 6136 * 切换紧凑模式
7243 6137 */
7244   -App.prototype.toggleCompactMode = function(visible)
7245   -{
  6138 +App.prototype.toggleCompactMode = function (visible) {
7246 6139 visible = (visible != null) ? visible : this.compactMode;
7247 6140
7248   - if (visible)
7249   - {
  6141 + if (visible) {
7250 6142 this.menubar.container.style.position = 'absolute';
7251 6143 this.menubar.container.style.paddingLeft = '59px';
7252 6144 this.menubar.container.style.paddingTop = '';
... ... @@ -7261,8 +6153,7 @@ App.prototype.toggleCompactMode = function(visible)
7261 6153 this.refresh();
7262 6154 this.toggleElement.style.backgroundImage = 'url(\'' + this.chevronUpImage + '\')';
7263 6155 }
7264   - else
7265   - {
  6156 + else {
7266 6157 this.menubar.container.style.position = 'relative';
7267 6158 this.menubar.container.style.paddingLeft = '4px';
7268 6159 this.menubar.container.style.paddingTop = '0px';
... ... @@ -7285,8 +6176,7 @@ App.prototype.toggleCompactMode = function(visible)
7285 6176 * Adds the listener for automatically saving the diagram for local changes.
7286 6177 * 添加侦听器用于自动保存本地更改的关系图
7287 6178 */
7288   -App.prototype.updateUserElement = function()
7289   -{
  6179 +App.prototype.updateUserElement = function () {
7290 6180 if ((this.drive == null || this.drive.getUser() == null) &&
7291 6181 (this.oneDrive == null || this.oneDrive.getUser() == null) &&
7292 6182 (this.dropbox == null || this.dropbox.getUser() == null) &&
... ... @@ -7294,16 +6184,13 @@ App.prototype.updateUserElement = function()
7294 6184 (this.gitLab == null || this.gitLab.getUser() == null) &&
7295 6185 (this.trello == null || !this.trello.isAuthorized())) //TODO Trello no user issue
7296 6186 {
7297   - if (this.userElement != null)
7298   - {
  6187 + if (this.userElement != null) {
7299 6188 this.userElement.parentNode.removeChild(this.userElement);
7300 6189 this.userElement = null;
7301 6190 }
7302 6191 }
7303   - else
7304   - {
7305   - if (this.userElement == null)
7306   - {
  6192 + else {
  6193 + if (this.userElement == null) {
7307 6194 this.userElement = document.createElement('a');
7308 6195 this.userElement.className = 'geItem';
7309 6196 this.userElement.style.position = 'absolute';
... ... @@ -7314,7 +6201,7 @@ App.prototype.updateUserElement = function()
7314 6201 this.userElement.style.padding = '2px';
7315 6202 this.userElement.style.paddingRight = '16px';
7316 6203 this.userElement.style.verticalAlign = 'middle';
7317   - this.userElement.style.backgroundImage = 'url(' + IMAGE_PATH + '/expanded.gif)';
  6204 + this.userElement.style.backgroundImage = 'url(' + IMAGE_PATH + '/expanded.gif)';
7318 6205 this.userElement.style.backgroundPosition = '100% 60%';
7319 6206 this.userElement.style.backgroundRepeat = 'no-repeat';
7320 6207
... ... @@ -7322,15 +6209,12 @@ App.prototype.updateUserElement = function()
7322 6209
7323 6210 // Prevents focus
7324 6211 mxEvent.addListener(this.userElement, (mxClient.IS_POINTER) ? 'pointerdown' : 'mousedown',
7325   - mxUtils.bind(this, function(evt)
7326   - {
7327   - evt.preventDefault();
7328   - }));
  6212 + mxUtils.bind(this, function (evt) {
  6213 + evt.preventDefault();
  6214 + }));
7329 6215
7330   - mxEvent.addListener(this.userElement, 'click', mxUtils.bind(this, function(evt)
7331   - {
7332   - if (this.userPanel == null)
7333   - {
  6216 + mxEvent.addListener(this.userElement, 'click', mxUtils.bind(this, function (evt) {
  6217 + if (this.userPanel == null) {
7334 6218 var div = document.createElement('div');
7335 6219 div.className = 'geDialog';
7336 6220 div.style.position = 'absolute';
... ... @@ -7345,12 +6229,10 @@ App.prototype.updateUserElement = function()
7345 6229 this.userPanel = div;
7346 6230 }
7347 6231
7348   - if (this.userPanel.parentNode != null)
7349   - {
  6232 + if (this.userPanel.parentNode != null) {
7350 6233 this.userPanel.parentNode.removeChild(this.userPanel);
7351 6234 }
7352   - else
7353   - {
  6235 + else {
7354 6236 var connected = false;
7355 6237 this.userPanel.innerHTML = '';
7356 6238
... ... @@ -7362,50 +6244,41 @@ App.prototype.updateUserElement = function()
7362 6244 img.style.top = '8px';
7363 6245 img.style.right = '8px';
7364 6246
7365   - mxEvent.addListener(img, 'click', mxUtils.bind(this, function()
7366   - {
7367   - if (this.userPanel.parentNode != null)
7368   - {
  6247 + mxEvent.addListener(img, 'click', mxUtils.bind(this, function () {
  6248 + if (this.userPanel.parentNode != null) {
7369 6249 this.userPanel.parentNode.removeChild(this.userPanel);
7370 6250 }
7371 6251 }));
7372 6252
7373 6253 this.userPanel.appendChild(img);
7374 6254
7375   - if (this.drive != null)
7376   - {
  6255 + if (this.drive != null) {
7377 6256 var driveUsers = this.drive.getUsersList();
7378 6257
7379   - if (driveUsers.length > 0)
7380   - {
  6258 + if (driveUsers.length > 0) {
7381 6259 // LATER: Cannot change user while file is open since close will not work with new
7382 6260 // credentials and closing the file using fileLoaded(null) will show splash dialog.
7383   - var closeFile = mxUtils.bind(this, function(callback, spinnerMsg)
7384   - {
  6261 + var closeFile = mxUtils.bind(this, function (callback, spinnerMsg) {
7385 6262 var file = this.getCurrentFile();
7386 6263
7387   - if (file != null && file.constructor == DriveFile)
7388   - {
  6264 + if (file != null && file.constructor == DriveFile) {
7389 6265 this.spinner.spin(document.body, spinnerMsg);
7390 6266
7391   -// file.close();
  6267 + // file.close();
7392 6268 this.fileLoaded(null);
7393 6269
7394 6270 // LATER: Use callback to wait for thumbnail update
7395   - window.setTimeout(mxUtils.bind(this, function()
7396   - {
  6271 + window.setTimeout(mxUtils.bind(this, function () {
7397 6272 this.spinner.stop();
7398 6273 callback();
7399 6274 }), 2000);
7400 6275 }
7401   - else
7402   - {
  6276 + else {
7403 6277 callback();
7404 6278 }
7405 6279 });
7406 6280
7407   - var createUserRow = mxUtils.bind(this, function (user)
7408   - {
  6281 + var createUserRow = mxUtils.bind(this, function (user) {
7409 6282 var tr = document.createElement('tr');
7410 6283 tr.setAttribute('title', 'User ID: ' + user.id);
7411 6284
... ... @@ -7433,10 +6306,9 @@ App.prototype.updateUserElement = function()
7433 6306 td.style.textOverflow = 'ellipsis';
7434 6307 mxUtils.write(td, user.displayName +
7435 6308 ((user.isCurrent && driveUsers.length > 1) ?
7436   - ' (' + mxResources.get('default') + ')' : ''));
  6309 + ' (' + mxResources.get('default') + ')' : ''));
7437 6310
7438   - if (user.email != null)
7439   - {
  6311 + if (user.email != null) {
7440 6312 mxUtils.br(td);
7441 6313
7442 6314 var small = document.createElement('small');
... ... @@ -7454,25 +6326,20 @@ App.prototype.updateUserElement = function()
7454 6326 td.appendChild(div);
7455 6327 tr.appendChild(td);
7456 6328
7457   - if (!user.isCurrent)
7458   - {
  6329 + if (!user.isCurrent) {
7459 6330 tr.style.cursor = 'pointer';
7460 6331 tr.style.opacity = '0.3';
7461 6332
7462   - mxEvent.addListener(tr, 'click', mxUtils.bind(this, function(evt)
7463   - {
7464   - closeFile(mxUtils.bind(this, function()
7465   - {
  6333 + mxEvent.addListener(tr, 'click', mxUtils.bind(this, function (evt) {
  6334 + closeFile(mxUtils.bind(this, function () {
7466 6335 this.stateArg = null;
7467 6336 this.drive.setUser(user);
7468 6337
7469   - this.drive.authorize(true, mxUtils.bind(this, function()
7470   - {
  6338 + this.drive.authorize(true, mxUtils.bind(this, function () {
7471 6339 this.setMode(App.MODE_GOOGLE);
7472 6340 this.hideDialog();
7473 6341 this.showSplash();
7474   - }), mxUtils.bind(this, function(resp)
7475   - {
  6342 + }), mxUtils.bind(this, function (resp) {
7476 6343 this.handleError(resp);
7477 6344 }), true); //Remember is true since add account imply keeping that account
7478 6345 }), mxResources.get('closingFile') + '...');
... ... @@ -7492,8 +6359,7 @@ App.prototype.updateUserElement = function()
7492 6359 driveUserTable.style.width = '100%';
7493 6360 driveUserTable.style.padding = '10px';
7494 6361
7495   - for (var i = 0; i < driveUsers.length; i++)
7496   - {
  6362 + for (var i = 0; i < driveUsers.length; i++) {
7497 6363 driveUserTable.appendChild(createUserRow(driveUsers[i]));
7498 6364 }
7499 6365
... ... @@ -7505,12 +6371,9 @@ App.prototype.updateUserElement = function()
7505 6371 div.style.whiteSpace = 'nowrap';
7506 6372 div.style.borderTop = '1px solid rgb(224, 224, 224)';
7507 6373
7508   - var btn = mxUtils.button(mxResources.get('signOut'), mxUtils.bind(this, function()
7509   - {
7510   - this.confirm(mxResources.get('areYouSure'), mxUtils.bind(this, function()
7511   - {
7512   - closeFile(mxUtils.bind(this, function()
7513   - {
  6374 + var btn = mxUtils.button(mxResources.get('signOut'), mxUtils.bind(this, function () {
  6375 + this.confirm(mxResources.get('areYouSure'), mxUtils.bind(this, function () {
  6376 + closeFile(mxUtils.bind(this, function () {
7514 6377 this.stateArg = null;
7515 6378 this.drive.logout();
7516 6379 this.setMode(App.MODE_GOOGLE);
... ... @@ -7523,24 +6386,20 @@ App.prototype.updateUserElement = function()
7523 6386 btn.style.float = 'right';
7524 6387 div.appendChild(btn);
7525 6388
7526   - var btn = mxUtils.button(mxResources.get('addAccount'), mxUtils.bind(this, function()
7527   - {
  6389 + var btn = mxUtils.button(mxResources.get('addAccount'), mxUtils.bind(this, function () {
7528 6390 var authWin = this.drive.createAuthWin();
7529 6391 //FIXME This doean't work to set focus back to main window until closing the file is done
7530 6392 authWin.blur();
7531 6393 window.focus();
7532 6394
7533   - closeFile(mxUtils.bind(this, function()
7534   - {
  6395 + closeFile(mxUtils.bind(this, function () {
7535 6396 this.stateArg = null;
7536 6397
7537   - this.drive.authorize(false, mxUtils.bind(this, function()
7538   - {
  6398 + this.drive.authorize(false, mxUtils.bind(this, function () {
7539 6399 this.setMode(App.MODE_GOOGLE);
7540 6400 this.hideDialog();
7541 6401 this.showSplash();
7542   - }), mxUtils.bind(this, function(resp)
7543   - {
  6402 + }), mxUtils.bind(this, function (resp) {
7544 6403 this.handleError(resp);
7545 6404 }), true, authWin); //Remember is true since add account imply keeping that account
7546 6405 }), mxResources.get('closingFile') + '...');
... ... @@ -7552,12 +6411,9 @@ App.prototype.updateUserElement = function()
7552 6411 }
7553 6412 }
7554 6413
7555   - var addUser = mxUtils.bind(this, function(user, logo, logout, label)
7556   - {
7557   - if (user != null)
7558   - {
7559   - if (connected)
7560   - {
  6414 + var addUser = mxUtils.bind(this, function (user, logo, logout, label) {
  6415 + if (user != null) {
  6416 + if (connected) {
7561 6417 this.userPanel.appendChild(document.createElement('hr'));
7562 6418 }
7563 6419
... ... @@ -7574,8 +6430,7 @@ App.prototype.updateUserElement = function()
7574 6430 td.setAttribute('valig', 'top');
7575 6431 td.style.width = '40px';
7576 6432
7577   - if (logo != null)
7578   - {
  6433 + if (logo != null) {
7579 6434 var img = document.createElement('img');
7580 6435 img.setAttribute('width', '40');
7581 6436 img.setAttribute('height', '40');
... ... @@ -7597,8 +6452,7 @@ App.prototype.updateUserElement = function()
7597 6452
7598 6453 mxUtils.write(td, user.displayName);
7599 6454
7600   - if (user.email != null)
7601   - {
  6455 + if (user.email != null) {
7602 6456 mxUtils.br(td);
7603 6457
7604 6458 var small = document.createElement('small');
... ... @@ -7607,8 +6461,7 @@ App.prototype.updateUserElement = function()
7607 6461 td.appendChild(small);
7608 6462 }
7609 6463
7610   - if (label != null)
7611   - {
  6464 + if (label != null) {
7612 6465 var div = document.createElement('div');
7613 6466 div.style.marginTop = '4px';
7614 6467
... ... @@ -7628,8 +6481,7 @@ App.prototype.updateUserElement = function()
7628 6481 div.style.padding = '10px';
7629 6482 div.style.whiteSpace = 'nowrap';
7630 6483
7631   - if (logout != null)
7632   - {
  6484 + if (logout != null) {
7633 6485 var btn = mxUtils.button(mxResources.get('signOut'), logout);
7634 6486 btn.className = 'geBtn';
7635 6487 div.appendChild(btn);
... ... @@ -7639,164 +6491,128 @@ App.prototype.updateUserElement = function()
7639 6491 }
7640 6492 });
7641 6493
7642   - if (this.dropbox != null)
7643   - {
7644   - addUser(this.dropbox.getUser(), IMAGE_PATH + '/dropbox-logo.svg', mxUtils.bind(this, function()
7645   - {
  6494 + if (this.dropbox != null) {
  6495 + addUser(this.dropbox.getUser(), IMAGE_PATH + '/dropbox-logo.svg', mxUtils.bind(this, function () {
7646 6496 var file = this.getCurrentFile();
7647 6497
7648   - if (file != null && file.constructor == DropboxFile)
7649   - {
7650   - var doLogout = mxUtils.bind(this, function()
7651   - {
  6498 + if (file != null && file.constructor == DropboxFile) {
  6499 + var doLogout = mxUtils.bind(this, function () {
7652 6500 this.dropbox.logout();
7653 6501 window.location.hash = '';
7654 6502 });
7655 6503
7656   - if (!file.isModified())
7657   - {
  6504 + if (!file.isModified()) {
7658 6505 doLogout();
7659 6506 }
7660   - else
7661   - {
  6507 + else {
7662 6508 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
7663 6509 mxResources.get('cancel'), mxResources.get('discardChanges'));
7664 6510 }
7665 6511 }
7666   - else
7667   - {
  6512 + else {
7668 6513 this.dropbox.logout();
7669 6514 }
7670 6515 }), mxResources.get('dropbox'));
7671 6516 }
7672 6517
7673   - if (this.oneDrive != null)
7674   - {
7675   - addUser(this.oneDrive.getUser(), IMAGE_PATH + '/onedrive-logo.svg', this.oneDrive.noLogout? null : mxUtils.bind(this, function()
7676   - {
  6518 + if (this.oneDrive != null) {
  6519 + addUser(this.oneDrive.getUser(), IMAGE_PATH + '/onedrive-logo.svg', this.oneDrive.noLogout ? null : mxUtils.bind(this, function () {
7677 6520 var file = this.getCurrentFile();
7678 6521
7679   - if (file != null && file.constructor == OneDriveFile)
7680   - {
7681   - var doLogout = mxUtils.bind(this, function()
7682   - {
  6522 + if (file != null && file.constructor == OneDriveFile) {
  6523 + var doLogout = mxUtils.bind(this, function () {
7683 6524 this.oneDrive.logout();
7684 6525 window.location.hash = '';
7685 6526 });
7686 6527
7687   - if (!file.isModified())
7688   - {
  6528 + if (!file.isModified()) {
7689 6529 doLogout();
7690 6530 }
7691   - else
7692   - {
  6531 + else {
7693 6532 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
7694 6533 mxResources.get('cancel'), mxResources.get('discardChanges'));
7695 6534 }
7696 6535 }
7697   - else
7698   - {
  6536 + else {
7699 6537 this.oneDrive.logout();
7700 6538 }
7701 6539 }), mxResources.get('oneDrive'));
7702 6540 }
7703 6541
7704   - if (this.gitHub != null)
7705   - {
7706   - addUser(this.gitHub.getUser(), IMAGE_PATH + '/github-logo.svg', mxUtils.bind(this, function()
7707   - {
  6542 + if (this.gitHub != null) {
  6543 + addUser(this.gitHub.getUser(), IMAGE_PATH + '/github-logo.svg', mxUtils.bind(this, function () {
7708 6544 var file = this.getCurrentFile();
7709 6545
7710   - if (file != null && file.constructor == GitHubFile)
7711   - {
7712   - var doLogout = mxUtils.bind(this, function()
7713   - {
  6546 + if (file != null && file.constructor == GitHubFile) {
  6547 + var doLogout = mxUtils.bind(this, function () {
7714 6548 this.gitHub.logout();
7715 6549 window.location.hash = '';
7716 6550 });
7717 6551
7718   - if (!file.isModified())
7719   - {
  6552 + if (!file.isModified()) {
7720 6553 doLogout();
7721 6554 }
7722   - else
7723   - {
  6555 + else {
7724 6556 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
7725 6557 mxResources.get('cancel'), mxResources.get('discardChanges'));
7726 6558 }
7727 6559 }
7728   - else
7729   - {
  6560 + else {
7730 6561 this.gitHub.logout();
7731 6562 }
7732 6563 }), mxResources.get('github'));
7733 6564 }
7734 6565
7735   - if (this.gitLab != null)
7736   - {
7737   - addUser(this.gitLab.getUser(), IMAGE_PATH + '/gitlab-logo.svg', mxUtils.bind(this, function()
7738   - {
  6566 + if (this.gitLab != null) {
  6567 + addUser(this.gitLab.getUser(), IMAGE_PATH + '/gitlab-logo.svg', mxUtils.bind(this, function () {
7739 6568 var file = this.getCurrentFile();
7740 6569
7741   - if (file != null && file.constructor == GitLabFile)
7742   - {
7743   - var doLogout = mxUtils.bind(this, function()
7744   - {
  6570 + if (file != null && file.constructor == GitLabFile) {
  6571 + var doLogout = mxUtils.bind(this, function () {
7745 6572 this.gitLab.logout();
7746 6573 window.location.hash = '';
7747 6574 });
7748 6575
7749   - if (!file.isModified())
7750   - {
  6576 + if (!file.isModified()) {
7751 6577 doLogout();
7752 6578 }
7753   - else
7754   - {
  6579 + else {
7755 6580 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
7756 6581 mxResources.get('cancel'), mxResources.get('discardChanges'));
7757 6582 }
7758 6583 }
7759   - else
7760   - {
  6584 + else {
7761 6585 this.gitLab.logout();
7762 6586 }
7763 6587 }), mxResources.get('gitlab'));
7764 6588 }
7765 6589
7766 6590 //TODO We have no user info from Trello, how we can create a user?
7767   - if (this.trello != null)
7768   - {
7769   - addUser(this.trello.getUser(), IMAGE_PATH + '/trello-logo.svg', mxUtils.bind(this, function()
7770   - {
  6591 + if (this.trello != null) {
  6592 + addUser(this.trello.getUser(), IMAGE_PATH + '/trello-logo.svg', mxUtils.bind(this, function () {
7771 6593 var file = this.getCurrentFile();
7772 6594
7773   - if (file != null && file.constructor == TrelloFile)
7774   - {
7775   - var doLogout = mxUtils.bind(this, function()
7776   - {
  6595 + if (file != null && file.constructor == TrelloFile) {
  6596 + var doLogout = mxUtils.bind(this, function () {
7777 6597 this.trello.logout();
7778 6598 window.location.hash = '';
7779 6599 });
7780 6600
7781   - if (!file.isModified())
7782   - {
  6601 + if (!file.isModified()) {
7783 6602 doLogout();
7784 6603 }
7785   - else
7786   - {
  6604 + else {
7787 6605 this.confirm(mxResources.get('allChangesLost'), null, doLogout,
7788 6606 mxResources.get('cancel'), mxResources.get('discardChanges'));
7789 6607 }
7790 6608 }
7791   - else
7792   - {
  6609 + else {
7793 6610 this.trello.logout();
7794 6611 }
7795 6612 }), mxResources.get('trello'));
7796 6613 }
7797 6614
7798   - if (!connected)
7799   - {
  6615 + if (!connected) {
7800 6616 var div = document.createElement('div');
7801 6617 div.style.textAlign = 'center';
7802 6618 div.style.padding = '10px';
... ... @@ -7812,20 +6628,16 @@ App.prototype.updateUserElement = function()
7812 6628 div.style.borderTop = '1px solid #e0e0e0';
7813 6629 div.style.whiteSpace = 'nowrap';
7814 6630
7815   - if (urlParams['sketch'] == '1')
7816   - {
7817   - var btn = mxUtils.button(mxResources.get('share'), mxUtils.bind(this, function()
7818   - {
  6631 + if (urlParams['sketch'] == '1') {
  6632 + var btn = mxUtils.button(mxResources.get('share'), mxUtils.bind(this, function () {
7819 6633 this.actions.get('share').funct();
7820 6634 }));
7821 6635 btn.className = 'geBtn';
7822 6636 div.appendChild(btn);
7823 6637 this.userPanel.appendChild(div);
7824 6638
7825   - if (this.commentsSupported())
7826   - {
7827   - btn = mxUtils.button(mxResources.get('comments'), mxUtils.bind(this, function()
7828   - {
  6639 + if (this.commentsSupported()) {
  6640 + btn = mxUtils.button(mxResources.get('comments'), mxUtils.bind(this, function () {
7829 6641 this.actions.get('comments').funct();
7830 6642 }));
7831 6643 btn.className = 'geBtn';
... ... @@ -7833,12 +6645,9 @@ App.prototype.updateUserElement = function()
7833 6645 this.userPanel.appendChild(div);
7834 6646 }
7835 6647 }
7836   - else
7837   - {
7838   - var btn = mxUtils.button(mxResources.get('close'), mxUtils.bind(this, function()
7839   - {
7840   - if (!mxEvent.isConsumed(evt) && this.userPanel != null && this.userPanel.parentNode != null)
7841   - {
  6648 + else {
  6649 + var btn = mxUtils.button(mxResources.get('close'), mxUtils.bind(this, function () {
  6650 + if (!mxEvent.isConsumed(evt) && this.userPanel != null && this.userPanel.parentNode != null) {
7842 6651 this.userPanel.parentNode.removeChild(this.userPanel);
7843 6652 }
7844 6653 }));
... ... @@ -7853,10 +6662,8 @@ App.prototype.updateUserElement = function()
7853 6662 mxEvent.consume(evt);
7854 6663 }));
7855 6664
7856   - mxEvent.addListener(document.body, 'click', mxUtils.bind(this, function(evt)
7857   - {
7858   - if (!mxEvent.isConsumed(evt) && this.userPanel != null && this.userPanel.parentNode != null)
7859   - {
  6665 + mxEvent.addListener(document.body, 'click', mxUtils.bind(this, function (evt) {
  6666 + if (!mxEvent.isConsumed(evt) && this.userPanel != null && this.userPanel.parentNode != null) {
7860 6667 this.userPanel.parentNode.removeChild(this.userPanel);
7861 6668 }
7862 6669 }));
... ... @@ -7864,64 +6671,51 @@ App.prototype.updateUserElement = function()
7864 6671
7865 6672 var user = null;
7866 6673
7867   - if (this.drive != null && this.drive.getUser() != null)
7868   - {
  6674 + if (this.drive != null && this.drive.getUser() != null) {
7869 6675 user = this.drive.getUser();
7870 6676 }
7871   - else if (this.oneDrive != null && this.oneDrive.getUser() != null)
7872   - {
  6677 + else if (this.oneDrive != null && this.oneDrive.getUser() != null) {
7873 6678 user = this.oneDrive.getUser();
7874 6679 }
7875   - else if (this.dropbox != null && this.dropbox.getUser() != null)
7876   - {
  6680 + else if (this.dropbox != null && this.dropbox.getUser() != null) {
7877 6681 user = this.dropbox.getUser();
7878 6682 }
7879   - else if (this.gitHub != null && this.gitHub.getUser() != null)
7880   - {
  6683 + else if (this.gitHub != null && this.gitHub.getUser() != null) {
7881 6684 user = this.gitHub.getUser();
7882 6685 }
7883   - else if (this.gitLab != null && this.gitLab.getUser() != null)
7884   - {
  6686 + else if (this.gitLab != null && this.gitLab.getUser() != null) {
7885 6687 user = this.gitLab.getUser();
7886 6688 }
7887 6689 //TODO Trello no user issue
7888 6690
7889   - if (user != null)
7890   - {
  6691 + if (user != null) {
7891 6692 this.userElement.innerHTML = '';
7892 6693
7893   - if (screen.width > 560)
7894   - {
  6694 + if (screen.width > 560) {
7895 6695 mxUtils.write(this.userElement, user.displayName);
7896 6696 this.userElement.style.display = 'block';
7897 6697 }
7898 6698 }
7899   - else
7900   - {
  6699 + else {
7901 6700 this.userElement.style.display = 'none';
7902 6701 }
7903 6702 }
7904 6703 };
7905 6704
7906 6705 //TODO Use this function to get the currently logged in user
7907   -App.prototype.getCurrentUser = function()
7908   -{
  6706 +App.prototype.getCurrentUser = function () {
7909 6707 var user = null;
7910 6708
7911   - if (this.drive != null && this.drive.getUser() != null)
7912   - {
  6709 + if (this.drive != null && this.drive.getUser() != null) {
7913 6710 user = this.drive.getUser();
7914 6711 }
7915   - else if (this.oneDrive != null && this.oneDrive.getUser() != null)
7916   - {
  6712 + else if (this.oneDrive != null && this.oneDrive.getUser() != null) {
7917 6713 user = this.oneDrive.getUser();
7918 6714 }
7919   - else if (this.dropbox != null && this.dropbox.getUser() != null)
7920   - {
  6715 + else if (this.dropbox != null && this.dropbox.getUser() != null) {
7921 6716 user = this.dropbox.getUser();
7922 6717 }
7923   - else if (this.gitHub != null && this.gitHub.getUser() != null)
7924   - {
  6718 + else if (this.gitHub != null && this.gitHub.getUser() != null) {
7925 6719 user = this.gitHub.getUser();
7926 6720 }
7927 6721 //TODO Trello no user issue
... ... @@ -7932,13 +6726,11 @@ App.prototype.getCurrentUser = function()
7932 6726 * Override depends on mxSettings which is not defined in the minified viewer.
7933 6727 */
7934 6728 var editorResetGraph = Editor.prototype.resetGraph;
7935   -Editor.prototype.resetGraph = function()
7936   -{
  6729 +Editor.prototype.resetGraph = function () {
7937 6730 editorResetGraph.apply(this, arguments);
7938 6731
7939 6732 // Overrides default with persisted value
7940   - if (this.graph.defaultPageFormat == null)
7941   - {
  6733 + if (this.graph.defaultPageFormat == null) {
7942 6734 this.graph.pageFormat = mxSettings.getPageFormat();
7943 6735 }
7944 6736 };
... ...
... ... @@ -13834,7 +13834,6 @@ class HandleDataSource {
13834 13834 */
13835 13835 getRealTimeUpdateDashboardChartOption(params = { dataList: [] }) {
13836 13836 const { dataList = [], oldOptions } = params
13837   - console.log({oldOptions})
13838 13837 const [timespan, value] = dataList[0] || []
13839 13838 console.log(value)
13840 13839 return {
... ...