Skip to content

Commit

Permalink
24.4.15 release
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgraph committed Jun 6, 2024
1 parent 728d214 commit edb8cd9
Show file tree
Hide file tree
Showing 22 changed files with 4,251 additions and 4,124 deletions.
7 changes: 7 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
06-JUN-2024: 24.4.15

- Fixes possible clipping in sidebar popup
- Enables saveAs for read-only files
- Fixes text editing position for insert layout dialog [drawio-4449]
- Adds start-/endFillColor styles for connectors [drawio-4438]

05-JUN-2024: 24.4.14

- Adds support for adaptive polling
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
24.4.14
24.4.15
3,647 changes: 1,825 additions & 1,822 deletions src/main/webapp/js/app.min.js

Large diffs are not rendered by default.

45 changes: 29 additions & 16 deletions src/main/webapp/js/diagramly/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2471,8 +2471,9 @@ App.prototype.updateDocumentTitle = function()
/**
* Returns a thumbnail of the current file.
*/
App.prototype.getThumbnail = function(width, fn)
App.prototype.getThumbnail = function(width, fn, border)
{
border = (border != null) ? border : 0;
var result = false;

try
Expand Down Expand Up @@ -2567,7 +2568,7 @@ App.prototype.getThumbnail = function(width, fn)
{
// Continues with null in error case
success();
}, null, null, null, null, null, null, graph, null, null, null,
}, null, null, null, null, null, null, graph, border, null, null,
null, 'diagram', null);

result = true;
Expand Down Expand Up @@ -3927,28 +3928,39 @@ App.prototype.loadFileSystemEntry = function(fileHandle, success, error)

reader.onload = mxUtils.bind(this, function(e)
{
try
var doSuccess = mxUtils.bind(this, function(editable)
{
if (success != null)
try
{
var data = e.target.result;

if (file.type == 'image/png')
if (success != null)
{
var data = e.target.result;

if (file.type == 'image/png')
{
data = this.extractGraphModelFromPng(data);
}

success(new LocalFile(this, data, file.name, null, fileHandle, file, editable));
}
else
{
data = this.extractGraphModelFromPng(data);
this.openFileHandle(e.target.result, file.name, file, false, fileHandle, editable);
}

success(new LocalFile(this, data, file.name, null, fileHandle, file));
}
else
catch(e)
{
this.openFileHandle(e.target.result, file.name, file, false, fileHandle);
error(e);
}
}
catch(e)
});

fileHandle.createWritable().then(mxUtils.bind(this, function(writable)
{
error(e);
}
doSuccess(true);
}), mxUtils.bind(this, function(e)
{
doSuccess(false);
}));
});

reader.onerror = error;
Expand Down Expand Up @@ -4566,6 +4578,7 @@ App.prototype.saveFile = function(forceDialog, success)
file.fileHandle = fileHandle;
file.title = desc.name;
file.desc = desc;
file.editable = null;
this.save(desc.name, done);
}), null, this.createFileSystemOptions(file.getTitle()));
}
Expand Down
109 changes: 57 additions & 52 deletions src/main/webapp/js/diagramly/Dialogs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1273,13 +1273,23 @@ var CreateGraphDialog = function(editorUi, title, type)
graph.view.setTranslate(20, 20);
graph.border = 20;
graph.panningHandler.useLeftButtonForPanning = true;

// Fixes in-place editor position
if (mxClient.IS_SVG && graph.view.getDrawPane() != null)
{
var root = graph.view.getDrawPane().ownerSVGElement;

if (root != null)
{
root.style.position = 'absolute';
}
}

var vertexStyle = 'rounded=1;';
var edgeStyle = 'curved=1;';
var startStyle = 'ellipse';

// FIXME: Does not work in iPad
var mxCellRendererInstallCellOverlayListeners = mxCellRenderer.prototype.installCellOverlayListeners;
graph.cellRenderer.installCellOverlayListeners = function(state, overlay, shape)
{
mxCellRenderer.prototype.installCellOverlayListeners.apply(this, arguments);
Expand Down Expand Up @@ -1338,7 +1348,7 @@ var CreateGraphDialog = function(editorUi, title, type)
v2 = graph.insertVertex(parent, null, 'Entry', geo.x, geo.y, 80, 30, vertexStyle);
addOverlay(v2);
graph.view.refresh(v2);
var e1 = graph.insertEdge(parent, null, '', cell, v2, edgeStyle);
graph.insertEdge(parent, null, '', cell, v2, edgeStyle);
}, function()
{
graph.scrollCellToVisible(v2);
Expand Down Expand Up @@ -3485,10 +3495,10 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc

function create()
{
if (templateXml == lastAiXml)
if (templateXml != null && templateXml == lastAiXml)
{
EditorUi.logEvent({category: 'OPENAI-DIAGRAM',
action: 'templateUsed',
action: 'templateGenerated',
label: lastAiTitle});
}

Expand Down Expand Up @@ -3834,7 +3844,7 @@ var NewDialog = function(editorUi, compact, showName, callback, createOnly, canc
editorUi.generateOpenAiMermaidDiagram(prompt,
function(mermaidData, imageData, w, h)
{
if (selectedElt == generateElt)
if (selectedElt == generateElt && generateInput.style.visibility == 'hidden')
{
generateBackground = 'url(' + 'data:image/svg+xml;base64,' +
imageData.substring(imageData.indexOf(',') + 1) + ')';
Expand Down Expand Up @@ -13310,63 +13320,58 @@ var FilePropertiesDialog = function(editorUi, publicLink)
}
};
};

var initialLocked = (file != null) ? file.isLocked() : false;

if (urlParams['test'] == '1')
{
var initialLocked = (file != null) ? file.isLocked() : false;

row = document.createElement('tr');
td = document.createElement('td');
td.style.whiteSpace = 'nowrap';
td.style.overflow = 'hidden';
td.style.textOverflow = 'ellipsis';
td.style.fontSize = '10pt';
row = document.createElement('tr');
td = document.createElement('td');
td.style.whiteSpace = 'nowrap';
td.style.overflow = 'hidden';
td.style.textOverflow = 'ellipsis';
td.style.fontSize = '10pt';

// TODO: Use mxResources.get('locked')
mxUtils.write(td, 'Locked' + ':');

row.appendChild(td);
mxUtils.write(td, mxResources.get('locked') + ':');
row.appendChild(td);

var lockedInput = document.createElement('input');
lockedInput.setAttribute('type', 'checkbox');
if (initialLocked)
{
lockedInput.setAttribute('checked', 'checked');
lockedInput.defaultChecked = true;
}
td = document.createElement('td');
td.style.whiteSpace = 'nowrap';
td.appendChild(lockedInput);
row.appendChild(td);
tbody.appendChild(row);
var lockedInput = document.createElement('input');
lockedInput.setAttribute('type', 'checkbox');

if (initialLocked)
{
lockedInput.setAttribute('checked', 'checked');
lockedInput.defaultChecked = true;
}

td = document.createElement('td');
td.style.whiteSpace = 'nowrap';
td.appendChild(lockedInput);
row.appendChild(td);
tbody.appendChild(row);

this.init = function()
{
lockedInput.focus();
};
this.init = function()
{
lockedInput.focus();
};

addApply(function(success, error)
addApply(function(success, error)
{
if (editorUi.fileNode != null && initialLocked != lockedInput.checked)
{
if (editorUi.fileNode != null && initialLocked != lockedInput.checked)
window.setTimeout(function()
{
window.setTimeout(function()
if (file != null)
{
if (file != null)
{
file.setLocked(lockedInput.checked);
}
file.setLocked(lockedInput.checked);
}

success();
}, 0);
}
else
{
success();
}
});
}
}, 0);
}
else
{
success();
}
});

if (isPng || isSvg)
{
Expand Down
5 changes: 2 additions & 3 deletions src/main/webapp/js/diagramly/DrawioFile.js
Original file line number Diff line number Diff line change
Expand Up @@ -1839,9 +1839,8 @@ DrawioFile.prototype.addAllSavedStatus = function(status)
var rev = (this.isRevisionHistorySupported() && status != mxUtils.htmlEntities(
mxResources.get(this.savingStatusKey)) + '...') ? 'data-action="revisionHistory" ' : '';
this.ui.editor.setStatus('<div ' + rev + 'title="'+ status + '">' + status +
(this.isLocked() && Editor.lockedImage != null ?
' <img class="geAdaptiveAsset" data-action="properties" style="margin-left:4px;" src="' +
Editor.lockedImage + '"/>' : '') + '</div>');
(this.isLocked() ? ' <img class="geToolbarButton geAdaptiveAsset" data-action="properties" ' +
'style="margin-left:4px;flex-shrink:0;" src="' + Editor.lockedImage + '"/>' : '') + '</div>');
}
};

Expand Down
5 changes: 2 additions & 3 deletions src/main/webapp/js/diagramly/DrawioFileSync.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,9 +592,8 @@ DrawioFileSync.prototype.updateStatus = function()
(!this.file.isEditable() ? '<div class="geStatusBox" title="' +
mxUtils.htmlEntities(mxResources.get('readOnly')) + '">' +
mxUtils.htmlEntities(mxResources.get('readOnly')) + '</div>' :
(this.file.isLocked() && Editor.lockedImage != null ?
' <img class="geAdaptiveAsset" data-action="properties" style="margin-left:4px;" src="' +
Editor.lockedImage + '"/>' : '')) +
(this.file.isLocked() ? ' <img class="geToolbarButton geAdaptiveAsset" data-action="properties" ' +
'style="margin-left:4px;flex-shrink:0;" src="' + Editor.lockedImage + '"/>' : '')) +
(status != null ? '<div class="geStatusBox" title="' + mxUtils.htmlEntities(status) + '">' +
mxUtils.htmlEntities(status) + '</div>' : '') +
((msg != null) ? ' <div class="geStatusBox" data-effect="fade" title="' + mxUtils.htmlEntities(msg) + '">' +
Expand Down
49 changes: 46 additions & 3 deletions src/main/webapp/js/diagramly/DriveClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -1305,6 +1305,39 @@ DriveClient.prototype.getXmlFile = function(resp, success, error, ignoreMime, re
}
};

/**
* Returns the checksum stored in the properties of the given file.
*/
DriveClient.prototype.getStoredChecksum = function(file)
{
var checksum = null;

if (file.desc != null && file.desc.properties != null)
{
for (var i = 0; i < file.desc.properties.length; i++)
{
if (file.desc.properties[i].key == 'checksum')
{
var temp = file.desc.properties[i].value;

if (temp != null && temp.length > 0)
{
var tokens = temp.split(':');

if (tokens.length == 2)
{
checksum = tokens[1];
}
}

break;
}
}
}

return checksum;
};

/**
* Translates this point by the given vector.
*
Expand Down Expand Up @@ -1649,6 +1682,11 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
etag = resp.etag;
}

if (reasons.length == 0)
{
reasons.push(mxResources.get('unknownError'));
}

var temp = reasons.join(', ');

if (retryCount < this.staleEtagMaxRetries)
Expand All @@ -1674,11 +1712,16 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
// Logs failed save
try
{
var oldChecksum = this.getStoredChecksum(file);

EditorUi.logError('Saving to Google Drive failed',
null, 'id-' + file.desc.id +
null, 'id-' + file.desc.id +
'-from-' + head0 + '.' + mod0 + '-' + this.ui.hashValue(etag0) +
'-to-' + resp.headRevisionId + '.' + resp.modifiedDate + '-' +
this.ui.hashValue(resp.etag) + ((temp.length > 0) ? '-errors-' + temp : ''),
this.ui.hashValue(resp.etag) +
((oldChecksum != null) ? '-old-checksum_' + oldChecksum : '') +
((checksum != null) ? '-new-checksum_' + checksum : '') +
((temp.length > 0) ? '-errors-' + temp : ''),
'user-' + ((this.user != null) ? this.user.id : 'nouser') +
((file.sync != null) ? '-client_' + file.sync.clientId : '-nosync') +
'-retries-' + retryCount);
Expand Down Expand Up @@ -2003,7 +2046,7 @@ DriveClient.prototype.saveFile = function(file, revision, success, errFn, noChec
{
criticalError(e);
}
})))
}), 20))
{
// If-branch
doSave(null, null, file.constructor != DriveLibrary);
Expand Down
2 changes: 2 additions & 0 deletions src/main/webapp/js/diagramly/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,7 +468,9 @@
{name: 'fillOpacity', dispName: 'Fill Opacity', type: 'int', min: 0, max: 100, defVal: 100},
{name: 'strokeOpacity', dispName: 'Stroke Opacity', type: 'int', min: 0, max: 100, defVal: 100},
{name: 'startFill', dispName: 'Start Fill', type: 'bool', defVal: true},
{name: 'startFillColor', dispName: 'Start Fill Color', type: 'color', defVal: null},
{name: 'endFill', dispName: 'End Fill', type: 'bool', defVal: true},
{name: 'endFillColor', dispName: 'End Fill Color', type: 'color', defVal: null},
{name: 'perimeterSpacing', dispName: 'Terminal Spacing', type: 'float', defVal: 0},
{name: 'anchorPointDirection', dispName: 'Anchor Direction', type: 'bool', defVal: true},
{name: 'snapToPoint', dispName: 'Snap to Point', type: 'bool', defVal: false},
Expand Down
Loading

0 comments on commit edb8cd9

Please sign in to comment.