13.0.6 release
This commit is contained in:
parent
77a078dd84
commit
5edbf1dbdb
18 changed files with 1054 additions and 883 deletions
|
@ -1,3 +1,12 @@
|
|||
03-MAY-2020: 13.0.6
|
||||
|
||||
- Disables deltas for OneDrive real time
|
||||
- Adds token for Google Drive real time
|
||||
|
||||
01-MAY-2020: 13.0.5
|
||||
|
||||
- Import Extension code updated
|
||||
|
||||
30-APR-2020: 13.0.4
|
||||
|
||||
- Adds support for vss(x) via clibs parameter
|
||||
|
|
2
VERSION
2
VERSION
|
@ -1 +1 @@
|
|||
13.0.4
|
||||
13.0.6
|
|
@ -46,6 +46,27 @@ public class Utils
|
|||
*/
|
||||
protected static final int IO_BUFFER_SIZE = 4 * 1024;
|
||||
|
||||
/**
|
||||
* Alphabet for global unique IDs.
|
||||
*/
|
||||
public static final String TOKEN_ALPHABET = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_";
|
||||
|
||||
/**
|
||||
* Returns a random string of the given length.
|
||||
*/
|
||||
public static String generateToken(int length)
|
||||
{
|
||||
StringBuffer rtn = new StringBuffer();
|
||||
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
rtn.append(TOKEN_ALPHABET.charAt(
|
||||
(int) Math.floor(Math.random() * TOKEN_ALPHABET.length())));
|
||||
}
|
||||
|
||||
return rtn.toString();
|
||||
};
|
||||
|
||||
/**
|
||||
* Applies a standard inflate algo to the input byte array
|
||||
* @param binary the byte array to inflate
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
script.onload = function()
|
||||
{
|
||||
var importExtensionId = 'hbkpkhcoenkflmbidimljjbhdeggihne';
|
||||
var extensionInstallUrl = 'https://chrome.google.com/webstore/category/extensions';
|
||||
var importExtensionId = 'cnoplimhpndhhhnmoigbanpjeghjpohi';
|
||||
var extensionInstallUrl = 'https://chrome.google.com/webstore/detail/diagramsnet-and-drawio-im/cnoplimhpndhhhnmoigbanpjeghjpohi';
|
||||
|
||||
AP.sizeToParent(true);
|
||||
|
||||
|
|
|
@ -647,13 +647,14 @@ app.on('ready', e =>
|
|||
}, {
|
||||
label: 'Edit',
|
||||
submenu: [
|
||||
{ role: 'undo' },
|
||||
{ role: 'redo' },
|
||||
{ role: 'cut' },
|
||||
{ role: 'copy' },
|
||||
{ role: 'paste' },
|
||||
{ role: 'pasteAndMatchStyle' },
|
||||
{ role: 'selectAll' }
|
||||
{ role: 'undo' },
|
||||
{ role: 'redo' },
|
||||
{ type: 'separator' },
|
||||
{ role: 'cut' },
|
||||
{ role: 'copy' },
|
||||
{ role: 'paste' },
|
||||
{ role: 'pasteAndMatchStyle' },
|
||||
{ role: 'selectAll' }
|
||||
]
|
||||
}]
|
||||
|
||||
|
|
989
src/main/webapp/js/app.min.js
vendored
989
src/main/webapp/js/app.min.js
vendored
File diff suppressed because it is too large
Load diff
|
@ -1464,7 +1464,7 @@ App.prototype.init = function()
|
|||
}
|
||||
|
||||
if (!mxClient.IS_CHROMEAPP && !EditorUi.isElectronApp && urlParams['embed'] != '1' && DrawioFile.SYNC == 'auto' &&
|
||||
urlParams['local'] != '1' && urlParams['stealth'] != '1' && this.isOffline() &&
|
||||
urlParams['local'] != '1' && urlParams['stealth'] != '1' && !this.isOffline() &&
|
||||
(!this.editor.chromeless || this.editor.editable))
|
||||
{
|
||||
// Checks if the cache is alive
|
||||
|
|
|
@ -2671,7 +2671,7 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
|
|||
var nameInput = document.createElement('input');
|
||||
nameInput.setAttribute('value', editorUi.defaultFilename + ext);
|
||||
nameInput.style.marginLeft = '10px';
|
||||
nameInput.style.width = (compact) ? '144px' : '284px';
|
||||
nameInput.style.width = (compact) ? '144px' : '244px';
|
||||
|
||||
this.init = function()
|
||||
{
|
||||
|
@ -2699,7 +2699,7 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
|
|||
{
|
||||
var typeSelect = FilenameDialog.createFileTypes(editorUi, nameInput, editorUi.editor.diagramFileTypes);
|
||||
typeSelect.style.marginLeft = '6px';
|
||||
typeSelect.style.width = (compact) ? '80px' : '140px';
|
||||
typeSelect.style.width = (compact) ? '80px' : '180px';
|
||||
header.appendChild(typeSelect);
|
||||
}
|
||||
|
||||
|
|
|
@ -1331,7 +1331,15 @@ DrawioFile.prototype.getDescriptorEtag = function(desc)
|
|||
};
|
||||
|
||||
/**
|
||||
* Returns the secret from the given descriptor.
|
||||
* Returns the secret from the given descriptor. This must be stored
|
||||
* in a custom property and generated by the saving client so that a
|
||||
* token can be obtained from the cache for writing the patch after
|
||||
* saving the file. If this cannot be saved in a custom property then
|
||||
* null must be returned so that no deltas are used for updating the
|
||||
* file (the file is reloaded every time instead). This is needed to
|
||||
* make sure nobody with read-only permissions can write a patch to
|
||||
* the cache before the saving client wrote the patch and inject
|
||||
* data into the file via other clients merging that data.
|
||||
*/
|
||||
DrawioFile.prototype.getDescriptorSecret = function(desc)
|
||||
{
|
||||
|
@ -1934,10 +1942,30 @@ DrawioFile.prototype.fileChanged = function()
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a secret and token pair for writing a patch to the cache.
|
||||
*/
|
||||
DrawioFile.prototype.createSecret = function(success, error)
|
||||
{
|
||||
var secret = Editor.guid(32);
|
||||
|
||||
if (this.sync != null)
|
||||
{
|
||||
this.sync.createToken(secret, mxUtils.bind(this, function(token)
|
||||
{
|
||||
success(secret, token);
|
||||
}), error);
|
||||
}
|
||||
else
|
||||
{
|
||||
success(secret);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Invokes sync and updates shadow document.
|
||||
*/
|
||||
DrawioFile.prototype.fileSaved = function(savedData, lastDesc, success, error)
|
||||
DrawioFile.prototype.fileSaved = function(savedData, lastDesc, success, error, token)
|
||||
{
|
||||
this.lastSaved = new Date();
|
||||
this.ageStart = null;
|
||||
|
@ -1962,7 +1990,7 @@ DrawioFile.prototype.fileSaved = function(savedData, lastDesc, success, error)
|
|||
{
|
||||
this.sync.fileSaved(this.ui.getPagesForNode(
|
||||
mxUtils.parseXml(savedData).documentElement),
|
||||
lastDesc, success, error, savedData);
|
||||
lastDesc, success, error, token);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
|
|
|
@ -724,152 +724,159 @@ DrawioFileSync.prototype.catchup = function(desc, success, error, abort)
|
|||
{
|
||||
var secret = this.file.getDescriptorSecret(desc);
|
||||
|
||||
// Cache entry may not have been uploaded to cache before new
|
||||
// etag is visible to client so retry once after cache miss
|
||||
var cacheReadyRetryCount = 0;
|
||||
var failed = false;
|
||||
|
||||
var doCatchup = mxUtils.bind(this, function()
|
||||
if (secret == null)
|
||||
{
|
||||
if (abort == null || !abort())
|
||||
this.reload(success, error, abort);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Cache entry may not have been uploaded to cache before new
|
||||
// etag is visible to client so retry once after cache miss
|
||||
var cacheReadyRetryCount = 0;
|
||||
var failed = false;
|
||||
|
||||
var doCatchup = mxUtils.bind(this, function()
|
||||
{
|
||||
// Ignores patch if shadow has changed
|
||||
if (current != this.file.getCurrentRevisionId())
|
||||
if (abort == null || !abort())
|
||||
{
|
||||
if (success != null)
|
||||
// Ignores patch if shadow has changed
|
||||
if (current != this.file.getCurrentRevisionId())
|
||||
{
|
||||
success();
|
||||
}
|
||||
}
|
||||
else if (!this.isValidState())
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var acceptResponse = true;
|
||||
|
||||
var timeoutThread = window.setTimeout(mxUtils.bind(this, function()
|
||||
{
|
||||
acceptResponse = false;
|
||||
this.reload(success, error, abort);
|
||||
}), this.ui.timeout);
|
||||
|
||||
mxUtils.get(EditorUi.cacheUrl + '?id=' + encodeURIComponent(this.channelId) +
|
||||
'&from=' + encodeURIComponent(current) + '&to=' + encodeURIComponent(etag) +
|
||||
((secret != null) ? '&secret=' + encodeURIComponent(secret) : ''),
|
||||
mxUtils.bind(this, function(req)
|
||||
{
|
||||
this.file.stats.bytesReceived += req.getText().length;
|
||||
window.clearTimeout(timeoutThread);
|
||||
|
||||
if (acceptResponse && (abort == null || !abort()))
|
||||
if (success != null)
|
||||
{
|
||||
// Ignores patch if shadow has changed
|
||||
if (current != this.file.getCurrentRevisionId())
|
||||
{
|
||||
if (success != null)
|
||||
{
|
||||
success();
|
||||
}
|
||||
}
|
||||
else if (!this.isValidState())
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var checksum = null;
|
||||
var temp = [];
|
||||
success();
|
||||
}
|
||||
}
|
||||
else if (!this.isValidState())
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var acceptResponse = true;
|
||||
|
||||
if (req.getStatus() >= 200 && req.getStatus() <= 299 &&
|
||||
req.getText().length > 0)
|
||||
var timeoutThread = window.setTimeout(mxUtils.bind(this, function()
|
||||
{
|
||||
acceptResponse = false;
|
||||
this.reload(success, error, abort);
|
||||
}), this.ui.timeout);
|
||||
|
||||
mxUtils.get(EditorUi.cacheUrl + '?id=' + encodeURIComponent(this.channelId) +
|
||||
'&from=' + encodeURIComponent(current) + '&to=' + encodeURIComponent(etag) +
|
||||
((secret != null) ? '&secret=' + encodeURIComponent(secret) : ''),
|
||||
mxUtils.bind(this, function(req)
|
||||
{
|
||||
this.file.stats.bytesReceived += req.getText().length;
|
||||
window.clearTimeout(timeoutThread);
|
||||
|
||||
if (acceptResponse && (abort == null || !abort()))
|
||||
{
|
||||
// Ignores patch if shadow has changed
|
||||
if (current != this.file.getCurrentRevisionId())
|
||||
{
|
||||
try
|
||||
if (success != null)
|
||||
{
|
||||
var result = JSON.parse(req.getText());
|
||||
|
||||
if (result != null && result.length > 0)
|
||||
success();
|
||||
}
|
||||
}
|
||||
else if (!this.isValidState())
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var checksum = null;
|
||||
var temp = [];
|
||||
|
||||
if (req.getStatus() >= 200 && req.getStatus() <= 299 &&
|
||||
req.getText().length > 0)
|
||||
{
|
||||
try
|
||||
{
|
||||
for (var i = 0; i < result.length; i++)
|
||||
var result = JSON.parse(req.getText());
|
||||
|
||||
if (result != null && result.length > 0)
|
||||
{
|
||||
var value = this.stringToObject(result[i]);
|
||||
|
||||
if (value.v > DrawioFileSync.PROTOCOL)
|
||||
for (var i = 0; i < result.length; i++)
|
||||
{
|
||||
failed = true;
|
||||
temp = [];
|
||||
break;
|
||||
}
|
||||
else if (value.v === DrawioFileSync.PROTOCOL &&
|
||||
value.d != null)
|
||||
{
|
||||
checksum = value.d.checksum;
|
||||
temp.push(value.d.patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
temp = [];
|
||||
break;
|
||||
var value = this.stringToObject(result[i]);
|
||||
|
||||
if (value.v > DrawioFileSync.PROTOCOL)
|
||||
{
|
||||
failed = true;
|
||||
temp = [];
|
||||
break;
|
||||
}
|
||||
else if (value.v === DrawioFileSync.PROTOCOL &&
|
||||
value.d != null)
|
||||
{
|
||||
checksum = value.d.checksum;
|
||||
temp.push(value.d.patch);
|
||||
}
|
||||
else
|
||||
{
|
||||
failed = true;
|
||||
temp = [];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
temp = [];
|
||||
|
||||
if (window.console != null && urlParams['test'] == '1')
|
||||
{
|
||||
console.log(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (temp.length > 0)
|
||||
{
|
||||
this.file.stats.cacheHits++;
|
||||
this.merge(temp, checksum, desc, success, error, abort);
|
||||
}
|
||||
// Retries if cache entry was not yet there
|
||||
else if (cacheReadyRetryCount <= this.maxCacheReadyRetries - 1 &&
|
||||
!failed && req.getStatus() != 401)
|
||||
{
|
||||
cacheReadyRetryCount++;
|
||||
this.file.stats.cacheMiss++;
|
||||
window.setTimeout(doCatchup, (cacheReadyRetryCount + 1) *
|
||||
this.cacheReadyDelay);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.file.stats.cacheFail++;
|
||||
this.reload(success, error, abort);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
temp = [];
|
||||
|
||||
if (window.console != null && urlParams['test'] == '1')
|
||||
if (error != null)
|
||||
{
|
||||
console.log(e);
|
||||
error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (temp.length > 0)
|
||||
{
|
||||
this.file.stats.cacheHits++;
|
||||
this.merge(temp, checksum, desc, success, error, abort);
|
||||
}
|
||||
// Retries if cache entry was not yet there
|
||||
else if (cacheReadyRetryCount <= this.maxCacheReadyRetries - 1 &&
|
||||
!failed && req.getStatus() != 401)
|
||||
{
|
||||
cacheReadyRetryCount++;
|
||||
this.file.stats.cacheMiss++;
|
||||
window.setTimeout(doCatchup, (cacheReadyRetryCount + 1) *
|
||||
this.cacheReadyDelay);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.file.stats.cacheFail++;
|
||||
this.reload(success, error, abort);
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
if (error != null)
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
}));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window.setTimeout(doCatchup, this.cacheReadyDelay);
|
||||
});
|
||||
|
||||
window.setTimeout(doCatchup, this.cacheReadyDelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1033,8 +1040,7 @@ DrawioFileSync.prototype.merge = function(patches, checksum, desc, success, erro
|
|||
};
|
||||
|
||||
/**
|
||||
* Invokes after a file was saved to add cache entry (which in turn notifies
|
||||
* collaborators).
|
||||
* Invokes when the file descriptor was changed.
|
||||
*/
|
||||
DrawioFileSync.prototype.descriptorChanged = function(etag)
|
||||
{
|
||||
|
@ -1058,8 +1064,7 @@ DrawioFileSync.prototype.descriptorChanged = function(etag)
|
|||
};
|
||||
|
||||
/**
|
||||
* Invokes after a file was saved to add cache entry (which in turn notifies
|
||||
* collaborators).
|
||||
* Converts the given object to an encrypted string.
|
||||
*/
|
||||
DrawioFileSync.prototype.objectToString = function(obj)
|
||||
{
|
||||
|
@ -1074,8 +1079,7 @@ DrawioFileSync.prototype.objectToString = function(obj)
|
|||
};
|
||||
|
||||
/**
|
||||
* Invokes after a file was saved to add cache entry (which in turn notifies
|
||||
* collaborators).
|
||||
* Converts the given encrypted string to an object.
|
||||
*/
|
||||
DrawioFileSync.prototype.stringToObject = function(data)
|
||||
{
|
||||
|
@ -1088,10 +1092,42 @@ DrawioFileSync.prototype.stringToObject = function(data)
|
|||
};
|
||||
|
||||
/**
|
||||
* Invokes after a file was saved to add cache entry (which in turn notifies
|
||||
* Requests a token for the given sec
|
||||
*/
|
||||
DrawioFileSync.prototype.createToken = function(secret, success, error)
|
||||
{
|
||||
var acceptResponse = true;
|
||||
|
||||
var timeoutThread = window.setTimeout(mxUtils.bind(this, function()
|
||||
{
|
||||
acceptResponse = false;
|
||||
error({code: App.ERROR_TIMEOUT, message: mxResources.get('timeout')});
|
||||
}), this.ui.timeout);
|
||||
|
||||
mxUtils.get(EditorUi.cacheUrl + '?id=' + encodeURIComponent(this.channelId) +
|
||||
'&secret=' + encodeURIComponent(secret), mxUtils.bind(this, function(req)
|
||||
{
|
||||
window.clearTimeout(timeoutThread);
|
||||
|
||||
if (acceptResponse)
|
||||
{
|
||||
if (req.getStatus() >= 200 && req.getStatus() <= 299)
|
||||
{
|
||||
success(req.getText());
|
||||
}
|
||||
else
|
||||
{
|
||||
error({code: req.getStatus(), message: 'Token Error ' + req.getStatus()});
|
||||
}
|
||||
}
|
||||
}));
|
||||
};
|
||||
|
||||
/**
|
||||
* Invoked after a file was saved to add cache entry (which in turn notifies
|
||||
* collaborators).
|
||||
*/
|
||||
DrawioFileSync.prototype.fileSaved = function(pages, lastDesc, success, error)
|
||||
DrawioFileSync.prototype.fileSaved = function(pages, lastDesc, success, error, token)
|
||||
{
|
||||
this.lastModified = this.file.getLastModifiedDate();
|
||||
this.resetUpdateStatusThread();
|
||||
|
@ -1104,37 +1140,85 @@ DrawioFileSync.prototype.fileSaved = function(pages, lastDesc, success, error)
|
|||
if (this.channelId != null)
|
||||
{
|
||||
// Computes diff and checksum
|
||||
var shadow = (this.file.shadowPages != null) ?
|
||||
this.file.shadowPages : this.ui.getPagesForNode(
|
||||
mxUtils.parseXml(this.file.shadowData).documentElement)
|
||||
var checksum = this.ui.getHashValueForPages(pages);
|
||||
var diff = this.ui.diffPages(shadow, pages);
|
||||
|
||||
// Data is stored in cache and message is sent to all listeners
|
||||
var msg = this.objectToString(this.createMessage({m: this.lastModified.getTime()}));
|
||||
var secret = this.file.getDescriptorSecret(this.file.getDescriptor());
|
||||
var etag = this.file.getDescriptorRevisionId(lastDesc);
|
||||
var current = this.file.getCurrentRevisionId();
|
||||
|
||||
var data = this.objectToString(this.createMessage({patch: diff, checksum: checksum}));
|
||||
var msg = this.objectToString(this.createMessage({m: this.lastModified.getTime()}));
|
||||
var secret = this.file.getDescriptorSecret(this.file.getDescriptor());
|
||||
|
||||
this.file.stats.bytesSent += data.length;
|
||||
this.file.stats.msgSent++;
|
||||
|
||||
mxUtils.post(EditorUi.cacheUrl, this.getIdParameters() +
|
||||
'&from=' + encodeURIComponent(etag) + '&to=' + encodeURIComponent(current) +
|
||||
'&msg=' + encodeURIComponent(msg) + ((secret != null) ? '&secret=' + encodeURIComponent(secret) : '') +
|
||||
((data.length < this.maxCacheEntrySize) ? '&data=' + encodeURIComponent(data) : ''),
|
||||
mxUtils.bind(this, function(req)
|
||||
if (secret == null)
|
||||
{
|
||||
// Ignores response
|
||||
}));
|
||||
|
||||
if (urlParams['test'] == '1')
|
||||
this.file.stats.msgSent++;
|
||||
|
||||
// Notify only
|
||||
mxUtils.post(EditorUi.cacheUrl, this.getIdParameters() +
|
||||
'&msg=' + encodeURIComponent(msg), function()
|
||||
{
|
||||
// Ignore response
|
||||
});
|
||||
|
||||
if (success != null)
|
||||
{
|
||||
success();
|
||||
}
|
||||
|
||||
if (urlParams['test'] == '1')
|
||||
{
|
||||
EditorUi.debug('Sync.fileSaved', [this], 'from', etag, 'to', current,
|
||||
'etag', this.file.getCurrentEtag(), 'notify');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorUi.debug('Sync.fileSaved', [this],
|
||||
'from', etag, 'to', current, 'etag', this.file.getCurrentEtag(),
|
||||
data.length, 'bytes', 'diff', diff, 'checksum', checksum);
|
||||
var shadow = (this.file.shadowPages != null) ?
|
||||
this.file.shadowPages : this.ui.getPagesForNode(
|
||||
mxUtils.parseXml(this.file.shadowData).documentElement)
|
||||
var checksum = this.ui.getHashValueForPages(pages);
|
||||
var diff = this.ui.diffPages(shadow, pages);
|
||||
|
||||
// Data is stored in cache and message is sent to all listeners
|
||||
var data = this.objectToString(this.createMessage({patch: diff, checksum: checksum}));
|
||||
this.file.stats.bytesSent += data.length;
|
||||
this.file.stats.msgSent++;
|
||||
|
||||
var acceptResponse = true;
|
||||
|
||||
var timeoutThread = window.setTimeout(mxUtils.bind(this, function()
|
||||
{
|
||||
acceptResponse = false;
|
||||
error({code: App.ERROR_TIMEOUT, message: mxResources.get('timeout')});
|
||||
}), this.ui.timeout);
|
||||
|
||||
mxUtils.post(EditorUi.cacheUrl, this.getIdParameters() +
|
||||
'&from=' + encodeURIComponent(etag) + '&to=' + encodeURIComponent(current) +
|
||||
'&msg=' + encodeURIComponent(msg) + ((secret != null) ? '&secret=' + encodeURIComponent(secret) : '') +
|
||||
((data.length < this.maxCacheEntrySize) ? '&data=' + encodeURIComponent(data) : '') +
|
||||
((token != null) ? '&token=' + encodeURIComponent(token) : ''),
|
||||
mxUtils.bind(this, function(req)
|
||||
{
|
||||
window.clearTimeout(timeoutThread);
|
||||
|
||||
if (acceptResponse)
|
||||
{
|
||||
if (req.getStatus() >= 200 && req.getStatus() <= 299)
|
||||
{
|
||||
if (success != null)
|
||||
{
|
||||
success();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error({code: req.getStatus(), message: req.getStatus()});
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
if (urlParams['test'] == '1')
|
||||
{
|
||||
EditorUi.debug('Sync.fileSaved', [this],
|
||||
'from', etag, 'to', current, 'etag', this.file.getCurrentEtag(),
|
||||
data.length, 'bytes', 'diff', diff, 'checksum', checksum);
|
||||
}
|
||||
}
|
||||
|
||||
// Logs successull diff
|
||||
|
@ -1155,12 +1239,9 @@ DrawioFileSync.prototype.fileSaved = function(pages, lastDesc, success, error)
|
|||
}
|
||||
}
|
||||
|
||||
// Ignores cache response as clients
|
||||
// load file if cache entry failed
|
||||
this.file.shadowPages = pages;
|
||||
|
||||
if (success != null)
|
||||
{
|
||||
success();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1214,7 +1295,7 @@ DrawioFileSync.prototype.fileConflict = function(desc, success, error)
|
|||
|
||||
if (error != null)
|
||||
{
|
||||
error({message: mxResources.get('timeout')});
|
||||
error({code: App.ERROR_TIMEOUT, message: mxResources.get('timeout')});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1180,7 +1180,7 @@ DriveClient.prototype.getXmlFile = function(resp, success, error, ignoreMime, re
|
|||
* @param {number} dx X-coordinate of the translation.
|
||||
* @param {number} dy Y-coordinate of the translation.
|
||||
*/
|
||||
DriveClient.prototype.saveFile = function(file, revision, success, errFn, noCheck, unloading, overwrite, properties)
|
||||
DriveClient.prototype.saveFile = function(file, revision, success, errFn, noCheck, unloading, overwrite, properties, secret)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -1330,7 +1330,7 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
|
|||
}
|
||||
|
||||
// Pass to access cache for each etag
|
||||
properties.push({'key': 'secret', 'value': Editor.guid(32)});
|
||||
properties.push({'key': 'secret', 'value': (secret != null) ? secret : Editor.guid(32)});
|
||||
}
|
||||
|
||||
// Specifies that no thumbnail should be uploaded in which case the existing thumbnail is used
|
||||
|
|
|
@ -178,169 +178,187 @@ DriveFile.prototype.saveFile = function(title, revision, success, error, unloadi
|
|||
}
|
||||
else if (!this.savingFile)
|
||||
{
|
||||
var doSave = mxUtils.bind(this, function(realOverwrite, realRevision)
|
||||
this.savingFile = true;
|
||||
|
||||
this.createSecret(mxUtils.bind(this, function(secret, token)
|
||||
{
|
||||
var prevModified = null;
|
||||
var modified = null;
|
||||
|
||||
try
|
||||
var doSave = mxUtils.bind(this, function(realOverwrite, realRevision)
|
||||
{
|
||||
// Makes sure no changes get lost while the file is saved
|
||||
prevModified = this.isModified;
|
||||
modified = this.isModified();
|
||||
this.setModified(false);
|
||||
this.savingFileTime = new Date();
|
||||
this.savingFile = true;
|
||||
var prevModified = null;
|
||||
var modified = null;
|
||||
|
||||
// Waits for success for modified state to be visible
|
||||
this.isModified = function()
|
||||
try
|
||||
{
|
||||
return true;
|
||||
};
|
||||
|
||||
var lastDesc = this.desc;
|
||||
|
||||
this.ui.drive.saveFile(this, realRevision, mxUtils.bind(this, function(resp, savedData)
|
||||
{
|
||||
try
|
||||
// Makes sure no changes get lost while the file is saved
|
||||
prevModified = this.isModified;
|
||||
modified = this.isModified();
|
||||
this.setModified(false);
|
||||
this.savingFileTime = new Date();
|
||||
|
||||
// Waits for success for modified state to be visible
|
||||
this.isModified = function()
|
||||
{
|
||||
this.savingFile = false;
|
||||
this.isModified = prevModified;
|
||||
|
||||
// Handles special case where resp is false eg
|
||||
// if the old file was converted to realtime
|
||||
if (resp != false)
|
||||
return true;
|
||||
};
|
||||
|
||||
var lastDesc = this.desc;
|
||||
|
||||
this.ui.drive.saveFile(this, realRevision, mxUtils.bind(this, function(resp, savedData)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (revision)
|
||||
{
|
||||
this.lastAutosaveRevision = new Date().getTime();
|
||||
}
|
||||
|
||||
// Adaptive autosave delay
|
||||
this.autosaveDelay = Math.min(8000,
|
||||
Math.max(this.saveDelay + 500,
|
||||
DriveFile.prototype.autosaveDelay));
|
||||
this.desc = resp;
|
||||
this.savingFile = false;
|
||||
this.isModified = prevModified;
|
||||
|
||||
this.fileSaved(savedData, lastDesc, mxUtils.bind(this, function()
|
||||
// Handles special case where resp is false eg
|
||||
// if the old file was converted to realtime
|
||||
if (resp != false)
|
||||
{
|
||||
this.contentChanged();
|
||||
|
||||
if (success != null)
|
||||
if (revision)
|
||||
{
|
||||
success(resp);
|
||||
this.lastAutosaveRevision = new Date().getTime();
|
||||
}
|
||||
}), error);
|
||||
|
||||
// Adaptive autosave delay
|
||||
this.autosaveDelay = Math.min(8000,
|
||||
Math.max(this.saveDelay + 500,
|
||||
DriveFile.prototype.autosaveDelay));
|
||||
this.desc = resp;
|
||||
|
||||
// Shows possible errors but keeps the modified flag as the
|
||||
// file was saved but the cache entry could not be written
|
||||
this.fileSaved(savedData, lastDesc, mxUtils.bind(this, function()
|
||||
{
|
||||
this.contentChanged();
|
||||
|
||||
if (success != null)
|
||||
{
|
||||
success(resp);
|
||||
}
|
||||
}), error, token);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.setModified(modified || this.isModified());
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
error(resp);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (e)
|
||||
{
|
||||
this.setModified(modified || this.isModified());
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
error(resp);
|
||||
error(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
}), mxUtils.bind(this, function(err, desc)
|
||||
{
|
||||
this.setModified(modified || this.isModified());
|
||||
try
|
||||
{
|
||||
this.savingFile = false;
|
||||
this.isModified = prevModified;
|
||||
this.setModified(modified || this.isModified());
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}), mxUtils.bind(this, function(err, desc)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.savingFile = false;
|
||||
this.isModified = prevModified;
|
||||
this.setModified(modified || this.isModified());
|
||||
|
||||
if (this.isConflict(err))
|
||||
{
|
||||
this.inConflictState = true;
|
||||
|
||||
if (this.sync != null)
|
||||
if (this.isConflict(err))
|
||||
{
|
||||
this.savingFile = true;
|
||||
this.savingFileTime = new Date();
|
||||
this.inConflictState = true;
|
||||
|
||||
this.sync.fileConflict(desc, mxUtils.bind(this, function()
|
||||
if (this.sync != null)
|
||||
{
|
||||
// Adds random cool-off
|
||||
window.setTimeout(mxUtils.bind(this, function()
|
||||
{
|
||||
this.updateFileData();
|
||||
doSave(realOverwrite, true);
|
||||
}), 100 + Math.random() * 500);
|
||||
}), mxUtils.bind(this, function()
|
||||
{
|
||||
this.savingFile = false;
|
||||
this.savingFile = true;
|
||||
this.savingFileTime = new Date();
|
||||
|
||||
if (error != null)
|
||||
this.sync.fileConflict(desc, mxUtils.bind(this, function()
|
||||
{
|
||||
error();
|
||||
}
|
||||
}));
|
||||
// Adds random cool-off
|
||||
window.setTimeout(mxUtils.bind(this, function()
|
||||
{
|
||||
this.updateFileData();
|
||||
doSave(realOverwrite, true);
|
||||
}), 100 + Math.random() * 500);
|
||||
}), mxUtils.bind(this, function()
|
||||
{
|
||||
this.savingFile = false;
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}));
|
||||
}
|
||||
else if (error != null)
|
||||
{
|
||||
error();
|
||||
}
|
||||
}
|
||||
else if (error != null)
|
||||
{
|
||||
error();
|
||||
error(err);
|
||||
}
|
||||
}
|
||||
else if (error != null)
|
||||
catch (e)
|
||||
{
|
||||
error(err);
|
||||
this.setModified(modified || this.isModified());
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}), unloading, unloading, realOverwrite, null, secret);
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
this.savingFile = false;
|
||||
|
||||
if (prevModified != null)
|
||||
{
|
||||
this.isModified = prevModified;
|
||||
}
|
||||
catch (e)
|
||||
|
||||
if (modified != null)
|
||||
{
|
||||
this.setModified(modified || this.isModified());
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}), unloading, unloading, realOverwrite);
|
||||
}
|
||||
catch (e)
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
doSave(overwrite, revision);
|
||||
}), mxUtils.bind(this, function(e)
|
||||
{
|
||||
this.savingFile = false;
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
this.savingFile = false;
|
||||
|
||||
if (prevModified != null)
|
||||
{
|
||||
this.isModified = prevModified;
|
||||
}
|
||||
|
||||
if (modified != null)
|
||||
{
|
||||
this.setModified(modified || this.isModified());
|
||||
}
|
||||
|
||||
if (error != null)
|
||||
{
|
||||
error(e);
|
||||
}
|
||||
else
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
error(e);
|
||||
}
|
||||
});
|
||||
|
||||
doSave(overwrite, revision);
|
||||
else
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
|
|
|
@ -1065,17 +1065,17 @@
|
|||
Editor.GOOGLE_FONTS = 'https://fonts.googleapis.com/css?family=';
|
||||
|
||||
/**
|
||||
* Generates a unique ID of the given length
|
||||
* Alphabet for global unique IDs.
|
||||
*/
|
||||
Editor.GUID_ALPHABET = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_';
|
||||
|
||||
/**
|
||||
* Generates a unique ID of the given length
|
||||
* Default length for global unique IDs.
|
||||
*/
|
||||
Editor.GUID_LENGTH = 20;
|
||||
|
||||
/**
|
||||
* Generates a unique ID of the given length
|
||||
* Default length for global unique IDs.
|
||||
*/
|
||||
Editor.guid = function(length)
|
||||
{
|
||||
|
|
|
@ -181,20 +181,6 @@ OneDriveFile.prototype.setDescriptor = function(desc)
|
|||
this.meta = desc;
|
||||
};
|
||||
|
||||
/**
|
||||
* Using the quickXorHash of the content as the access password.
|
||||
*/
|
||||
OneDriveFile.prototype.getDescriptorSecret = function(desc)
|
||||
{
|
||||
if (desc.file != null && desc.file.hashes != null &&
|
||||
desc.file.hashes.quickXorHash != null)
|
||||
{
|
||||
return desc.file.hashes.quickXorHash;
|
||||
}
|
||||
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Adds all listeners.
|
||||
*/
|
||||
|
|
|
@ -151,6 +151,13 @@ var com;
|
|||
}
|
||||
};
|
||||
|
||||
mxVsdxCodec.incorrectXMLReqExp = [
|
||||
{
|
||||
regExp: /(\>[^&<]*)\&([^&<;]*\<)/g,
|
||||
repl: '$1&$2'
|
||||
}
|
||||
];
|
||||
|
||||
/**
|
||||
* Parses the input VSDX format and uses the information to populate
|
||||
* the specified graph.
|
||||
|
@ -319,6 +326,18 @@ var com;
|
|||
{
|
||||
doc = mxVsdxCodec.parseXml(mxVsdxCodec.decodeUTF16LE(str));
|
||||
}
|
||||
else
|
||||
{
|
||||
for (var r = 0; r < mxVsdxCodec.incorrectXMLReqExp.length; r++)
|
||||
{
|
||||
if (mxVsdxCodec.incorrectXMLReqExp[r].regExp.test(str))
|
||||
{
|
||||
str = str.replace(mxVsdxCodec.incorrectXMLReqExp[r].regExp, mxVsdxCodec.incorrectXMLReqExp[r].repl);
|
||||
}
|
||||
}
|
||||
|
||||
doc = mxVsdxCodec.parseXml(str);
|
||||
}
|
||||
//TODO add any other non-standard encoding that may be needed
|
||||
}
|
||||
|
||||
|
@ -11696,7 +11715,12 @@ var com;
|
|||
else {
|
||||
return o1 === o2;
|
||||
} })(lbkgnd, "")) {
|
||||
/* put */ (this.styleMap[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR] = lbkgnd);
|
||||
var isFullyTransparent = this.getValue(this.getCellElement$java_lang_String('TextBkgndTrans'), '0') == '1';
|
||||
|
||||
if (!isFullyTransparent)
|
||||
{
|
||||
/* put */ (this.styleMap[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR] = lbkgnd);
|
||||
}
|
||||
}
|
||||
/* put */ (this.styleMap[mxConstants.STYLE_ROUNDED] = this.getRounding() > 0 ? com.mxgraph.io.vsdx.mxVsdxConstants.TRUE : com.mxgraph.io.vsdx.mxVsdxConstants.FALSE);
|
||||
return this.styleMap;
|
||||
|
|
104
src/main/webapp/js/extensions.min.js
vendored
104
src/main/webapp/js/extensions.min.js
vendored
|
@ -974,46 +974,46 @@ BmpDecoder.prototype.bit24=function(){var f=3*this.width%4;0!=f&&(f=4-f);for(var
|
|||
BmpDecoder.prototype.bit32=function(){for(var f=this.height-1;0<=f;f--)for(var g=0;g<this.width;g++){var q=this.buffer[this.pos++],e=this.buffer[this.pos++],l=this.buffer[this.pos++],c=this.buffer[this.pos++],b=f*this.width*4+4*g;this.data[b]=l;this.data[b+1]=e;this.data[b+2]=q;this.data[b+3]=c}};BmpDecoder.prototype.getData=function(){return this.data};var __extends=this&&this.__extends||function(f,g){function q(){this.constructor=f}for(var e in g)g.hasOwnProperty(e)&&(f[e]=g[e]);f.prototype=null===g?Object.create(g):(q.prototype=g.prototype,new q)},com;
|
||||
(function(f){(function(g){(function(g){var e=function(){function l(c){this.RESPONSE_END="</mxfile>";this.RESPONSE_DIAGRAM_START="";this.RESPONSE_DIAGRAM_END="</diagram>";this.RESPONSE_HEADER='<?xml version="1.0" encoding="UTF-8"?><mxfile>';this.vertexMap={};this.edgeShapeMap={};this.vertexShapeMap={};this.parentsMap={};this.layersMap={};this.debugPaths=!1;this.vsdxModel=null;this.editorUi=c}l.vsdxPlaceholder_$LI$=function(){null==l.vsdxPlaceholder&&(l.vsdxPlaceholder=window.atob?atob("dmlzaW8="):
|
||||
Base64.decode("dmlzaW8=",!0));return l.vsdxPlaceholder};l.parsererrorNS_$LI$=function(){if(null==l.parsererrorNS&&(l.parsererrorNS="",window.DOMParser)){var c=new DOMParser;try{l.parsererrorNS=c.parseFromString("<","text/xml").getElementsByTagName("parsererror")[0].namespaceURI}catch(b){}}return l.parsererrorNS};l.parseXml=function(c){try{var b=mxUtils.parseXml(c);return 0<b.getElementsByTagNameNS(l.parsererrorNS,"parsererror").length?null:b}catch(a){return null}};l.decodeUTF16LE=function(c){for(var b=
|
||||
"",a=0;a<c.length;a+=2)b+=String.fromCharCode(c.charCodeAt(a)|c.charCodeAt(a+1)<<8);return b};l.prototype.scaleGraph=function(c,b){if(1!==b){var a=c.getModel(),d;for(d in a.cells){var k=a.cells[d],n=a.getGeometry(k);if(null!=n&&(this.scaleRect(n,b),this.scaleRect(n.alternateBounds,b),a.isEdge(k)&&(this.scalePoint(n.sourcePoint,b),this.scalePoint(n.targetPoint,b),this.scalePoint(n.offset,b),k=n.points,null!=k)))for(n=0;n<k.length;n++)this.scalePoint(k[n],b)}}};l.prototype.decodeVsdx=function(c,b,a,
|
||||
d){var k=this,n={},w={},e=function(){var a;function d(){a=a.concat(k.RESPONSE_END);b&&b(a)}for(var c=l.vsdxPlaceholder+"/document.xml",e=n[c]?n[c]:null,y=e.firstChild;null!=y&&1!=y.nodeType;)y=y.nextSibling;if(null!=y&&1==y.nodeType)k.importNodes(e,y,c,n);else return null;k.vsdxModel=new f.mxgraph.io.vsdx.mxVsdxModel(e,n,w);c=k.vsdxModel.getPages();a=k.RESPONSE_HEADER;var A=function(a){null==a.entries&&(a.entries=[]);return a.entries}(c),g=function(b,d){var n=A[b].getValue(),c=z.createMxGraph();c.getModel().beginUpdate();
|
||||
z.importPage(n,c,c.getDefaultParent(),!0);z.scaleGraph(c,n.getPageScale()/n.getDrawingScale());c.getModel().endUpdate();z.postImportPage(n,c,function(){z.sanitiseGraph(c);a=a.concat(k.RESPONSE_DIAGRAM_START);a=a.concat(k.processPage(c,n));a=a.concat(k.RESPONSE_DIAGRAM_END);b<A.length-1?g(b+1,d):d()})},z=k;0<A.length?g(0,d):d()},A=0,g=0,q=function(){if(g==A)try{e()}catch(C){console.log(C),null!=d?d():b("")}};JSZip.loadAsync(c).then(function(a){0==Object.keys(a.files).length?null!=d&&d():a.forEach(function(a,
|
||||
b){var d=b.name,c=d.toLowerCase(),f=c.length;c.indexOf(".xml")==f-4||c.indexOf(".xml.rels")==f-9?(A++,b.async("string").then(function(a){if(0!==a.length){65279==a.charCodeAt(0)&&(a=a.substring(1));var b=l.parseXml(a);null==b&&0===a.charCodeAt(1)&&0===a.charCodeAt(3)&&0===a.charCodeAt(5)&&(b=l.parseXml(l.decodeUTF16LE(a)));null!=b&&(b.vsdxFileName=d,n[d]=b)}g++;q()})):0===c.indexOf(l.vsdxPlaceholder+"/media")&&(A++,function(a,b){var d=a.length-b.length,k=a.indexOf(b,d);return-1!==k&&k===d}(c,".emf")?
|
||||
JSZip.support.blob&&window.EMF_CONVERT_URL?b.async("blob").then(function(a){var b=new FormData;b.append("img",a,c);b.append("inputformat","emf");b.append("outputformat","png");var n=new XMLHttpRequest;n.open("POST",EMF_CONVERT_URL);n.responseType="blob";k.editorUi.addRemoteServiceSecurityCheck(n);n.onreadystatechange=mxUtils.bind(this,function(){if(4==n.readyState)if(200<=n.status&&299>=n.status)try{var a=new FileReader;a.readAsDataURL(n.response);a.onloadend=function(){var b=a.result.indexOf(",")+
|
||||
1;w[d]=a.result.substr(b);g++;q()}}catch(ma){console.log(ma),g++,q()}else g++,q()});n.send(b)}):(g++,q()):function(a,b){var d=a.length-b.length,k=a.indexOf(b,d);return-1!==k&&k===d}(c,".bmp")?JSZip.support.uint8array&&b.async("uint8array").then(function(a){a=new BmpDecoder(a);var b=document.createElement("canvas");b.width=a.width;b.height=a.height;b.getContext("2d").putImageData(a.imageData,0,0);a=b.toDataURL("image/jpeg");w[d]=a.substr(23);g++;q()}):b.async("base64").then(function(a){w[d]=a;g++;
|
||||
q()}))})},function(a){null!=d&&d(a)})};l.prototype.createMxGraph=function(){var c=new Graph;c.setExtendParents(!1);c.setExtendParentsOnAdd(!1);c.setConstrainChildren(!1);c.setHtmlLabels(!0);c.getModel().maintainEdgeParent=!1;return c};l.prototype.processPage=function(c,b){var a=(new mxCodec).encode(c.getModel());a.setAttribute("style","default-style2");var a=mxUtils.getXml(a),d="";if(null!=b)var k=mxUtils.htmlEntities(b.getPageName())+(b.isBackground()?" (Background)":""),d=d+('<diagram name="'+k+
|
||||
'" id="'+k.replace(/\s/g,"_")+'">');return d+=Graph.compress(a)};l.prototype.scalePoint=function(c,b){null!=c&&(c.x*=b,c.y*=b);return c};l.prototype.scaleRect=function(c,b){null!=c&&(c.x*=b,c.y*=b,c.height*=b,c.width*=b);return c};l.prototype.importNodes=function(c,b,a,d){var k=a.lastIndexOf("/"),n=a,f=a;if(-1!==k&&(n=a.substring(0,k),f=a.substring(k+1,a.length),a=function(a,b){return a[b]?a[b]:null}(d,n+"/_rels/"+f+".rels"),null!=a)){var l=a.getElementsByTagName("Relationship");a={};for(k=0;k<l.length;k++){var f=
|
||||
l.item(k),e=f.getAttribute("Id"),f=f.getAttribute("Target");a[e]=f}b=b.getElementsByTagName("Rel");for(k=0;k<b.length;k++)if(l=b.item(k),f=function(a,b){return a[b]?a[b]:null}(a,l.getAttribute("r:id")),f=n+"/"+f,null!=f&&(e=d[f]?d[f]:null,null!=e)){l=l.parentNode;for(e=e.firstChild;null!=e&&1!=e.nodeType;)e=e.nextSibling;if(null!=e&&1==e.nodeType)for(e=e.firstChild;null!=e;){if(null!=e&&1==e.nodeType){var g=l.appendChild(c.importNode(e,!0));this.importNodes(c,g,f,d)}e=e.nextSibling}}}};l.prototype.importPage=
|
||||
function(c,b,a,d){var k=c.getBackPage();if(null!=k){b.getModel().setValue(b.getDefaultParent(),c.getPageName());var n=new mxCell(k.getPageName());b.addCell(n,b.getModel().getRoot(),0,null,null);this.importPage(k,b,b.getDefaultParent())}k=c.getLayers();this.layersMap[0]=b.getDefaultParent();for(n=0;n<k.length;n++){var f=k[n];if(0==n)var l=b.getDefaultParent();else l=new mxCell,b.addCell(l,b.model.root,n);l.setVisible(1==f.Visible);1==f.Lock&&l.setStyle("locked=1;");l.setValue(f.Name);this.layersMap[n]=
|
||||
l}f=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){null==a.entries&&(a.entries=[]);return a.entries}(c.getShapes()));k=c.getPageDimensions().y;for(n=c.getId();f.hasNext();){var l=f.next(),l=l.getValue(),e=this.layersMap[l.layerMember];this.addShape(b,l,e?e:a,n,k)}for(c=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){null==a.entries&&(a.entries=
|
||||
[]);return a.entries}(c.getConnects()));c.hasNext();)l=c.next(),a=this.addConnectedEdge(b,l.getValue(),n,k),null!=a&&function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries.splice(d,1)[0]}(this.edgeShapeMap,a);for(c=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){null==a.entries&&(a.entries=[]);return a.entries}(this.edgeShapeMap));c.hasNext();)a=
|
||||
c.next(),a.getKey().getPageNumber()===n&&this.addUnconnectedEdge(b,function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.parentsMap,a.getKey()),a.getValue(),k);d||this.sanitiseGraph(b);return k};l.prototype.postImportPage=function(c,b,a){try{var d=this,k=[],n=c.getShapes().entries||[];for(b=0;b<n.length;b++){var w=n[b].value||{};w.toBeCroppedImg&&
|
||||
k.push(w)}if(0<k.length){var l=function(a,b){function n(){a<k.length-1?l(a+1,b):b()}var w=k[a],e=w.toBeCroppedImg,y=function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(d.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(c.Id,w.Id)),A=new Image;A.onload=function(){var a=e.iData,b=e.iType;try{var d=A.width/e.imgWidth,k=A.height/e.imgHeight,c=-e.imgOffsetX*
|
||||
d,f=(e.imgHeight-e.height+e.imgOffsetY)*k,w=document.createElement("canvas");w.width=e.width*d;w.height=e.height*k;var l=w.getContext("2d");l.fillStyle="#FFFFFF";l.fillRect(0,0,w.width,w.height);l.drawImage(A,c,f,w.width,w.height,0,0,w.width,w.height);a=w.toDataURL("image/jpeg").substr(23);b="jpg"}catch(Z){console.log(Z)}y.style+=";image=data:image/"+b+","+a;n()};A.src="data:image/"+e.iType+";base64,"+e.iData;A.onerror=function(){y.style+=";image=data:image/"+e.iType+","+e.iData;n()}};l(0,a)}else a()}catch(A){console.log(A),
|
||||
a()}};l.prototype.addShape=function(c,b,a,d,k){b.parentHeight=k;var n=f.mxgraph.io.vsdx.VsdxShape.getType(b.getShape());if(null!=n&&(function(a,b){return a&&a.equals?a.equals(b):a===b}(n,f.mxgraph.io.vsdx.mxVsdxConstants.TYPE_SHAPE)||function(a,b){return a&&a.equals?a.equals(b):a===b}(n,f.mxgraph.io.vsdx.mxVsdxConstants.TYPE_GROUP)||function(a,b){return a&&a.equals?a.equals(b):a===b}(n,f.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN))){var w=b.getId();if(b.isVertex())return n=null,n=b.isGroup()?this.addGroup(c,
|
||||
b,a,d,k):this.addVertex(c,b,a,d,k),function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})}(this.vertexShapeMap,new f.mxgraph.io.vsdx.ShapePageId(d,w),b),b=b.getHyperlink(),b.extLink?c.setLinkForCell(n,b.extLink):b.pageLink&&c.setLinkForCell(n,"data:page/id,"+
|
||||
b.pageLink),n;b.setShapeIndex(c.getModel().getChildCount(a));(function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})})(this.edgeShapeMap,new f.mxgraph.io.vsdx.ShapePageId(d,w),b);(function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=
|
||||
a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})})(this.parentsMap,new f.mxgraph.io.vsdx.ShapePageId(d,w),a)}return null};l.prototype.addGroup=function(c,b,a,d,k){var n=b.getDimensions(),w=b.getMaster(),l=b.getStyleFromShape(),e=b.getGeomList();e.isNoFill()&&(l[mxConstants.STYLE_FILLCOLOR]="none",l[mxConstants.STYLE_GRADIENTCOLOR]="none");
|
||||
e.isNoLine()&&(l[mxConstants.STYLE_STROKECOLOR]="none");l.html="1";l[mxConstants.STYLE_WHITE_SPACE]="wrap";var g=f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"="),l=null,q=b.getChildShapes(),l=null!=q&&0<function(a){null==a.entries&&(a.entries=[]);return a.entries.length}(q),e=b.isDisplacedLabel()||b.isRotatedLabel()||l,l=b.getOriginPoint(k,!0);if(e)l=c.insertVertex(a,null,null,Math.floor(Math.round(100*l.x)/100),Math.floor(Math.round(100*l.y)/100),Math.floor(Math.round(100*n.x)/100),Math.floor(Math.round(100*
|
||||
n.y)/100),g);else var C=b.getTextLabel(),l=c.insertVertex(a,null,C,Math.floor(Math.round(100*l.x)/100),Math.floor(Math.round(100*l.y)/100),Math.floor(Math.round(100*n.x)/100),Math.floor(Math.round(100*n.y)/100),g);for(a=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){null==a.entries&&(a.entries=[]);return a.entries}(q));a.hasNext();)g=a.next().getValue(),q=g.getId(),g.isVertex()?(C=f.mxgraph.io.vsdx.VsdxShape.getType(g.getShape()),
|
||||
null!=C&&(function(a,b){return a&&a.equals?a.equals(b):a===b}(C,f.mxgraph.io.vsdx.mxVsdxConstants.TYPE_SHAPE)||function(a,b){return a&&a.equals?a.equals(b):a===b}(C,f.mxgraph.io.vsdx.mxVsdxConstants.TYPE_GROUP)||function(a,b){return a&&a.equals?a.equals(b):a===b}(C,f.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN))&&g.isVertex()&&(g.propagateRotation(b.getRotation()),g.isGroup()?this.addGroup(c,g,l,d,n.y):this.addVertex(c,g,l,d,n.y)),null==w&&function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<
|
||||
a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})}(this.vertexShapeMap,new f.mxgraph.io.vsdx.ShapePageId(d,q),g)):null==w?(function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,
|
||||
value:d,getKey:function(){return this.key},getValue:function(){return this.value}})}(this.edgeShapeMap,new f.mxgraph.io.vsdx.ShapePageId(d,q),g),function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})}(this.parentsMap,new f.mxgraph.io.vsdx.ShapePageId(d,q),
|
||||
l)):this.addUnconnectedEdge(c,l,g,k);e&&b.createLabelSubShape(c,l);c=b.getRotation();if(0!==c)for(n=l.getGeometry(),k=n.width/2,n=n.height/2,w=0;w<l.getChildCount();w++)e=l.getChildAt(w),f.mxgraph.online.Utils.rotatedGeometry(e.getGeometry(),c,k,n);(function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},
|
||||
getValue:function(){return this.value}})})(this.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(d,b.getId()),l);return l};l.rotatedEdgePoint=function(c,b,a,d){b=b*Math.PI/180;var k=Math.cos(b);b=Math.sin(b);var n=c.x-a,f=c.y-d;c.x=Math.round(n*k-f*b+a);c.y=Math.round(f*k+n*b+d)};l.prototype.addVertex=function(c,b,a,d,k){var n="",w=b.isDisplacedLabel()||b.isRotatedLabel();w||(n=b.getTextLabel());var l=b.getDimensions(),e=b.getStyleFromShape();e.html="1";var g=e.hasOwnProperty(mxConstants.STYLE_SHAPE)||
|
||||
e.hasOwnProperty("stencil");e.hasOwnProperty(mxConstants.STYLE_FILLCOLOR)&&g||(e[mxConstants.STYLE_FILLCOLOR]="none");g||(e[mxConstants.STYLE_STROKECOLOR]="none");e.hasOwnProperty(mxConstants.STYLE_GRADIENTCOLOR)&&g||(e[mxConstants.STYLE_GRADIENTCOLOR]="none");e[mxConstants.STYLE_WHITE_SPACE]="wrap";k=b.getOriginPoint(k,!0);return g||null!=n?(e=f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(e,"="),g=null,g=w?c.insertVertex(a,null,null,Math.floor(Math.round(100*k.x)/100),Math.floor(Math.round(100*k.y)/
|
||||
100),Math.floor(Math.round(100*l.x)/100),Math.floor(Math.round(100*l.y)/100),e):c.insertVertex(a,null,n,Math.floor(Math.round(100*k.x)/100),Math.floor(Math.round(100*k.y)/100),Math.floor(Math.round(100*l.x)/100),Math.floor(Math.round(100*l.y)/100),e),function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},
|
||||
getValue:function(){return this.value}})}(this.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(d,b.getId()),g),b.setLabelOffset(g,e),w&&b.createLabelSubShape(c,g),g):null};l.calculateAbsolutePoint=function(c){for(var b=0,a=0;null!=c;){var d=c.geometry;null!=d&&(b+=d.x,a+=d.y);c=c.parent}return new mxPoint(b,a)};l.prototype.addConnectedEdge=function(c,b,a,d){var k=b.getFromSheet(),k=new f.mxgraph.io.vsdx.ShapePageId(a,k),n=function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=
|
||||
a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.edgeShapeMap,k);if(null==n)return null;var w=function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.parentsMap,new f.mxgraph.io.vsdx.ShapePageId(a,n.getId()));if(null!=w){var e=c.getModel().getGeometry(w);null!=e&&(d=e.height)}var g=
|
||||
n.getStartXY(d),z=n.getEndXY(d),e=n.getRoutingPoints(d,g,n.getRotation());this.rotateChildEdge(c.getModel(),w,g,z,e);var q=null,C=b.getSourceToSheet(),C=null!=C?function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(a,C)):null,E=!0;if(null==C)C=c.insertVertex(w,null,null,Math.floor(Math.round(100*g.x)/100),
|
||||
Math.floor(Math.round(100*g.y)/100),0,0);else if(C.style&&-1==C.style.indexOf(";rotation="))var q=l.calculateAbsolutePoint(C),D=l.calculateAbsolutePoint(w),G=C.geometry,q=new mxPoint((D.x+g.x-q.x)/G.width,(D.y+g.y-q.y)/G.height);else E=!1;g=null;b=b.getTargetToSheet();b=null!=b?function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(a,
|
||||
b)):null;D=!0;null==b?b=c.insertVertex(w,null,null,Math.floor(Math.round(100*z.x)/100),Math.floor(Math.round(100*z.y)/100),0,0):b.style&&-1==b.style.indexOf(";rotation=")?(a=l.calculateAbsolutePoint(b),g=l.calculateAbsolutePoint(w),G=b.geometry,g=new mxPoint((g.x+z.x-a.x)/G.width,(g.y+z.y-a.y)/G.height)):D=!1;z=n.getStyleFromEdgeShape(d);G=n.getRotation();0!==G?(a=c.insertEdge(w,null,null,C,b,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(z,"=")),E=n.createLabelSubShape(c,a),null!=E&&(E.setStyle(E.getStyle()+
|
||||
";rotation="+(60<G&&240>G?(G+180)%360:G)),E=E.getGeometry(),E.x=0,E.y=0,E.relative=!0,E.offset=new mxPoint(-E.width/2,-E.height/2))):(a=c.insertEdge(w,null,n.getTextLabel(),C,b,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(z,"=")),G=n.getLblEdgeOffset(c.getView(),e),a.getGeometry().offset=G,null!=q&&c.setConnectionConstraint(a,C,!0,new mxConnectionConstraint(q,!1)),E&&e.shift(),null!=g&&c.setConnectionConstraint(a,b,!1,new mxConnectionConstraint(g,!1)),D&&e.pop());E=c.getModel().getGeometry(a);if(C.parent!=
|
||||
b.parent&&null!=w&&1!=w.id&&1==C.parent.id){b=q=0;do g=w.geometry,null!=g&&(q+=g.x,b+=g.y),w=w.parent;while(null!=w);a.parent=C.parent;for(w=0;w<e.length;w++)e[w].x+=q,e[w].y+=b}E.points=e;z.hasOwnProperty("curved")&&function(a,b){return a&&a.equals?a.equals(b):a===b}(function(a,b){return a[b]?a[b]:null}(z,"curved"),"1")&&(E=c.getModel().getGeometry(a),c=n.getControlPoints(d),E.points=c);return k};l.prototype.addUnconnectedEdge=function(c,b,a,d){if(null!=b){var k=c.getModel().getGeometry(b);null!=
|
||||
k&&(d=k.height)}var n=a.getStartXY(d),w=a.getEndXY(d),l=a.getStyleFromEdgeShape(d),e=a.getRoutingPoints(d,n,a.getRotation()),g=a.getRotation();if(0!==g){0===a.getShapeIndex()?k=c.insertEdge(b,null,null,null,null,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"=")):(k=c.createEdge(b,null,null,null,null,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"=")),k=c.addEdge(k,b,null,null,a.getShapeIndex()));var q=a.createLabelSubShape(c,k);null!=q&&(q.setStyle(q.getStyle()+";rotation="+(60<g&&240>g?(g+180)%
|
||||
360:g)),g=q.getGeometry(),g.x=0,g.y=0,g.relative=!0,g.offset=new mxPoint(-g.width/2,-g.height/2))}else 0===a.getShapeIndex()?k=c.insertEdge(b,null,a.getTextLabel(),null,null,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"=")):(k=c.createEdge(b,null,a.getTextLabel(),null,null,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"=")),k=c.addEdge(k,b,null,null,a.getShapeIndex())),g=a.getLblEdgeOffset(c.getView(),e),k.getGeometry().offset=g;this.rotateChildEdge(c.getModel(),b,n,w,e);b=c.getModel().getGeometry(k);
|
||||
e.pop();e.shift();b.points=e;b.setTerminalPoint(n,!0);b.setTerminalPoint(w,!1);l.hasOwnProperty("curved")&&function(a,b){return a&&a.equals?a.equals(b):a===b}(function(a,b){return a[b]?a[b]:null}(l,"curved"),"1")&&(b=c.getModel().getGeometry(k),c=a.getControlPoints(d),b.points=c);return k};l.prototype.rotateChildEdge=function(c,b,a,d,k){if(null!=b){var n=c.getGeometry(b);c=c.getStyle(b);if(null!=n&&null!=c&&(b=c.indexOf("rotation="),-1<b))for(c=parseFloat(c.substring(b+9,c.indexOf(";",b))),b=n.width/
|
||||
2,n=n.height/2,l.rotatedEdgePoint(a,c,b,n),l.rotatedEdgePoint(d,c,b,n),a=0;a<k.length;a++)l.rotatedEdgePoint(k[a],c,b,n)}};l.prototype.sanitiseGraph=function(c){var b=c.getModel().getRoot();this.sanitiseCell(c,b)};l.prototype.sanitiseCell=function(c,b){for(var a=c.getModel(),d=a.getChildCount(b),k=[],n=0;n<d;n++){var f=a.getChildAt(b,n);this.sanitiseCell(c,f)&&0<k.push(f)}for(n=0;n<k.length;n++)a.remove(k[n]);0<d&&(d=a.getChildCount(b));k=(new String(a.getValue(b))).toString();n=a.getStyle(b);return 0!==
|
||||
d||!a.isVertex(b)||null!=a.getValue(b)&&0!==k.length||null==n||-1==n.indexOf(mxConstants.STYLE_FILLCOLOR+"=none")||-1==n.indexOf(mxConstants.STYLE_STROKECOLOR+"=none")||-1!=n.indexOf("image=")?!1:!0};return l}();g.mxVsdxCodec=e;e.__class="com.mxgraph.io.mxVsdxCodec"})(g.io||(g.io={}))})(f.mxgraph||(f.mxgraph={}))})(com||(com={}));
|
||||
"",a=0;a<c.length;a+=2)b+=String.fromCharCode(c.charCodeAt(a)|c.charCodeAt(a+1)<<8);return b};l.prototype.scaleGraph=function(c,b){if(1!==b){var a=c.getModel(),d;for(d in a.cells){var k=a.cells[d],n=a.getGeometry(k);if(null!=n&&(this.scaleRect(n,b),this.scaleRect(n.alternateBounds,b),a.isEdge(k)&&(this.scalePoint(n.sourcePoint,b),this.scalePoint(n.targetPoint,b),this.scalePoint(n.offset,b),k=n.points,null!=k)))for(n=0;n<k.length;n++)this.scalePoint(k[n],b)}}};l.incorrectXMLReqExp=[{regExp:/(\>[^&<]*)\&([^&<;]*\<)/g,
|
||||
repl:"$1&$2"}];l.prototype.decodeVsdx=function(c,b,a,d){var k=this,n={},w={},e=function(){var a;function d(){a=a.concat(k.RESPONSE_END);b&&b(a)}for(var c=l.vsdxPlaceholder+"/document.xml",e=n[c]?n[c]:null,y=e.firstChild;null!=y&&1!=y.nodeType;)y=y.nextSibling;if(null!=y&&1==y.nodeType)k.importNodes(e,y,c,n);else return null;k.vsdxModel=new f.mxgraph.io.vsdx.mxVsdxModel(e,n,w);c=k.vsdxModel.getPages();a=k.RESPONSE_HEADER;var A=function(a){null==a.entries&&(a.entries=[]);return a.entries}(c),g=
|
||||
function(b,d){var n=A[b].getValue(),c=z.createMxGraph();c.getModel().beginUpdate();z.importPage(n,c,c.getDefaultParent(),!0);z.scaleGraph(c,n.getPageScale()/n.getDrawingScale());c.getModel().endUpdate();z.postImportPage(n,c,function(){z.sanitiseGraph(c);a=a.concat(k.RESPONSE_DIAGRAM_START);a=a.concat(k.processPage(c,n));a=a.concat(k.RESPONSE_DIAGRAM_END);b<A.length-1?g(b+1,d):d()})},z=k;0<A.length?g(0,d):d()},A=0,g=0,q=function(){if(g==A)try{e()}catch(C){console.log(C),null!=d?d():b("")}};JSZip.loadAsync(c).then(function(a){0==
|
||||
Object.keys(a.files).length?null!=d&&d():a.forEach(function(a,b){var d=b.name,c=d.toLowerCase(),f=c.length;c.indexOf(".xml")==f-4||c.indexOf(".xml.rels")==f-9?(A++,b.async("string").then(function(a){if(0!==a.length){65279==a.charCodeAt(0)&&(a=a.substring(1));var b=l.parseXml(a);if(null==b)if(0===a.charCodeAt(1)&&0===a.charCodeAt(3)&&0===a.charCodeAt(5))b=l.parseXml(l.decodeUTF16LE(a));else{for(b=0;b<l.incorrectXMLReqExp.length;b++)l.incorrectXMLReqExp[b].regExp.test(a)&&(a=a.replace(l.incorrectXMLReqExp[b].regExp,
|
||||
l.incorrectXMLReqExp[b].repl));b=l.parseXml(a)}null!=b&&(b.vsdxFileName=d,n[d]=b)}g++;q()})):0===c.indexOf(l.vsdxPlaceholder+"/media")&&(A++,function(a,b){var d=a.length-b.length,k=a.indexOf(b,d);return-1!==k&&k===d}(c,".emf")?JSZip.support.blob&&window.EMF_CONVERT_URL?b.async("blob").then(function(a){var b=new FormData;b.append("img",a,c);b.append("inputformat","emf");b.append("outputformat","png");var n=new XMLHttpRequest;n.open("POST",EMF_CONVERT_URL);n.responseType="blob";k.editorUi.addRemoteServiceSecurityCheck(n);
|
||||
n.onreadystatechange=mxUtils.bind(this,function(){if(4==n.readyState)if(200<=n.status&&299>=n.status)try{var a=new FileReader;a.readAsDataURL(n.response);a.onloadend=function(){var b=a.result.indexOf(",")+1;w[d]=a.result.substr(b);g++;q()}}catch(ma){console.log(ma),g++,q()}else g++,q()});n.send(b)}):(g++,q()):function(a,b){var d=a.length-b.length,k=a.indexOf(b,d);return-1!==k&&k===d}(c,".bmp")?JSZip.support.uint8array&&b.async("uint8array").then(function(a){a=new BmpDecoder(a);var b=document.createElement("canvas");
|
||||
b.width=a.width;b.height=a.height;b.getContext("2d").putImageData(a.imageData,0,0);a=b.toDataURL("image/jpeg");w[d]=a.substr(23);g++;q()}):b.async("base64").then(function(a){w[d]=a;g++;q()}))})},function(a){null!=d&&d(a)})};l.prototype.createMxGraph=function(){var c=new Graph;c.setExtendParents(!1);c.setExtendParentsOnAdd(!1);c.setConstrainChildren(!1);c.setHtmlLabels(!0);c.getModel().maintainEdgeParent=!1;return c};l.prototype.processPage=function(c,b){var a=(new mxCodec).encode(c.getModel());a.setAttribute("style",
|
||||
"default-style2");var a=mxUtils.getXml(a),d="";if(null!=b)var k=mxUtils.htmlEntities(b.getPageName())+(b.isBackground()?" (Background)":""),d=d+('<diagram name="'+k+'" id="'+k.replace(/\s/g,"_")+'">');return d+=Graph.compress(a)};l.prototype.scalePoint=function(c,b){null!=c&&(c.x*=b,c.y*=b);return c};l.prototype.scaleRect=function(c,b){null!=c&&(c.x*=b,c.y*=b,c.height*=b,c.width*=b);return c};l.prototype.importNodes=function(c,b,a,d){var k=a.lastIndexOf("/"),n=a,f=a;if(-1!==k&&(n=a.substring(0,k),
|
||||
f=a.substring(k+1,a.length),a=function(a,b){return a[b]?a[b]:null}(d,n+"/_rels/"+f+".rels"),null!=a)){var l=a.getElementsByTagName("Relationship");a={};for(k=0;k<l.length;k++){var f=l.item(k),e=f.getAttribute("Id"),f=f.getAttribute("Target");a[e]=f}b=b.getElementsByTagName("Rel");for(k=0;k<b.length;k++)if(l=b.item(k),f=function(a,b){return a[b]?a[b]:null}(a,l.getAttribute("r:id")),f=n+"/"+f,null!=f&&(e=d[f]?d[f]:null,null!=e)){l=l.parentNode;for(e=e.firstChild;null!=e&&1!=e.nodeType;)e=e.nextSibling;
|
||||
if(null!=e&&1==e.nodeType)for(e=e.firstChild;null!=e;){if(null!=e&&1==e.nodeType){var g=l.appendChild(c.importNode(e,!0));this.importNodes(c,g,f,d)}e=e.nextSibling}}}};l.prototype.importPage=function(c,b,a,d){var k=c.getBackPage();if(null!=k){b.getModel().setValue(b.getDefaultParent(),c.getPageName());var n=new mxCell(k.getPageName());b.addCell(n,b.getModel().getRoot(),0,null,null);this.importPage(k,b,b.getDefaultParent())}k=c.getLayers();this.layersMap[0]=b.getDefaultParent();for(n=0;n<k.length;n++){var f=
|
||||
k[n];if(0==n)var l=b.getDefaultParent();else l=new mxCell,b.addCell(l,b.model.root,n);l.setVisible(1==f.Visible);1==f.Lock&&l.setStyle("locked=1;");l.setValue(f.Name);this.layersMap[n]=l}f=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){null==a.entries&&(a.entries=[]);return a.entries}(c.getShapes()));k=c.getPageDimensions().y;for(n=c.getId();f.hasNext();){var l=f.next(),l=l.getValue(),e=this.layersMap[l.layerMember];this.addShape(b,
|
||||
l,e?e:a,n,k)}for(c=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){null==a.entries&&(a.entries=[]);return a.entries}(c.getConnects()));c.hasNext();)l=c.next(),a=this.addConnectedEdge(b,l.getValue(),n,k),null!=a&&function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries.splice(d,1)[0]}(this.edgeShapeMap,
|
||||
a);for(c=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){null==a.entries&&(a.entries=[]);return a.entries}(this.edgeShapeMap));c.hasNext();)a=c.next(),a.getKey().getPageNumber()===n&&this.addUnconnectedEdge(b,function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.parentsMap,
|
||||
a.getKey()),a.getValue(),k);d||this.sanitiseGraph(b);return k};l.prototype.postImportPage=function(c,b,a){try{var d=this,k=[],n=c.getShapes().entries||[];for(b=0;b<n.length;b++){var w=n[b].value||{};w.toBeCroppedImg&&k.push(w)}if(0<k.length){var l=function(a,b){function n(){a<k.length-1?l(a+1,b):b()}var w=k[a],e=w.toBeCroppedImg,y=function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;
|
||||
return null}(d.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(c.Id,w.Id)),A=new Image;A.onload=function(){var a=e.iData,b=e.iType;try{var d=A.width/e.imgWidth,k=A.height/e.imgHeight,c=-e.imgOffsetX*d,f=(e.imgHeight-e.height+e.imgOffsetY)*k,w=document.createElement("canvas");w.width=e.width*d;w.height=e.height*k;var l=w.getContext("2d");l.fillStyle="#FFFFFF";l.fillRect(0,0,w.width,w.height);l.drawImage(A,c,f,w.width,w.height,0,0,w.width,w.height);a=w.toDataURL("image/jpeg").substr(23);b="jpg"}catch(Z){console.log(Z)}y.style+=
|
||||
";image=data:image/"+b+","+a;n()};A.src="data:image/"+e.iType+";base64,"+e.iData;A.onerror=function(){y.style+=";image=data:image/"+e.iType+","+e.iData;n()}};l(0,a)}else a()}catch(A){console.log(A),a()}};l.prototype.addShape=function(c,b,a,d,k){b.parentHeight=k;var n=f.mxgraph.io.vsdx.VsdxShape.getType(b.getShape());if(null!=n&&(function(a,b){return a&&a.equals?a.equals(b):a===b}(n,f.mxgraph.io.vsdx.mxVsdxConstants.TYPE_SHAPE)||function(a,b){return a&&a.equals?a.equals(b):a===b}(n,f.mxgraph.io.vsdx.mxVsdxConstants.TYPE_GROUP)||
|
||||
function(a,b){return a&&a.equals?a.equals(b):a===b}(n,f.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN))){var w=b.getId();if(b.isVertex())return n=null,n=b.isGroup()?this.addGroup(c,b,a,d,k):this.addVertex(c,b,a,d,k),function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})}(this.vertexShapeMap,
|
||||
new f.mxgraph.io.vsdx.ShapePageId(d,w),b),b=b.getHyperlink(),b.extLink?c.setLinkForCell(n,b.extLink):b.pageLink&&c.setLinkForCell(n,"data:page/id,"+b.pageLink),n;b.setShapeIndex(c.getModel().getChildCount(a));(function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})})(this.edgeShapeMap,
|
||||
new f.mxgraph.io.vsdx.ShapePageId(d,w),b);(function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})})(this.parentsMap,new f.mxgraph.io.vsdx.ShapePageId(d,w),a)}return null};l.prototype.addGroup=function(c,b,a,d,k){var n=b.getDimensions(),w=b.getMaster(),l=b.getStyleFromShape(),
|
||||
e=b.getGeomList();e.isNoFill()&&(l[mxConstants.STYLE_FILLCOLOR]="none",l[mxConstants.STYLE_GRADIENTCOLOR]="none");e.isNoLine()&&(l[mxConstants.STYLE_STROKECOLOR]="none");l.html="1";l[mxConstants.STYLE_WHITE_SPACE]="wrap";var g=f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"="),l=null,q=b.getChildShapes(),l=null!=q&&0<function(a){null==a.entries&&(a.entries=[]);return a.entries.length}(q),e=b.isDisplacedLabel()||b.isRotatedLabel()||l,l=b.getOriginPoint(k,!0);if(e)l=c.insertVertex(a,null,null,Math.floor(Math.round(100*
|
||||
l.x)/100),Math.floor(Math.round(100*l.y)/100),Math.floor(Math.round(100*n.x)/100),Math.floor(Math.round(100*n.y)/100),g);else var C=b.getTextLabel(),l=c.insertVertex(a,null,C,Math.floor(Math.round(100*l.x)/100),Math.floor(Math.round(100*l.y)/100),Math.floor(Math.round(100*n.x)/100),Math.floor(Math.round(100*n.y)/100),g);for(a=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){null==a.entries&&(a.entries=[]);return a.entries}(q));a.hasNext();)g=
|
||||
a.next().getValue(),q=g.getId(),g.isVertex()?(C=f.mxgraph.io.vsdx.VsdxShape.getType(g.getShape()),null!=C&&(function(a,b){return a&&a.equals?a.equals(b):a===b}(C,f.mxgraph.io.vsdx.mxVsdxConstants.TYPE_SHAPE)||function(a,b){return a&&a.equals?a.equals(b):a===b}(C,f.mxgraph.io.vsdx.mxVsdxConstants.TYPE_GROUP)||function(a,b){return a&&a.equals?a.equals(b):a===b}(C,f.mxgraph.io.vsdx.mxVsdxConstants.FOREIGN))&&g.isVertex()&&(g.propagateRotation(b.getRotation()),g.isGroup()?this.addGroup(c,g,l,d,n.y):this.addVertex(c,
|
||||
g,l,d,n.y)),null==w&&function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})}(this.vertexShapeMap,new f.mxgraph.io.vsdx.ShapePageId(d,q),g)):null==w?(function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&
|
||||
a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})}(this.edgeShapeMap,new f.mxgraph.io.vsdx.ShapePageId(d,q),g),function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},
|
||||
getValue:function(){return this.value}})}(this.parentsMap,new f.mxgraph.io.vsdx.ShapePageId(d,q),l)):this.addUnconnectedEdge(c,l,g,k);e&&b.createLabelSubShape(c,l);c=b.getRotation();if(0!==c)for(n=l.getGeometry(),k=n.width/2,n=n.height/2,w=0;w<l.getChildCount();w++)e=l.getChildAt(w),f.mxgraph.online.Utils.rotatedGeometry(e.getGeometry(),c,k,n);(function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===
|
||||
b){a.entries[k].value=d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})})(this.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(d,b.getId()),l);return l};l.rotatedEdgePoint=function(c,b,a,d){b=b*Math.PI/180;var k=Math.cos(b);b=Math.sin(b);var n=c.x-a,f=c.y-d;c.x=Math.round(n*k-f*b+a);c.y=Math.round(f*k+n*b+d)};l.prototype.addVertex=function(c,b,a,d,k){var n="",w=b.isDisplacedLabel()||b.isRotatedLabel();w||(n=b.getTextLabel());var l=b.getDimensions(),
|
||||
e=b.getStyleFromShape();e.html="1";var g=e.hasOwnProperty(mxConstants.STYLE_SHAPE)||e.hasOwnProperty("stencil");e.hasOwnProperty(mxConstants.STYLE_FILLCOLOR)&&g||(e[mxConstants.STYLE_FILLCOLOR]="none");g||(e[mxConstants.STYLE_STROKECOLOR]="none");e.hasOwnProperty(mxConstants.STYLE_GRADIENTCOLOR)&&g||(e[mxConstants.STYLE_GRADIENTCOLOR]="none");e[mxConstants.STYLE_WHITE_SPACE]="wrap";k=b.getOriginPoint(k,!0);return g||null!=n?(e=f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(e,"="),g=null,g=w?c.insertVertex(a,
|
||||
null,null,Math.floor(Math.round(100*k.x)/100),Math.floor(Math.round(100*k.y)/100),Math.floor(Math.round(100*l.x)/100),Math.floor(Math.round(100*l.y)/100),e):c.insertVertex(a,null,n,Math.floor(Math.round(100*k.x)/100),Math.floor(Math.round(100*k.y)/100),Math.floor(Math.round(100*l.x)/100),Math.floor(Math.round(100*l.y)/100),e),function(a,b,d){null==a.entries&&(a.entries=[]);for(var k=0;k<a.entries.length;k++)if(null!=a.entries[k].key.equals&&a.entries[k].key.equals(b)||a.entries[k].key===b){a.entries[k].value=
|
||||
d;return}a.entries.push({key:b,value:d,getKey:function(){return this.key},getValue:function(){return this.value}})}(this.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(d,b.getId()),g),b.setLabelOffset(g,e),w&&b.createLabelSubShape(c,g),g):null};l.calculateAbsolutePoint=function(c){for(var b=0,a=0;null!=c;){var d=c.geometry;null!=d&&(b+=d.x,a+=d.y);c=c.parent}return new mxPoint(b,a)};l.prototype.addConnectedEdge=function(c,b,a,d){var k=b.getFromSheet(),k=new f.mxgraph.io.vsdx.ShapePageId(a,k),n=function(a,
|
||||
b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.edgeShapeMap,k);if(null==n)return null;var w=function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.parentsMap,new f.mxgraph.io.vsdx.ShapePageId(a,n.getId()));
|
||||
if(null!=w){var e=c.getModel().getGeometry(w);null!=e&&(d=e.height)}var g=n.getStartXY(d),z=n.getEndXY(d),e=n.getRoutingPoints(d,g,n.getRotation());this.rotateChildEdge(c.getModel(),w,g,z,e);var q=null,C=b.getSourceToSheet(),C=null!=C?function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===b)return a.entries[d].value;return null}(this.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(a,C)):null,E=!0;
|
||||
if(null==C)C=c.insertVertex(w,null,null,Math.floor(Math.round(100*g.x)/100),Math.floor(Math.round(100*g.y)/100),0,0);else if(C.style&&-1==C.style.indexOf(";rotation="))var q=l.calculateAbsolutePoint(C),D=l.calculateAbsolutePoint(w),G=C.geometry,q=new mxPoint((D.x+g.x-q.x)/G.width,(D.y+g.y-q.y)/G.height);else E=!1;g=null;b=b.getTargetToSheet();b=null!=b?function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=a.entries[d].key.equals&&a.entries[d].key.equals(b)||a.entries[d].key===
|
||||
b)return a.entries[d].value;return null}(this.vertexMap,new f.mxgraph.io.vsdx.ShapePageId(a,b)):null;D=!0;null==b?b=c.insertVertex(w,null,null,Math.floor(Math.round(100*z.x)/100),Math.floor(Math.round(100*z.y)/100),0,0):b.style&&-1==b.style.indexOf(";rotation=")?(a=l.calculateAbsolutePoint(b),g=l.calculateAbsolutePoint(w),G=b.geometry,g=new mxPoint((g.x+z.x-a.x)/G.width,(g.y+z.y-a.y)/G.height)):D=!1;z=n.getStyleFromEdgeShape(d);G=n.getRotation();0!==G?(a=c.insertEdge(w,null,null,C,b,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(z,
|
||||
"=")),E=n.createLabelSubShape(c,a),null!=E&&(E.setStyle(E.getStyle()+";rotation="+(60<G&&240>G?(G+180)%360:G)),E=E.getGeometry(),E.x=0,E.y=0,E.relative=!0,E.offset=new mxPoint(-E.width/2,-E.height/2))):(a=c.insertEdge(w,null,n.getTextLabel(),C,b,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(z,"=")),G=n.getLblEdgeOffset(c.getView(),e),a.getGeometry().offset=G,null!=q&&c.setConnectionConstraint(a,C,!0,new mxConnectionConstraint(q,!1)),E&&e.shift(),null!=g&&c.setConnectionConstraint(a,b,!1,new mxConnectionConstraint(g,
|
||||
!1)),D&&e.pop());E=c.getModel().getGeometry(a);if(C.parent!=b.parent&&null!=w&&1!=w.id&&1==C.parent.id){b=q=0;do g=w.geometry,null!=g&&(q+=g.x,b+=g.y),w=w.parent;while(null!=w);a.parent=C.parent;for(w=0;w<e.length;w++)e[w].x+=q,e[w].y+=b}E.points=e;z.hasOwnProperty("curved")&&function(a,b){return a&&a.equals?a.equals(b):a===b}(function(a,b){return a[b]?a[b]:null}(z,"curved"),"1")&&(E=c.getModel().getGeometry(a),c=n.getControlPoints(d),E.points=c);return k};l.prototype.addUnconnectedEdge=function(c,
|
||||
b,a,d){if(null!=b){var k=c.getModel().getGeometry(b);null!=k&&(d=k.height)}var n=a.getStartXY(d),w=a.getEndXY(d),l=a.getStyleFromEdgeShape(d),e=a.getRoutingPoints(d,n,a.getRotation()),g=a.getRotation();if(0!==g){0===a.getShapeIndex()?k=c.insertEdge(b,null,null,null,null,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"=")):(k=c.createEdge(b,null,null,null,null,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"=")),k=c.addEdge(k,b,null,null,a.getShapeIndex()));var q=a.createLabelSubShape(c,k);null!=q&&
|
||||
(q.setStyle(q.getStyle()+";rotation="+(60<g&&240>g?(g+180)%360:g)),g=q.getGeometry(),g.x=0,g.y=0,g.relative=!0,g.offset=new mxPoint(-g.width/2,-g.height/2))}else 0===a.getShapeIndex()?k=c.insertEdge(b,null,a.getTextLabel(),null,null,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"=")):(k=c.createEdge(b,null,a.getTextLabel(),null,null,f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(l,"=")),k=c.addEdge(k,b,null,null,a.getShapeIndex())),g=a.getLblEdgeOffset(c.getView(),e),k.getGeometry().offset=g;this.rotateChildEdge(c.getModel(),
|
||||
b,n,w,e);b=c.getModel().getGeometry(k);e.pop();e.shift();b.points=e;b.setTerminalPoint(n,!0);b.setTerminalPoint(w,!1);l.hasOwnProperty("curved")&&function(a,b){return a&&a.equals?a.equals(b):a===b}(function(a,b){return a[b]?a[b]:null}(l,"curved"),"1")&&(b=c.getModel().getGeometry(k),c=a.getControlPoints(d),b.points=c);return k};l.prototype.rotateChildEdge=function(c,b,a,d,k){if(null!=b){var n=c.getGeometry(b);c=c.getStyle(b);if(null!=n&&null!=c&&(b=c.indexOf("rotation="),-1<b))for(c=parseFloat(c.substring(b+
|
||||
9,c.indexOf(";",b))),b=n.width/2,n=n.height/2,l.rotatedEdgePoint(a,c,b,n),l.rotatedEdgePoint(d,c,b,n),a=0;a<k.length;a++)l.rotatedEdgePoint(k[a],c,b,n)}};l.prototype.sanitiseGraph=function(c){var b=c.getModel().getRoot();this.sanitiseCell(c,b)};l.prototype.sanitiseCell=function(c,b){for(var a=c.getModel(),d=a.getChildCount(b),k=[],n=0;n<d;n++){var f=a.getChildAt(b,n);this.sanitiseCell(c,f)&&0<k.push(f)}for(n=0;n<k.length;n++)a.remove(k[n]);0<d&&(d=a.getChildCount(b));k=(new String(a.getValue(b))).toString();
|
||||
n=a.getStyle(b);return 0!==d||!a.isVertex(b)||null!=a.getValue(b)&&0!==k.length||null==n||-1==n.indexOf(mxConstants.STYLE_FILLCOLOR+"=none")||-1==n.indexOf(mxConstants.STYLE_STROKECOLOR+"=none")||-1!=n.indexOf("image=")?!1:!0};return l}();g.mxVsdxCodec=e;e.__class="com.mxgraph.io.mxVsdxCodec"})(g.io||(g.io={}))})(f.mxgraph||(f.mxgraph={}))})(com||(com={}));
|
||||
(function(f){(function(g){(function(g){var e=function(l){function c(b){var a=l.call(this)||this;a.RESPONSE_END="";a.RESPONSE_DIAGRAM_START="";a.RESPONSE_DIAGRAM_END="";a.RESPONSE_HEADER="";a.editorUi=b;return a}__extends(c,l);c.prototype.decodeVssx=function(b,a,d,k){var n=this,c="<mxlibrary>[";this.decodeVsdx(b,function(b){c=c.concat(b);var d=n.vsdxModel.getMasterShapes(),w=function(a){var b=0;return{next:function(){return b<a.length?a[b++]:null},hasNext:function(){return b<a.length}}}(function(a){var b=
|
||||
[];null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)b.push(a.entries[d].value);return b}(n.vsdxModel.getPages())).next();if(null!=d){var e={str:"",toString:function(){return this.str}},g=0===b.length?"":",",y=function(a){return Object.keys(a).map(function(b){return a[b]})}(d);b=function(a){a=y[a];var b=q.createMxGraph(),k=1;if(null!=a.pageSheet){var n=k=1,c=a.pageSheet.DrawingScale;null!=c&&(k=parseFloat(c.getAttribute("V"))||1);c=a.pageSheet.PageScale;null!=c&&(n=parseFloat(c.getAttribute("V"))||
|
||||
1);k=n/k}n=!1;for(c=0;null!=a.firstLevelShapes&&c<a.firstLevelShapes.length;c++){var A=a.firstLevelShapes[c].getShape(),z=new f.mxgraph.io.vsdx.VsdxShape(w,A,!w.isEdge(A),d,null,q.vsdxModel),A=null;if(z.isVertex()){q.edgeShapeMap.entries=[];q.parentsMap.entries=[];for(var A=q.addShape(b,z,b.getDefaultParent(),0,1169),z=function(a){null==a.entries&&(a.entries=[]);return a.entries}(q.edgeShapeMap),C=0;C<z.length;C++){var B=z[C],E=function(a,b){null==a.entries&&(a.entries=[]);for(var d=0;d<a.entries.length;d++)if(null!=
|
||||
|
@ -1415,18 +1415,18 @@ Math.min(100,Math.abs(a.x-b.x))*l[g+2]))/100);q.y=Math.floor(Math.round(100*(b.y
|
|||
c));c=this.getEdgeMarker(!0);null!=c&&(function(a,b,c){void 0===c&&(c=0);return a.substr(c,b.length)===b}(c,b.ARROW_NO_FILL_MARKER)&&(c=c.substring(b.ARROW_NO_FILL_MARKER.length),this.styleMap[mxConstants.STYLE_STARTFILL]="0"),this.styleMap[mxConstants.STYLE_STARTARROW]=c);c=this.getEdgeMarker(!1);null!=c&&(function(a,b,c){void 0===c&&(c=0);return a.substr(c,b.length)===b}(c,b.ARROW_NO_FILL_MARKER)&&(c=c.substring(b.ARROW_NO_FILL_MARKER.length),this.styleMap[mxConstants.STYLE_ENDFILL]="0"),this.styleMap[mxConstants.STYLE_ENDARROW]=
|
||||
c);c=Math.round(this.getStartArrowSize())|0;6!==c&&(this.styleMap[mxConstants.STYLE_STARTSIZE]=""+c);c=Math.round(this.getFinalArrowSize())|0;6!==c&&(this.styleMap[mxConstants.STYLE_ENDSIZE]=""+c);c=Math.round(this.getLineWidth())|0;1!==c&&(this.styleMap[mxConstants.STYLE_STROKEWIDTH]=""+c);c=this.getStrokeColor();(function(a,b){return a&&a.equals?a.equals(b):a===b})(c,"")||(this.styleMap[mxConstants.STYLE_STROKECOLOR]=c);this.isShadow()&&(this.styleMap[mxConstants.STYLE_SHADOW]=f.mxgraph.io.vsdx.mxVsdxConstants.TRUE);
|
||||
this.isConnectorBigNameU(this.getNameU())&&(this.styleMap[mxConstants.STYLE_SHAPE]=mxConstants.SHAPE_ARROW,c=this.getFillColor(),function(a,b){return a&&a.equals?a.equals(b):a===b}(c,"")||(this.styleMap[mxConstants.STYLE_FILLCOLOR]=c));c=Math.round(this.getTopSpacing())|0;this.styleMap[mxConstants.STYLE_SPACING_TOP]=""+c;c=Math.round(this.getBottomSpacing())|0;this.styleMap[mxConstants.STYLE_SPACING_BOTTOM]=""+c;c=Math.round(this.getLeftSpacing())|0;this.styleMap[mxConstants.STYLE_SPACING_LEFT]=""+
|
||||
c;c=Math.round(this.getRightSpacing())|0;this.styleMap[mxConstants.STYLE_SPACING_RIGHT]=""+c;c=this.getAlignVertical();this.styleMap[mxConstants.STYLE_VERTICAL_ALIGN]=c;this.styleMap.html="1";this.resolveCommonStyles();return this.styleMap};b.prototype.resolveCommonStyles=function(){var a=this.getTextBkgndColor(this.getCellElement$java_lang_String(f.mxgraph.io.vsdx.mxVsdxConstants.TEXT_BKGND)),b;b=a&&a.equals?a.equals(""):""===a;b||(this.styleMap[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR]=a);this.styleMap[mxConstants.STYLE_ROUNDED]=
|
||||
0<this.getRounding()?f.mxgraph.io.vsdx.mxVsdxConstants.TRUE:f.mxgraph.io.vsdx.mxVsdxConstants.FALSE;return this.styleMap};b.prototype.getEdgeMarker=function(a){var c=this.getValue(this.getCellElement$java_lang_String(a?f.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW:f.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW),"0"),e=0;try{if(function(a,b){return a&&a.equals?a.equals(b):a===b}(c,"Themed")){var g=this.getTheme();null!=g&&(e=this.isVertex()?g.getEdgeMarker(a,this.getQuickStyleVals()):g.getConnEdgeMarker(a,
|
||||
this.getQuickStyleVals()))}else e=parseInt(c)}catch(w){}a=function(a,b){null==a.entries&&(a.entries=[]);for(var c=0;c<a.entries.length;c++)if(null!=a.entries[c].key.equals&&a.entries[c].key.equals(b)||a.entries[c].key===b)return a.entries[c].value;return null}(b.arrowTypes_$LI$(),e);0<e&&null==a&&(a=function(a,b){null==a.entries&&(a.entries=[]);for(var c=0;c<a.entries.length;c++)if(null!=a.entries[c].key.equals&&a.entries[c].key.equals(b)||a.entries[c].key===b)return a.entries[c].value;return null}(b.arrowTypes_$LI$(),
|
||||
1));return a};b.prototype.getCellElement$java_lang_String=function(a){var b=c.prototype.getCellElement$java_lang_String.call(this,a);return null==b&&null!=this.masterShape?this.masterShape.getCellElement$java_lang_String(a):b};b.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String=function(a,b,e){var d=c.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String.call(this,a,b,e);return null==d&&null!=this.masterShape?this.masterShape.getCellElement$java_lang_String$java_lang_String$java_lang_String(a,
|
||||
b,e):d};b.prototype.getCellElement=function(a,b,c){if("string"!==typeof a&&null!==a||"string"!==typeof b&&null!==b||"string"!==typeof c&&null!==c){if("string"!==typeof a&&null!==a||void 0!==b||void 0!==c)throw Error("invalid overload");return this.getCellElement$java_lang_String(a)}return this.getCellElement$java_lang_String$java_lang_String$java_lang_String(a,b,c)};b.prototype.createLabelSubShape=function(a,b){var c=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH),
|
||||
this.getWidth()),d=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT),this.getHeight()),e=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_X),c/2),g=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_Y),d/2),l=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X),
|
||||
e),q=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y),g),B=this.getValueAsDouble(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE),0),C=this.getTextLabel();if(null!=C&&0!==C.length){var E=mxUtils.clone(this.getStyleMap())||{};E[mxConstants.STYLE_FILLCOLOR]=mxConstants.NONE;E[mxConstants.STYLE_STROKECOLOR]=mxConstants.NONE;E[mxConstants.STYLE_GRADIENTCOLOR]=mxConstants.NONE;E.hasOwnProperty("align")||(E.align="center");
|
||||
E.hasOwnProperty("verticalAlign")||(E.verticalAlign="middle");E.hasOwnProperty("whiteSpace")||(E.whiteSpace="wrap");delete E.shape;delete E.image;this.isVerticalLabel()&&(B+=Math.PI+.01,E.horizontal="0");var D=this.getRotation();0!==B&&(B=360-180*B/Math.PI,B=Math.round((B+D)%360*100)/100,0!==B&&(E.rotation=""+B));E="text;"+f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(E,"=");g=b.getGeometry().height-(q+d-g);e=l-e;0<D&&(l=new mxGeometry(e,g,c,d),e=b.getGeometry(),f.mxgraph.online.Utils.rotatedGeometry(l,
|
||||
D,e.width/2,e.height/2),e=l.x,g=l.y);return a.insertVertex(b,null,C,Math.round(100*e)/100,Math.round(100*g)/100,Math.round(100*c)/100,Math.round(100*d)/100,E+";html=1;")}return null};b.prototype.getLblEdgeOffset=function(a,b){if(null!=b&&1<b.length){var c=new mxCellState;c.absolutePoints=b;a.updateEdgeBounds(c);var c=a.getPoint(c),d=b[0],e=b[b.length-1],g=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH),this.getWidth()),l=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT),
|
||||
this.getHeight()),q=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_X),0),B=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_Y),0),C=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X),0),E=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y),
|
||||
0),e=(this.getHeight()-(d.y-e.y))/2+d.y-c.y-(E-B+l/2),c=C-q+g/2+(d.x-c.x);return 1E11<Math.abs(c)?null:new mxPoint(Math.floor(Math.round(100*c)/100),Math.floor(Math.round(100*e)/100))}return null};b.prototype.getShapeIndex=function(){return this.shapeIndex};b.prototype.setShapeIndex=function(a){this.shapeIndex=a};return b}(f.mxgraph.io.vsdx.Shape);g.__static_initialized=!1;g.ARROW_NO_FILL_MARKER="0";g.maxDp=2;g.USE_SHAPE_MATCH=!1;g.stencilTemplate='<shape h="htemplate" w="wtemplate" aspect="variable" strokewidth="inherit"><connections></connections><background></background><foreground></foreground></shape>';
|
||||
e.VsdxShape=g;g.__class="com.mxgraph.io.vsdx.VsdxShape"})(g.vsdx||(g.vsdx={}))})(g.io||(g.io={}))})(f.mxgraph||(f.mxgraph={}))})(com||(com={}));
|
||||
c;c=Math.round(this.getRightSpacing())|0;this.styleMap[mxConstants.STYLE_SPACING_RIGHT]=""+c;c=this.getAlignVertical();this.styleMap[mxConstants.STYLE_VERTICAL_ALIGN]=c;this.styleMap.html="1";this.resolveCommonStyles();return this.styleMap};b.prototype.resolveCommonStyles=function(){var a=this.getTextBkgndColor(this.getCellElement$java_lang_String(f.mxgraph.io.vsdx.mxVsdxConstants.TEXT_BKGND)),b;b=a&&a.equals?a.equals(""):""===a;b||"1"!=this.getValue(this.getCellElement$java_lang_String("TextBkgndTrans"),
|
||||
"0")&&(this.styleMap[mxConstants.STYLE_LABEL_BACKGROUNDCOLOR]=a);this.styleMap[mxConstants.STYLE_ROUNDED]=0<this.getRounding()?f.mxgraph.io.vsdx.mxVsdxConstants.TRUE:f.mxgraph.io.vsdx.mxVsdxConstants.FALSE;return this.styleMap};b.prototype.getEdgeMarker=function(a){var c=this.getValue(this.getCellElement$java_lang_String(a?f.mxgraph.io.vsdx.mxVsdxConstants.BEGIN_ARROW:f.mxgraph.io.vsdx.mxVsdxConstants.END_ARROW),"0"),e=0;try{if(function(a,b){return a&&a.equals?a.equals(b):a===b}(c,"Themed")){var g=
|
||||
this.getTheme();null!=g&&(e=this.isVertex()?g.getEdgeMarker(a,this.getQuickStyleVals()):g.getConnEdgeMarker(a,this.getQuickStyleVals()))}else e=parseInt(c)}catch(w){}a=function(a,b){null==a.entries&&(a.entries=[]);for(var c=0;c<a.entries.length;c++)if(null!=a.entries[c].key.equals&&a.entries[c].key.equals(b)||a.entries[c].key===b)return a.entries[c].value;return null}(b.arrowTypes_$LI$(),e);0<e&&null==a&&(a=function(a,b){null==a.entries&&(a.entries=[]);for(var c=0;c<a.entries.length;c++)if(null!=
|
||||
a.entries[c].key.equals&&a.entries[c].key.equals(b)||a.entries[c].key===b)return a.entries[c].value;return null}(b.arrowTypes_$LI$(),1));return a};b.prototype.getCellElement$java_lang_String=function(a){var b=c.prototype.getCellElement$java_lang_String.call(this,a);return null==b&&null!=this.masterShape?this.masterShape.getCellElement$java_lang_String(a):b};b.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String=function(a,b,e){var d=c.prototype.getCellElement$java_lang_String$java_lang_String$java_lang_String.call(this,
|
||||
a,b,e);return null==d&&null!=this.masterShape?this.masterShape.getCellElement$java_lang_String$java_lang_String$java_lang_String(a,b,e):d};b.prototype.getCellElement=function(a,b,c){if("string"!==typeof a&&null!==a||"string"!==typeof b&&null!==b||"string"!==typeof c&&null!==c){if("string"!==typeof a&&null!==a||void 0!==b||void 0!==c)throw Error("invalid overload");return this.getCellElement$java_lang_String(a)}return this.getCellElement$java_lang_String$java_lang_String$java_lang_String(a,b,c)};b.prototype.createLabelSubShape=
|
||||
function(a,b){var c=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH),this.getWidth()),d=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT),this.getHeight()),e=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_X),c/2),g=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_Y),
|
||||
d/2),l=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X),e),q=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y),g),B=this.getValueAsDouble(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_ANGLE),0),C=this.getTextLabel();if(null!=C&&0!==C.length){var E=mxUtils.clone(this.getStyleMap())||{};E[mxConstants.STYLE_FILLCOLOR]=mxConstants.NONE;E[mxConstants.STYLE_STROKECOLOR]=
|
||||
mxConstants.NONE;E[mxConstants.STYLE_GRADIENTCOLOR]=mxConstants.NONE;E.hasOwnProperty("align")||(E.align="center");E.hasOwnProperty("verticalAlign")||(E.verticalAlign="middle");E.hasOwnProperty("whiteSpace")||(E.whiteSpace="wrap");delete E.shape;delete E.image;this.isVerticalLabel()&&(B+=Math.PI+.01,E.horizontal="0");var D=this.getRotation();0!==B&&(B=360-180*B/Math.PI,B=Math.round((B+D)%360*100)/100,0!==B&&(E.rotation=""+B));E="text;"+f.mxgraph.io.vsdx.mxVsdxUtils.getStyleString(E,"=");g=b.getGeometry().height-
|
||||
(q+d-g);e=l-e;0<D&&(l=new mxGeometry(e,g,c,d),e=b.getGeometry(),f.mxgraph.online.Utils.rotatedGeometry(l,D,e.width/2,e.height/2),e=l.x,g=l.y);return a.insertVertex(b,null,C,Math.round(100*e)/100,Math.round(100*g)/100,Math.round(100*c)/100,Math.round(100*d)/100,E+";html=1;")}return null};b.prototype.getLblEdgeOffset=function(a,b){if(null!=b&&1<b.length){var c=new mxCellState;c.absolutePoints=b;a.updateEdgeBounds(c);var c=a.getPoint(c),d=b[0],e=b[b.length-1],g=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_WIDTH),
|
||||
this.getWidth()),l=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_HEIGHT),this.getHeight()),q=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_X),0),B=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_LOC_PIN_Y),0),C=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_X),
|
||||
0),E=this.getScreenNumericalValue$org_w3c_dom_Element$double(this.getShapeNode(f.mxgraph.io.vsdx.mxVsdxConstants.TXT_PIN_Y),0),e=(this.getHeight()-(d.y-e.y))/2+d.y-c.y-(E-B+l/2),c=C-q+g/2+(d.x-c.x);return 1E11<Math.abs(c)?null:new mxPoint(Math.floor(Math.round(100*c)/100),Math.floor(Math.round(100*e)/100))}return null};b.prototype.getShapeIndex=function(){return this.shapeIndex};b.prototype.setShapeIndex=function(a){this.shapeIndex=a};return b}(f.mxgraph.io.vsdx.Shape);g.__static_initialized=!1;g.ARROW_NO_FILL_MARKER=
|
||||
"0";g.maxDp=2;g.USE_SHAPE_MATCH=!1;g.stencilTemplate='<shape h="htemplate" w="wtemplate" aspect="variable" strokewidth="inherit"><connections></connections><background></background><foreground></foreground></shape>';e.VsdxShape=g;g.__class="com.mxgraph.io.vsdx.VsdxShape"})(g.vsdx||(g.vsdx={}))})(g.io||(g.io={}))})(f.mxgraph||(f.mxgraph={}))})(com||(com={}));
|
||||
(function(f){(function(g){(function(g){var e=function(){function e(){}e.__static_initialize=function(){e.__static_initialized||(e.__static_initialized=!0,e.__static_initializer_0())};e.CA_$LI$=function(){e.__static_initialize();null==e.CA&&(e.CA="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""));return e.CA};e.IA_$LI$=function(){e.__static_initialize();if(null==e.IA){for(var c=256,b=[];0<c--;)b.push(0);e.IA=b}return e.IA};e.__static_initializer_0=function(){for(var c=e.IA_$LI$(),
|
||||
b=0;b<c.length;b++)c[b]=-1;c=0;for(b=e.CA_$LI$().length;c<b;c++)e.IA_$LI$()[e.CA_$LI$()[c].charCodeAt(0)]=c;e.IA_$LI$()[61]=0};e.encodeToChar=function(c,b,a){var d=null!=c?c.length-b:0;if(0===d)return[];for(var f=3*(d/3|0),g=((d-1)/3|0)+1<<2,g=g+(a?((g-1)/76|0)<<1:0),l=Array(g),q=b,A=0,z=0;q<f+b;){var B=(c[q++]&255)<<16|(c[q++]&255)<<8|c[q++]&255;l[A++]=e.CA_$LI$()[B>>>18&63];l[A++]=e.CA_$LI$()[B>>>12&63];l[A++]=e.CA_$LI$()[B>>>6&63];l[A++]=e.CA_$LI$()[B&63];a&&19===++z&&A<g-2&&(l[A++]="\r",l[A++]=
|
||||
"\n",z=0)}a=d-f;0<a&&(B=(c[f+b]&255)<<10|(2===a?(c[d+b-1]&255)<<2:0),l[g-4]=e.CA_$LI$()[B>>12],l[g-3]=e.CA_$LI$()[B>>>6&63],l[g-2]=2===a?e.CA_$LI$()[B&63]:"=",l[g-1]="=");return l};e.decode$char_A=function(c){var b=null!=c?c.length:0;if(0===b)return[];for(var a=0,d=0;d<b;d++)0>e.IA_$LI$()[c[d].charCodeAt(0)]&&a++;if(0!==(b-a)%4)return null;for(var f=0,d=b;1<d&&0>=e.IA_$LI$()[c[--d].charCodeAt(0)];)61==function(a){return null==a.charCodeAt?a:a.charCodeAt(0)}(c[d])&&f++;for(var b=(6*(b-a)>>3)-f,a=function(a){for(var b=
|
||||
|
|
24
src/main/webapp/js/viewer.min.js
vendored
24
src/main/webapp/js/viewer.min.js
vendored
|
@ -2135,7 +2135,7 @@ a.clone();f.style="";var b=d.getCellStyle(f);a=[];var f=[],g;for(g in c.style)b[
|
|||
this.clearDefaultStyle=function(){d.currentEdgeStyle=mxUtils.clone(d.defaultEdgeStyle);d.currentVertexStyle=mxUtils.clone(d.defaultVertexStyle);this.fireEvent(new mxEventObject("styleChanged","keys",[],"values",[],"cells",[]))};var E=["fontFamily","fontSize","fontColor"],G="edgeStyle startArrow startFill startSize endArrow endFill endSize".split(" "),D=["startArrow startFill startSize sourcePerimeterSpacing endArrow endFill endSize targetPerimeterSpacing".split(" "),["strokeColor","strokeWidth"],
|
||||
["fillColor","gradientColor"],E,["opacity"],["align"],["html"]];for(a=0;a<D.length;a++)for(b=0;b<D[a].length;b++)A.push(D[a][b]);for(a=0;a<x.length;a++)0>mxUtils.indexOf(A,x[a])&&A.push(x[a]);var J=function(a,c){var f=d.getModel();f.beginUpdate();try{for(var b=0;b<a.length;b++){var g=a[b],e;if(c)e=["fontSize","fontFamily","fontColor"];else{var m=f.getStyle(g),p=null!=m?m.split(";"):[];e=A.slice();for(var n=0;n<p.length;n++){var u=p[n],t=u.indexOf("=");if(0<=t){var y=u.substring(0,t),v=mxUtils.indexOf(e,
|
||||
y);0<=v&&e.splice(v,1);for(var l=0;l<D.length;l++){var k=D[l];if(0<=mxUtils.indexOf(k,y))for(var B=0;B<k.length;B++){var q=mxUtils.indexOf(e,k[B]);0<=q&&e.splice(q,1)}}}}}for(var F=f.isEdge(g),C=F?d.currentEdgeStyle:d.currentVertexStyle,E=f.getStyle(g),n=0;n<e.length;n++){var y=e[n],G=C[y];null==G||"shape"==y&&!F||F&&!(0>mxUtils.indexOf(x,y))||(E=mxUtils.setStyle(E,y,G))}f.setStyle(g,E)}}finally{f.endUpdate()}};d.addListener("cellsInserted",function(a,c){J(c.getProperty("cells"))});d.addListener("textInserted",
|
||||
function(a,c){J(c.getProperty("cells"),!0)});d.connectionHandler.addListener(mxEvent.CONNECT,function(a,c){var f=[c.getProperty("cell")];c.getProperty("terminalInserted")&&f.push(c.getProperty("terminal"));J(f)});this.addListener("styleChanged",mxUtils.bind(this,function(a,c){var f=c.getProperty("cells"),b=!1,g=!1;if(0<f.length)for(var e=0;e<f.length&&(b=d.getModel().isVertex(f[e])||b,!(g=d.getModel().isEdge(f[e])||g)||!b);e++);else g=b=!0;for(var f=c.getProperty("keys"),m=c.getProperty("values"),
|
||||
function(a,c){J(c.getProperty("cells"),!0)});d.connectionHandler.addListener(mxEvent.CONNECT,function(a,c){var d=[c.getProperty("cell")];c.getProperty("terminalInserted")&&d.push(c.getProperty("terminal"));J(d)});this.addListener("styleChanged",mxUtils.bind(this,function(a,c){var f=c.getProperty("cells"),b=!1,g=!1;if(0<f.length)for(var e=0;e<f.length&&(b=d.getModel().isVertex(f[e])||b,!(g=d.getModel().isEdge(f[e])||g)||!b);e++);else g=b=!0;for(var f=c.getProperty("keys"),m=c.getProperty("values"),
|
||||
e=0;e<f.length;e++){var p=0<=mxUtils.indexOf(E,f[e]);if("strokeColor"!=f[e]||null!=m[e]&&"none"!=m[e])if(0<=mxUtils.indexOf(x,f[e]))g||0<=mxUtils.indexOf(G,f[e])?null==m[e]?delete d.currentEdgeStyle[f[e]]:d.currentEdgeStyle[f[e]]=m[e]:b&&0<=mxUtils.indexOf(A,f[e])&&(null==m[e]?delete d.currentVertexStyle[f[e]]:d.currentVertexStyle[f[e]]=m[e]);else if(0<=mxUtils.indexOf(A,f[e])){if(b||p)null==m[e]?delete d.currentVertexStyle[f[e]]:d.currentVertexStyle[f[e]]=m[e];if(g||p||0<=mxUtils.indexOf(G,f[e]))null==
|
||||
m[e]?delete d.currentEdgeStyle[f[e]]:d.currentEdgeStyle[f[e]]=m[e]}}null!=this.toolbar&&(this.toolbar.setFontName(d.currentVertexStyle.fontFamily||Menus.prototype.defaultFont),this.toolbar.setFontSize(d.currentVertexStyle.fontSize||Menus.prototype.defaultFontSize),null!=this.toolbar.edgeStyleMenu&&(this.toolbar.edgeStyleMenu.getElementsByTagName("div")[0].className="orthogonalEdgeStyle"==d.currentEdgeStyle.edgeStyle&&"1"==d.currentEdgeStyle.curved?"geSprite geSprite-curved":"straight"==d.currentEdgeStyle.edgeStyle||
|
||||
"none"==d.currentEdgeStyle.edgeStyle||null==d.currentEdgeStyle.edgeStyle?"geSprite geSprite-straight":"entityRelationEdgeStyle"==d.currentEdgeStyle.edgeStyle?"geSprite geSprite-entity":"elbowEdgeStyle"==d.currentEdgeStyle.edgeStyle?"geSprite geSprite-"+("vertical"==d.currentEdgeStyle.elbow?"verticalelbow":"horizontalelbow"):"isometricEdgeStyle"==d.currentEdgeStyle.edgeStyle?"geSprite geSprite-"+("vertical"==d.currentEdgeStyle.elbow?"verticalisometric":"horizontalisometric"):"geSprite geSprite-orthogonal"),
|
||||
|
@ -2406,8 +2406,8 @@ this.graph.getCellGeometry(n[k]),F=g.width-p.x-p.width,u=u.clone();u.width=u.wid
|
|||
(function(){var a=mxGraphView.prototype.resetValidationState;mxGraphView.prototype.resetValidationState=function(){a.apply(this,arguments);this.validEdges=[]};var b=mxGraphView.prototype.validateCellState;mxGraphView.prototype.validateCellState=function(a,c){c=null!=c?c:!0;var f=this.getState(a);null!=f&&c&&this.graph.model.isEdge(f.cell)&&null!=f.style&&1!=f.style[mxConstants.STYLE_CURVED]&&!f.invalid&&this.updateLineJumps(f)&&this.graph.cellRenderer.redraw(f,!1,this.isRendering());f=b.apply(this,
|
||||
arguments);null!=f&&c&&this.graph.model.isEdge(f.cell)&&null!=f.style&&1!=f.style[mxConstants.STYLE_CURVED]&&this.validEdges.push(f);return f};var e=mxCellRenderer.prototype.isShapeInvalid;mxCellRenderer.prototype.isShapeInvalid=function(a,c){return e.apply(this,arguments)||null!=a.routedPoints&&null!=c.routedPoints&&!mxUtils.equalPoints(c.routedPoints,a.routedPoints)};var d=mxGraphView.prototype.updateCellState;mxGraphView.prototype.updateCellState=function(a){d.apply(this,arguments);this.graph.model.isEdge(a.cell)&&
|
||||
1!=a.style[mxConstants.STYLE_CURVED]&&this.updateLineJumps(a)};mxGraphView.prototype.updateLineJumps=function(a){var c=a.absolutePoints;if(Graph.lineJumpsEnabled){var f=null!=a.routedPoints,d=null;if(null!=c&&null!=this.validEdges&&"none"!==mxUtils.getValue(a.style,"jumpStyle","none")){for(var b=function(c,f,b){var e=new mxPoint(f,b);e.type=c;d.push(e);e=null!=a.routedPoints?a.routedPoints[d.length-1]:null;return null==e||e.type!=c||e.x!=f||e.y!=b},e=.5*this.scale,f=!1,d=[],t=0;t<c.length-1;t++){for(var u=
|
||||
c[t+1],k=c[t],l=[],q=c[t+2];t<c.length-2&&mxUtils.ptSegDistSq(k.x,k.y,q.x,q.y,u.x,u.y)<1*this.scale*this.scale;)u=q,t++,q=c[t+2];for(var f=b(0,k.x,k.y)||f,A=0;A<this.validEdges.length;A++){var x=this.validEdges[A],E=x.absolutePoints;if(null!=E&&mxUtils.intersects(a,x)&&"1"!=x.style.noJump)for(x=0;x<E.length-1;x++){for(var G=E[x+1],D=E[x],q=E[x+2];x<E.length-2&&mxUtils.ptSegDistSq(D.x,D.y,q.x,q.y,G.x,G.y)<1*this.scale*this.scale;)G=q,x++,q=E[x+2];q=mxUtils.intersection(k.x,k.y,u.x,u.y,D.x,D.y,G.x,
|
||||
G.y);if(null!=q&&(Math.abs(q.x-k.x)>e||Math.abs(q.y-k.y)>e)&&(Math.abs(q.x-u.x)>e||Math.abs(q.y-u.y)>e)&&(Math.abs(q.x-D.x)>e||Math.abs(q.y-D.y)>e)&&(Math.abs(q.x-G.x)>e||Math.abs(q.y-G.y)>e)){G=q.x-k.x;D=q.y-k.y;q={distSq:G*G+D*D,x:q.x,y:q.y};for(G=0;G<l.length;G++)if(l[G].distSq>q.distSq){l.splice(G,0,q);q=null;break}null==q||0!=l.length&&l[l.length-1].x===q.x&&l[l.length-1].y===q.y||l.push(q)}}}for(x=0;x<l.length;x++)f=b(1,l[x].x,l[x].y)||f}q=c[c.length-1];f=b(0,q.x,q.y)||f}a.routedPoints=d;return f}return!1};
|
||||
c[t+1],l=c[t],k=[],q=c[t+2];t<c.length-2&&mxUtils.ptSegDistSq(l.x,l.y,q.x,q.y,u.x,u.y)<1*this.scale*this.scale;)u=q,t++,q=c[t+2];for(var f=b(0,l.x,l.y)||f,A=0;A<this.validEdges.length;A++){var x=this.validEdges[A],E=x.absolutePoints;if(null!=E&&mxUtils.intersects(a,x)&&"1"!=x.style.noJump)for(x=0;x<E.length-1;x++){for(var G=E[x+1],D=E[x],q=E[x+2];x<E.length-2&&mxUtils.ptSegDistSq(D.x,D.y,q.x,q.y,G.x,G.y)<1*this.scale*this.scale;)G=q,x++,q=E[x+2];q=mxUtils.intersection(l.x,l.y,u.x,u.y,D.x,D.y,G.x,
|
||||
G.y);if(null!=q&&(Math.abs(q.x-l.x)>e||Math.abs(q.y-l.y)>e)&&(Math.abs(q.x-u.x)>e||Math.abs(q.y-u.y)>e)&&(Math.abs(q.x-D.x)>e||Math.abs(q.y-D.y)>e)&&(Math.abs(q.x-G.x)>e||Math.abs(q.y-G.y)>e)){G=q.x-l.x;D=q.y-l.y;q={distSq:G*G+D*D,x:q.x,y:q.y};for(G=0;G<k.length;G++)if(k[G].distSq>q.distSq){k.splice(G,0,q);q=null;break}null==q||0!=k.length&&k[k.length-1].x===q.x&&k[k.length-1].y===q.y||k.push(q)}}}for(x=0;x<k.length;x++)f=b(1,k[x].x,k[x].y)||f}q=c[c.length-1];f=b(0,q.x,q.y)||f}a.routedPoints=d;return f}return!1};
|
||||
var k=mxConnector.prototype.paintLine;mxConnector.prototype.paintLine=function(a,c,d){this.routedPoints=null!=this.state?this.state.routedPoints:null;if(this.outline||null==this.state||null==this.style||null==this.state.routedPoints||0==this.state.routedPoints.length)k.apply(this,arguments);else{var f=mxUtils.getValue(this.style,mxConstants.STYLE_ARCSIZE,mxConstants.LINE_ARCSIZE)/2,b=(parseInt(mxUtils.getValue(this.style,"jumpSize",Graph.defaultJumpSize))-2)/2+this.strokewidth,e=mxUtils.getValue(this.style,
|
||||
"jumpStyle","none"),g=!0,p=null,l=null,q=[],C=null;a.begin();for(var A=0;A<this.state.routedPoints.length;A++){var x=this.state.routedPoints[A],E=new mxPoint(x.x/this.scale,x.y/this.scale);0==A?E=c[0]:A==this.state.routedPoints.length-1&&(E=c[c.length-1]);var G=!1;if(null!=p&&1==x.type){var D=this.state.routedPoints[A+1],x=D.x/this.scale-E.x,D=D.y/this.scale-E.y,x=x*x+D*D;null==C&&(C=new mxPoint(E.x-p.x,E.y-p.y),l=Math.sqrt(C.x*C.x+C.y*C.y),0<l?(C.x=C.x*b/l,C.y=C.y*b/l):C=null);x>b*b&&0<l&&(x=p.x-
|
||||
E.x,D=p.y-E.y,x=x*x+D*D,x>b*b&&(G=new mxPoint(E.x-C.x,E.y-C.y),x=new mxPoint(E.x+C.x,E.y+C.y),q.push(G),this.addPoints(a,q,d,f,!1,null,g),q=0>Math.round(C.x)||0==Math.round(C.x)&&0>=Math.round(C.y)?1:-1,g=!1,"sharp"==e?(a.lineTo(G.x-C.y*q,G.y+C.x*q),a.lineTo(x.x-C.y*q,x.y+C.x*q),a.lineTo(x.x,x.y)):"arc"==e?(q*=1.3,a.curveTo(G.x-C.y*q,G.y+C.x*q,x.x-C.y*q,x.y+C.x*q,x.x,x.y)):(a.moveTo(x.x,x.y),g=!0),q=[x],G=!0))}else C=null;G||(q.push(E),p=E)}this.addPoints(a,q,d,f,!1,null,g);a.stroke()}};var l=mxGraphView.prototype.updateFloatingTerminalPoint;
|
||||
|
@ -2472,8 +2472,8 @@ c.x-f.x:c.y-f.y});g=this.view.translate;m=this.view.scale;d=d/m-(a?g.x:g.y);b=b/
|
|||
function(a){return mxClient.IS_MAC&&mxEvent.isMetaDown(a)||mxEvent.isControlDown(a)};Graph.prototype.createSvgImageExport=function(){var a=new mxImageExport;a.getLinkForCellState=mxUtils.bind(this,function(a,c){return this.getLinkForCell(a.cell)});return a};Graph.prototype.getSvg=function(a,c,f,b,d,e,g,m,p,n){var u=this.useCssTransforms;u&&(this.useCssTransforms=!1,this.view.revalidate(),this.sizeDidChange());try{c=null!=c?c:1;f=null!=f?f:0;d=null!=d?d:!0;e=null!=e?e:!0;g=null!=g?g:!0;var y=e||b?
|
||||
this.getGraphBounds():this.getBoundingBox(this.getSelectionCells());if(null==y)throw Error(mxResources.get("drawingEmpty"));var t=this.view.scale,z=mxUtils.createXmlDocument(),l=null!=z.createElementNS?z.createElementNS(mxConstants.NS_SVG,"svg"):z.createElement("svg");null!=a&&(null!=l.style?l.style.backgroundColor=a:l.setAttribute("style","background-color:"+a));null==z.createElementNS?(l.setAttribute("xmlns",mxConstants.NS_SVG),l.setAttribute("xmlns:xlink",mxConstants.NS_XLINK)):l.setAttributeNS("http://www.w3.org/2000/xmlns/",
|
||||
"xmlns:xlink",mxConstants.NS_XLINK);a=c/t;var v=Math.max(1,Math.ceil(y.width*a)+2*f)+(n?5:0),k=Math.max(1,Math.ceil(y.height*a)+2*f)+(n?5:0);l.setAttribute("version","1.1");l.setAttribute("width",v+"px");l.setAttribute("height",k+"px");l.setAttribute("viewBox",(d?"-0.5 -0.5":"0 0")+" "+v+" "+k);z.appendChild(l);var K=null!=z.createElementNS?z.createElementNS(mxConstants.NS_SVG,"g"):z.createElement("g");l.appendChild(K);var L=this.createSvgCanvas(K);L.foOffset=d?-.5:0;L.textOffset=d?-.5:0;L.imageOffset=
|
||||
d?-.5:0;L.translate(Math.floor((f/c-y.x)/t),Math.floor((f/c-y.y)/t));var q=document.createElement("div"),x=L.getAlternateText;L.getAlternateText=function(a,c,f,b,d,e,g,m,p,n,u,y,ia){if(null!=e&&0<this.state.fontSize)try{mxUtils.isNode(e)?e=e.innerText:(q.innerHTML=e,e=mxUtils.extractTextWithWhitespace(q.childNodes));for(var Na=Math.ceil(2*b/this.state.fontSize),t=[],La=0,z=0;(0==Na||La<Na)&&z<e.length;){var l=e.charCodeAt(z);if(10==l||13==l){if(0<La)break}else t.push(e.charAt(z)),255>l&&La++;z++}t.length<
|
||||
e.length&&1<e.length-t.length&&(e=mxUtils.trim(t.join(""))+"...");return e}catch(Ua){return x.apply(this,arguments)}else return x.apply(this,arguments)};var P=this.backgroundImage;if(null!=P){c=t/c;var H=this.view.translate,B=new mxRectangle(H.x*c,H.y*c,P.width*c,P.height*c);mxUtils.intersects(y,B)&&L.image(H.x,H.y,P.width,P.height,P.src,!0)}L.scale(a);L.textEnabled=g;m=null!=m?m:this.createSvgImageExport();var M=m.drawCellState,F=m.getLinkForCellState;m.getLinkForCellState=function(a,c){var f=F.apply(this,
|
||||
d?-.5:0;L.translate(Math.floor((f/c-y.x)/t),Math.floor((f/c-y.y)/t));var x=document.createElement("div"),q=L.getAlternateText;L.getAlternateText=function(a,c,f,b,d,e,g,m,p,n,u,y,ia){if(null!=e&&0<this.state.fontSize)try{mxUtils.isNode(e)?e=e.innerText:(x.innerHTML=e,e=mxUtils.extractTextWithWhitespace(x.childNodes));for(var Na=Math.ceil(2*b/this.state.fontSize),t=[],La=0,z=0;(0==Na||La<Na)&&z<e.length;){var l=e.charCodeAt(z);if(10==l||13==l){if(0<La)break}else t.push(e.charAt(z)),255>l&&La++;z++}t.length<
|
||||
e.length&&1<e.length-t.length&&(e=mxUtils.trim(t.join(""))+"...");return e}catch(Ua){return q.apply(this,arguments)}else return q.apply(this,arguments)};var P=this.backgroundImage;if(null!=P){c=t/c;var H=this.view.translate,B=new mxRectangle(H.x*c,H.y*c,P.width*c,P.height*c);mxUtils.intersects(y,B)&&L.image(H.x,H.y,P.width,P.height,P.src,!0)}L.scale(a);L.textEnabled=g;m=null!=m?m:this.createSvgImageExport();var M=m.drawCellState,F=m.getLinkForCellState;m.getLinkForCellState=function(a,c){var f=F.apply(this,
|
||||
arguments);return null==f||a.view.graph.isCustomLink(f)?null:f};m.drawCellState=function(a,c){for(var f=a.view.graph,b=f.isCellSelected(a.cell),d=f.model.getParent(a.cell);!e&&!b&&null!=d;)b=f.isCellSelected(d),d=f.model.getParent(d);(e||b)&&M.apply(this,arguments)};m.drawState(this.getView().getState(this.model.root),L);this.updateSvgLinks(l,p,!0);this.addForeignObjectWarning(L,l);return l}finally{u&&(this.useCssTransforms=!0,this.view.revalidate(),this.sizeDidChange())}};Graph.prototype.addForeignObjectWarning=
|
||||
function(a,c){if(0<c.getElementsByTagName("foreignObject").length){var f=a.createElement("switch"),b=a.createElement("g");b.setAttribute("requiredFeatures","http://www.w3.org/TR/SVG11/feature#Extensibility");var d=a.createElement("a");d.setAttribute("transform","translate(0,-5)");null==d.setAttributeNS||c.ownerDocument!=document&&null==document.documentMode?(d.setAttribute("xlink:href",Graph.foreignObjectWarningLink),d.setAttribute("target","_blank")):(d.setAttributeNS(mxConstants.NS_XLINK,"xlink:href",
|
||||
Graph.foreignObjectWarningLink),d.setAttributeNS(mxConstants.NS_XLINK,"target","_blank"));var e=a.createElement("text");e.setAttribute("text-anchor","middle");e.setAttribute("font-size","10px");e.setAttribute("x","50%");e.setAttribute("y","100%");mxUtils.write(e,Graph.foreignObjectWarningText);f.appendChild(b);d.appendChild(e);f.appendChild(d);c.appendChild(f)}};Graph.prototype.updateSvgLinks=function(a,c,f){a=a.getElementsByTagName("a");for(var b=0;b<a.length;b++){var d=a[b].getAttribute("href");
|
||||
|
@ -2793,10 +2793,10 @@ b.fireEvent(new mxEventObject("styleChanged","keys",[mxConstants.STYLE_DASHED,mx
|
|||
d.getSelectionCells()))}finally{d.getModel().endUpdate()}});this.addAction("sharp",function(){d.getModel().beginUpdate();try{d.setCellStyles(mxConstants.STYLE_ROUNDED,"0"),d.setCellStyles(mxConstants.STYLE_CURVED,"0"),b.fireEvent(new mxEventObject("styleChanged","keys",[mxConstants.STYLE_ROUNDED,mxConstants.STYLE_CURVED],"values",["0","0"],"cells",d.getSelectionCells()))}finally{d.getModel().endUpdate()}});this.addAction("rounded",function(){d.getModel().beginUpdate();try{d.setCellStyles(mxConstants.STYLE_ROUNDED,
|
||||
"1"),d.setCellStyles(mxConstants.STYLE_CURVED,"0"),b.fireEvent(new mxEventObject("styleChanged","keys",[mxConstants.STYLE_ROUNDED,mxConstants.STYLE_CURVED],"values",["1","0"],"cells",d.getSelectionCells()))}finally{d.getModel().endUpdate()}});this.addAction("toggleRounded",function(){if(!d.isSelectionEmpty()&&d.isEnabled()){d.getModel().beginUpdate();try{var a=d.getSelectionCells(),f=d.getCurrentCellStyle(a[0]),e="1"==mxUtils.getValue(f,mxConstants.STYLE_ROUNDED,"0")?"0":"1";d.setCellStyles(mxConstants.STYLE_ROUNDED,
|
||||
e);d.setCellStyles(mxConstants.STYLE_CURVED,null);b.fireEvent(new mxEventObject("styleChanged","keys",[mxConstants.STYLE_ROUNDED,mxConstants.STYLE_CURVED],"values",[e,"0"],"cells",d.getSelectionCells()))}finally{d.getModel().endUpdate()}}});this.addAction("curved",function(){d.getModel().beginUpdate();try{d.setCellStyles(mxConstants.STYLE_ROUNDED,"0"),d.setCellStyles(mxConstants.STYLE_CURVED,"1"),b.fireEvent(new mxEventObject("styleChanged","keys",[mxConstants.STYLE_ROUNDED,mxConstants.STYLE_CURVED],
|
||||
"values",["0","1"],"cells",d.getSelectionCells()))}finally{d.getModel().endUpdate()}});this.addAction("collapsible",function(){var a=d.view.getState(d.getSelectionCell()),f="1";null!=a&&null!=d.getFoldingImage(a)&&(f="0");d.setCellStyles("collapsible",f);b.fireEvent(new mxEventObject("styleChanged","keys",["collapsible"],"values",[f],"cells",d.getSelectionCells()))});this.addAction("editStyle...",mxUtils.bind(this,function(){var a=d.getSelectionCells();if(null!=a&&0<a.length){var f=d.getModel(),f=
|
||||
new TextareaDialog(this.editorUi,mxResources.get("editStyle")+":",f.getStyle(a[0])||"",function(c){null!=c&&d.setCellStyle(mxUtils.trim(c),a)},null,null,400,220);this.editorUi.showDialog(f.container,420,300,!0,!0);f.init()}}),null,null,Editor.ctrlKey+"+E");this.addAction("setAsDefaultStyle",function(){d.isEnabled()&&!d.isSelectionEmpty()&&b.setDefaultStyle(d.getSelectionCell())},null,null,Editor.ctrlKey+"+Shift+D");this.addAction("clearDefaultStyle",function(){d.isEnabled()&&b.clearDefaultStyle()},
|
||||
null,null,Editor.ctrlKey+"+Shift+R");this.addAction("addWaypoint",function(){var a=d.getSelectionCell();if(null!=a&&d.getModel().isEdge(a)){var f=e.graph.selectionCellsHandler.getHandler(a);if(f instanceof mxEdgeHandler){for(var b=d.view.translate,p=d.view.scale,m=b.x,b=b.y,a=d.getModel().getParent(a),n=d.getCellGeometry(a);d.getModel().isVertex(a)&&null!=n;)m+=n.x,b+=n.y,a=d.getModel().getParent(a),n=d.getCellGeometry(a);m=Math.round(d.snap(d.popupMenuHandler.triggerX/p-m));p=Math.round(d.snap(d.popupMenuHandler.triggerY/
|
||||
p-b));f.addPointAt(f.state,m,p)}}});this.addAction("removeWaypoint",function(){var a=b.actions.get("removeWaypoint");null!=a.handler&&a.handler.removePoint(a.handler.state,a.index)});this.addAction("clearWaypoints",function(){var a=d.getSelectionCells();if(null!=a){a=d.addAllEdges(a);d.getModel().beginUpdate();try{for(var b=0;b<a.length;b++){var e=a[b];if(d.getModel().isEdge(e)){var p=d.getCellGeometry(e);null!=p&&(p=p.clone(),p.points=null,d.getModel().setGeometry(e,p))}}}finally{d.getModel().endUpdate()}}},
|
||||
"values",["0","1"],"cells",d.getSelectionCells()))}finally{d.getModel().endUpdate()}});this.addAction("collapsible",function(){var a=d.view.getState(d.getSelectionCell()),f="1";null!=a&&null!=d.getFoldingImage(a)&&(f="0");d.setCellStyles("collapsible",f);b.fireEvent(new mxEventObject("styleChanged","keys",["collapsible"],"values",[f],"cells",d.getSelectionCells()))});this.addAction("editStyle...",mxUtils.bind(this,function(){var a=d.getSelectionCells();if(null!=a&&0<a.length){var b=d.getModel(),b=
|
||||
new TextareaDialog(this.editorUi,mxResources.get("editStyle")+":",b.getStyle(a[0])||"",function(c){null!=c&&d.setCellStyle(mxUtils.trim(c),a)},null,null,400,220);this.editorUi.showDialog(b.container,420,300,!0,!0);b.init()}}),null,null,Editor.ctrlKey+"+E");this.addAction("setAsDefaultStyle",function(){d.isEnabled()&&!d.isSelectionEmpty()&&b.setDefaultStyle(d.getSelectionCell())},null,null,Editor.ctrlKey+"+Shift+D");this.addAction("clearDefaultStyle",function(){d.isEnabled()&&b.clearDefaultStyle()},
|
||||
null,null,Editor.ctrlKey+"+Shift+R");this.addAction("addWaypoint",function(){var a=d.getSelectionCell();if(null!=a&&d.getModel().isEdge(a)){var b=e.graph.selectionCellsHandler.getHandler(a);if(b instanceof mxEdgeHandler){for(var g=d.view.translate,p=d.view.scale,m=g.x,g=g.y,a=d.getModel().getParent(a),n=d.getCellGeometry(a);d.getModel().isVertex(a)&&null!=n;)m+=n.x,g+=n.y,a=d.getModel().getParent(a),n=d.getCellGeometry(a);m=Math.round(d.snap(d.popupMenuHandler.triggerX/p-m));p=Math.round(d.snap(d.popupMenuHandler.triggerY/
|
||||
p-g));b.addPointAt(b.state,m,p)}}});this.addAction("removeWaypoint",function(){var a=b.actions.get("removeWaypoint");null!=a.handler&&a.handler.removePoint(a.handler.state,a.index)});this.addAction("clearWaypoints",function(){var a=d.getSelectionCells();if(null!=a){a=d.addAllEdges(a);d.getModel().beginUpdate();try{for(var b=0;b<a.length;b++){var e=a[b];if(d.getModel().isEdge(e)){var p=d.getCellGeometry(e);null!=p&&(p=p.clone(),p.points=null,d.getModel().setGeometry(e,p))}}}finally{d.getModel().endUpdate()}}},
|
||||
null,null,"Alt+Shift+C");l=this.addAction("subscript",mxUtils.bind(this,function(){d.cellEditor.isContentEditing()&&document.execCommand("subscript",!1,null)}),null,null,Editor.ctrlKey+"+,");l=this.addAction("superscript",mxUtils.bind(this,function(){d.cellEditor.isContentEditing()&&document.execCommand("superscript",!1,null)}),null,null,Editor.ctrlKey+"+.");l=this.addAction("indent",mxUtils.bind(this,function(){d.cellEditor.isContentEditing()&&document.execCommand("indent",!1,null)}),null,null,"Shift+Tab");
|
||||
this.addAction("image...",function(){if(d.isEnabled()&&!d.isCellLocked(d.getDefaultParent())){var a=mxResources.get("image")+" ("+mxResources.get("url")+"):",f=d.getView().getState(d.getSelectionCell()),e="";null!=f&&(e=f.style[mxConstants.STYLE_IMAGE]||e);var p=d.cellEditor.saveSelection();b.showImageDialog(a,e,function(a,c,b){if(d.cellEditor.isContentEditing())d.cellEditor.restoreSelection(p),d.insertImage(a,c,b);else{var f=d.getSelectionCells();if(null!=a&&(0<a.length||0<f.length)){var e=null;
|
||||
d.getModel().beginUpdate();try{if(0==f.length){var g=d.getFreeInsertPoint(),e=f=[d.insertVertex(d.getDefaultParent(),null,"",g.x,g.y,c,b,"shape=image;imageAspect=0;aspect=fixed;verticalLabelPosition=bottom;verticalAlign=top;")];d.fireEvent(new mxEventObject("cellsInserted","cells",e))}d.setCellStyles(mxConstants.STYLE_IMAGE,0<a.length?a:null,f);var m=d.getCurrentCellStyle(f[0]);"image"!=m[mxConstants.STYLE_SHAPE]&&"label"!=m[mxConstants.STYLE_SHAPE]?d.setCellStyles(mxConstants.STYLE_SHAPE,"image",
|
||||
|
@ -2863,9 +2863,9 @@ DrawioFile.prototype.handleConflictError=function(a,b){var e=mxUtils.bind(this,f
|
|||
this.synchronizeFile(mxUtils.bind(this,function(){this.ui.spinner.stop();this.ui.spinner.spin(document.body,mxResources.get("saving"))&&this.save(!0,e,d,null,null,this.constructor!=GitHubFile&&this.constructor!=GitLabFile||null==a?null:a.commitMessage)}),d)});"none"==DrawioFile.SYNC?this.showCopyDialog(e,d,k):this.invalidChecksum?this.showRefreshDialog(e,d,this.getErrorMessage(a)):b?this.showConflictDialog(k,l):this.addConflictStatus(mxUtils.bind(this,function(){this.ui.editor.setStatus(mxUtils.htmlEntities(mxResources.get("updatingDocument")));
|
||||
this.synchronizeFile(e,d)}),this.getErrorMessage(a))};DrawioFile.prototype.getErrorMessage=function(a){return null!=a?null!=a.error?a.error.message:a.message:null};DrawioFile.prototype.isOverdue=function(){return null!=this.ageStart&&Date.now()-this.ageStart.getTime()>=this.ui.warnInterval};
|
||||
DrawioFile.prototype.fileChanged=function(){this.lastChanged=new Date;this.setModified(!0);this.isAutosave()?(this.addAllSavedStatus(mxUtils.htmlEntities(mxResources.get("saving"))+"..."),this.ui.scheduleSanityCheck(),null==this.ageStart&&(this.ageStart=new Date),this.autosave(this.autosaveDelay,this.maxAutosaveDelay,mxUtils.bind(this,function(a){this.ui.stopSanityCheck();null==this.autosaveThread?(this.handleFileSuccess(!0),this.ageStart=null):this.isModified()&&(this.ui.scheduleSanityCheck(),this.ageStart=
|
||||
this.lastChanged)}),mxUtils.bind(this,function(a){this.handleFileError(a)}))):(this.ageStart=null,this.isAutosaveOptional()&&this.ui.editor.autosave||this.inConflictState||this.addUnsavedStatus())};
|
||||
DrawioFile.prototype.fileSaved=function(a,b,e,d){this.lastSaved=new Date;this.ageStart=null;try{this.stats.saved++,this.invalidChecksum=this.inConflictState=!1,null==this.sync?(this.shadowData=a,this.shadowPages=null,null!=e&&e()):this.sync.fileSaved(this.ui.getPagesForNode(mxUtils.parseXml(a).documentElement),b,e,d,a)}catch(q){this.invalidChecksum=this.inConflictState=!0;this.descriptorChanged();null!=d&&d(q);try{if(this.errorReportsEnabled)this.sendErrorReport("Error in fileSaved",null,q);else{var k=
|
||||
this.getCurrentUser(),l=null!=k?k.id:"unknown";EditorUi.logError("Error in fileSaved",null,this.getMode()+"."+this.getId(),l,q)}}catch(c){}}};
|
||||
this.lastChanged)}),mxUtils.bind(this,function(a){this.handleFileError(a)}))):(this.ageStart=null,this.isAutosaveOptional()&&this.ui.editor.autosave||this.inConflictState||this.addUnsavedStatus())};DrawioFile.prototype.createSecret=function(a,b){var e=Editor.guid(32);null!=this.sync?this.sync.createToken(e,mxUtils.bind(this,function(b){a(e,b)}),b):a(e)};
|
||||
DrawioFile.prototype.fileSaved=function(a,b,e,d,k){this.lastSaved=new Date;this.ageStart=null;try{this.stats.saved++,this.invalidChecksum=this.inConflictState=!1,null==this.sync?(this.shadowData=a,this.shadowPages=null,null!=e&&e()):this.sync.fileSaved(this.ui.getPagesForNode(mxUtils.parseXml(a).documentElement),b,e,d,k)}catch(c){this.invalidChecksum=this.inConflictState=!0;this.descriptorChanged();null!=d&&d(c);try{if(this.errorReportsEnabled)this.sendErrorReport("Error in fileSaved",null,c);else{var l=
|
||||
this.getCurrentUser(),q=null!=l?l.id:"unknown";EditorUi.logError("Error in fileSaved",null,this.getMode()+"."+this.getId(),q,c)}}catch(f){}}};
|
||||
DrawioFile.prototype.autosave=function(a,b,e,d){null==this.lastAutosave&&(this.lastAutosave=Date.now());a=Date.now()-this.lastAutosave<b?a:0;this.clearAutosave();var k=window.setTimeout(mxUtils.bind(this,function(){this.lastAutosave=null;this.autosaveThread==k&&(this.autosaveThread=null);if(this.isModified()&&this.isAutosaveNow()){var a=this.isAutosaveRevision();a&&(this.lastAutosaveRevision=(new Date).getTime());this.save(a,mxUtils.bind(this,function(a){this.autosaveCompleted();null!=e&&e(a)}),mxUtils.bind(this,
|
||||
function(a){null!=d&&d(a)}))}else this.isModified()||this.ui.editor.setStatus(""),null!=e&&e(null)}),a);this.autosaveThread=k};DrawioFile.prototype.isAutosaveNow=function(){return!0};DrawioFile.prototype.autosaveCompleted=function(){};DrawioFile.prototype.clearAutosave=function(){null!=this.autosaveThread&&(window.clearTimeout(this.autosaveThread),this.autosaveThread=null)};
|
||||
DrawioFile.prototype.isAutosaveRevision=function(){var a=(new Date).getTime();return null==this.lastAutosaveRevision||a-this.lastAutosaveRevision>this.maxAutosaveRevisionDelay};DrawioFile.prototype.descriptorChanged=function(){this.fireEvent(new mxEventObject("descriptorChanged"))};DrawioFile.prototype.contentChanged=function(){this.fireEvent(new mxEventObject("contentChanged"))};
|
||||
|
|
|
@ -6,11 +6,11 @@ if (workbox)
|
|||
workbox.precaching.precacheAndRoute([
|
||||
{
|
||||
"url": "js/app.min.js",
|
||||
"revision": "1c47a0b7a4f9754e6cbc99c43bee74ce"
|
||||
"revision": "893a2614b11aec42f563c307818eac5c"
|
||||
},
|
||||
{
|
||||
"url": "js/extensions.min.js",
|
||||
"revision": "bb9d0447bf1eaeac1791a8ac4097e3ca"
|
||||
"revision": "befa93c9f4f16312a26fb8d5450061cd"
|
||||
},
|
||||
{
|
||||
"url": "js/stencils.min.js",
|
||||
|
|
Loading…
Reference in a new issue