Skip to content

Commit

Permalink
23.0.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
davidjgraph committed Jan 23, 2024
1 parent 6bea84f commit 43df730
Show file tree
Hide file tree
Showing 13 changed files with 5,015 additions and 5,039 deletions.
8 changes: 8 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
23-JAN-2024: 23.0.0

- Major release increment due to removal of HTML labels to SVG path functionality
- Removes convert label to SVG, embeds images and fonts by default in SVG export
- Fixes scrollbars in fitWindow for viewbox action
- Disables compressed XML in SVG export, sets scale/border for XML in SVG/PNG export [drawio-4125]
- [conf cloud] Fixes Aspects dialog overflow issue [DID-10568]

23-JAN-2024: 22.1.22

- Adds experimental freehand settings [drawio-3093]
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
22.1.22
23.0.0
2,799 changes: 1,398 additions & 1,401 deletions src/main/webapp/js/app.min.js

Large diffs are not rendered by default.

169 changes: 73 additions & 96 deletions src/main/webapp/js/diagramly/EditorUi.js
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@
* @param {number} dy Y-coordinate of the translation.
*/
EditorUi.prototype.createFileData = function(node, graph, file, url, forceXml, forceSvg, forceHtml,
embeddedCallback, ignoreSelection, compact, uncompressed)
embeddedCallback, ignoreSelection, compact, uncompressed, scale, border)
{
graph = (graph != null) ? graph : this.editor.graph;
forceXml = (forceXml != null) ? forceXml : false;
Expand Down Expand Up @@ -1286,6 +1286,18 @@
fileNode.removeAttribute('type');
}

if (scale != null)
{
fileNode = fileNode.cloneNode(true);
fileNode.setAttribute('scale', scale);
}

if (border != null)
{
fileNode = fileNode.cloneNode(true);
fileNode.setAttribute('border', border);
}

var xml = (uncompressed) ? mxUtils.getPrettyXml(fileNode) : mxUtils.getXml(fileNode);

// Writes the file as an embedded HTML file
Expand Down Expand Up @@ -1700,7 +1712,8 @@
* @param {number} dy Y-coordinate of the translation.
*/
EditorUi.prototype.getFileData = function(forceXml, forceSvg, forceHtml, embeddedCallback,
ignoreSelection, currentPage, node, compact, file, uncompressed, resolveReferences)
ignoreSelection, currentPage, node, compact, file, uncompressed, resolveReferences,
scale, border)
{
ignoreSelection = (ignoreSelection != null) ? ignoreSelection : true;
currentPage = (currentPage != null) ? currentPage : false;
Expand Down Expand Up @@ -1764,7 +1777,7 @@

var result = this.createFileData(node, graph, file, window.location.href,
forceXml, forceSvg, forceHtml, embeddedCallback, ignoreSelection, compact,
uncompressed);
uncompressed, scale, border);

// Removes temporary graph from DOM
if (graph != this.editor.graph)
Expand Down Expand Up @@ -5674,13 +5687,13 @@
editable, embedImages, border, noCrop, currentPage, linkTarget, theme, exportType,
embedFonts, saveFn)
{
if (this.spinner.spin(document.body, mxResources.get('export'), mxUtils.bind(this, function(err)
if (this.spinner.spin(document.body, mxResources.get('exporting'), mxUtils.bind(this, function(err)
{
Editor.addRetryToError(err, mxUtils.bind(this, function()
{
this.exportSvg(scale, transparentBackground, ignoreSelection, addShadow,
editable, embedImages, border, noCrop, currentPage, linkTarget, theme, exportType,
embedFonts, saveFn);
editable, embedImages, border, noCrop, currentPage, linkTarget,
theme, exportType, embedFonts, saveFn);
}));

this.handleError(err);
Expand Down Expand Up @@ -5747,12 +5760,15 @@

if (editable)
{
svgRoot.setAttribute('content', this.getFileData(true, null, null, null, ignoreSelection,
currentPage, null, null, null, false));
svgRoot.setAttribute('content', this.getFileData(true, null, null,
null, ignoreSelection, currentPage, null, null, null, null,
null, scale, border));
}

saveFn(Graph.xmlDeclaration + '\n' + ((editable) ? Graph.svgFileComment + '\n' : '') +
Graph.svgDoctype + '\n' + mxUtils.getXml(svgRoot));
saveFn(Graph.xmlDeclaration + '\n' + ((editable) ?
Graph.svgFileComment + '\n' : '') +
Graph.svgDoctype + '\n' +
mxUtils.getXml(svgRoot));
});

// Adds CSS
Expand All @@ -5765,13 +5781,13 @@
var processResult = mxUtils.bind(this, function(svgRoot)
{
// Fixes ignored SVG data URIs for Office
if (Editor.replaceSvgDataUris)
if (Editor.replaceSvgDataUris && embedImages)
{
this.embedSvgImages(svgRoot);
}

// Improves foreignObject fallback for Office/Inkscape
if (Editor.foreignObjectImages)
if (Editor.foreignObjectImages && embedFonts)
{
this.replaceAlternateContent(svgRoot, theme, doSave);
}
Expand All @@ -5783,7 +5799,7 @@

var done = mxUtils.bind(this, function(svgRoot)
{
if (embedImages)
if (embedImages && !this.isOffline() && this.canvasSupported)
{
// Caches images
if (this.thumbImageCache == null)
Expand Down Expand Up @@ -7087,74 +7103,24 @@
cb5.style.marginBottom = '16px';
cb5.style.marginRight = '8px';
cb5.setAttribute('type', 'checkbox');

if (this.isOffline() || !this.canvasSupported)
{
cb5.setAttribute('disabled', 'disabled');
}

var txtSettingsSelect = document.createElement('select');
txtSettingsSelect.style.maxWidth = '200px';
txtSettingsSelect.style.marginLeft = '8px';
txtSettingsSelect.style.marginBottom = '16px';

var noneOption = document.createElement('option');
noneOption.setAttribute('value', 'none');
mxUtils.write(noneOption, mxResources.get('default'));
txtSettingsSelect.appendChild(noneOption);

var embedFontsOption = document.createElement('option');
embedFontsOption.setAttribute('value', 'embedFonts');
mxUtils.write(embedFontsOption, mxResources.get('embedFonts'));
txtSettingsSelect.appendChild(embedFontsOption);

var lblToSvgOption = document.createElement('option');
lblToSvgOption.setAttribute('value', 'lblToSvg');
mxUtils.write(lblToSvgOption, mxResources.get('lblToSvg'));
var cb7 = document.createElement('input');
cb7.style.marginBottom = '16px';
cb7.style.marginRight = '8px';
cb7.setAttribute('type', 'checkbox');

if (this.getServiceName() == 'draw.io' && !this.isOffline() && !EditorUi.isElectronApp)
{
txtSettingsSelect.appendChild(lblToSvgOption);
}

mxEvent.addListener(txtSettingsSelect, 'change', mxUtils.bind(this, function()
{
if (txtSettingsSelect.value == 'lblToSvg')
{
cb5.checked = true;
cb5.setAttribute('disabled', 'disabled');
sizesOpt['page'].style.display = 'none';

if (exportSelect.value == 'page')
{
exportSelect.value = 'diagram';
}

shadow.checked = false;
shadow.setAttribute('disabled', 'disabled');

linkLost.style.display = 'inline-block';
linkSelect.style.display = 'none';
}
else if (cb5.getAttribute('disabled') == 'disabled')
{
cb5.checked = false;
cb5.removeAttribute('disabled');
shadow.removeAttribute('disabled');
sizesOpt['page'].style.display = '';
linkLost.style.display = 'none';
linkSelect.style.display = '';
}
}));

if (embedOption)
{
cb5.checked = (this.lastEmbedImages != null) ?
this.lastEmbedImages : true;
div.appendChild(cb5);
mxUtils.write(div, mxResources.get('embedImages'));
mxUtils.br(div);

mxUtils.write(div, mxResources.get('txtSettings') + ':');
div.appendChild(txtSettingsSelect);
cb7.checked = (this.lastEmbedFonts != null) ?
this.lastEmbedImages : true;
div.appendChild(cb7);
mxUtils.write(div, mxResources.get('embedFonts'));
mxUtils.br(div);

height += 60;
Expand Down Expand Up @@ -7199,12 +7165,13 @@
{
this.lastExportBorder = borderInput.value;
this.lastExportZoom = zoomInput.value;
this.lastEmbedImages = cb5.checked;
this.lastEmbedFonts = cb7.checked;

callback(zoomInput.value, transparent.checked, !selection.checked, shadow.checked,
include.checked, cb5.checked, borderInput.value, cb6.checked, false, linkSelect.value,
include.checked, cb5.checked && embedOption, borderInput.value, cb6.checked, false, linkSelect.value,
(grid != null) ? grid.checked : null, (themeSelect != null) ? themeSelect.value : null,
exportSelect.value, txtSettingsSelect.value == 'embedFonts',
txtSettingsSelect.value == 'lblToSvg');
exportSelect.value, cb7.checked);
}), null, btnLabel, helpLink);
this.showDialog(dlg.container, 340, height, true, true, null, null, null, null, true);
zoomInput.focus();
Expand Down Expand Up @@ -7889,8 +7856,17 @@
editable, border, noCrop, currentPage, format, grid, dpi, theme, exportType)
{
format = (format != null) ? format : 'png';

if (this.spinner.spin(document.body, mxResources.get('exporting')))

if (this.spinner.spin(document.body, mxResources.get('exporting'), mxUtils.bind(this, function(err)
{
Editor.addRetryToError(err, mxUtils.bind(this, function()
{
this.exportImage(scale, transparentBackground, ignoreSelection, addShadow,
editable, border, noCrop, currentPage, format, grid, dpi, theme, exportType);
}));

this.handleError(err);
})))
{
var selectionEmpty = this.editor.graph.isSelectionEmpty();
ignoreSelection = (ignoreSelection != null) ? ignoreSelection : selectionEmpty;
Expand All @@ -7903,24 +7879,25 @@

try
{
this.editor.exportToCanvas(mxUtils.bind(this, function(canvas)
{
this.spinner.stop();

try
{
this.saveCanvas(canvas, (editable) ? this.getFileData(true, null,
null, null, ignoreSelection, currentPage) : null,
format, (this.pages == null || this.pages.length == 0), dpi);
}
catch (e)
{
this.handleError(e);
}
}), null, this.thumbImageCache, null, mxUtils.bind(this, function(e)
{
this.spinner.stop();
this.handleError(e);
this.editor.exportToCanvas(mxUtils.bind(this, function(canvas)
{
this.spinner.stop();

try
{
this.saveCanvas(canvas, (editable) ? this.getFileData(true, null,
null, null, ignoreSelection, currentPage, null, null, null,
null, null, scale, border) : null, format,
(this.pages == null || this.pages.length == 0), dpi);
}
catch (e)
{
this.handleError(e);
}
}), null, this.thumbImageCache, null, mxUtils.bind(this, function(e)
{
this.spinner.stop();
this.handleError(e);
}), null, ignoreSelection, scale || 1, transparentBackground, addShadow,
null, null, border, noCrop, grid, theme, exportType);
}
Expand Down
16 changes: 4 additions & 12 deletions src/main/webapp/js/diagramly/Menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -835,24 +835,16 @@
'https://www.drawio.com/doc/faq/export-diagram',
mxUtils.bind(this, function(scale, transparentBackground, ignoreSelection,
addShadow, editable, embedImages, border, cropImage, currentPage,
linkTarget, grid, theme, exportType, embedFonts, lblToSvg)
linkTarget, grid, theme, exportType, embedFonts)
{
var val = parseInt(scale);
editorUi.lastExportSvgEditable = editable;

if (!isNaN(val) && val > 0)
{
if (lblToSvg)
{
editorUi.downloadFile('remoteSvg', null, null, ignoreSelection, null, cropImage,
transparentBackground, scale, border, null, editable);
}
else
{
editorUi.exportSvg(val / 100, transparentBackground, ignoreSelection,
addShadow, editable, embedImages, border, !cropImage, false,
linkTarget, theme, exportType, embedFonts);
}
editorUi.exportSvg(val / 100, transparentBackground, ignoreSelection,
addShadow, editable, embedImages, border, !cropImage, false,
linkTarget, theme, exportType, embedFonts);
}
}), true, editorUi.lastExportSvgEditable, 'svg', true);
}));
Expand Down
16 changes: 11 additions & 5 deletions src/main/webapp/js/grapheditor/Graph.js
Original file line number Diff line number Diff line change
Expand Up @@ -6150,11 +6150,17 @@ Graph.prototype.fitWindow = function(bounds, border)

if (mxUtils.hasScrollbars(this.container))
{
var t = this.view.translate;
this.container.scrollLeft = (bounds.x + t.x) * this.view.scale -
Math.max((cw - bounds.width * this.view.scale) / 2 + border / 2, 0);
this.container.scrollTop = (bounds.y + t.y) * this.view.scale -
Math.max((ch - bounds.height * this.view.scale) / 2 + border / 2, 0);
// Call to zoom above may trigger an asynchronous update of the scrollbars
// as setting scrollTop/-Left is executed asynchronously so the code below
// ensures that the final state of the scrollbars is as intended.
window.setTimeout(mxUtils.bind(this, function()
{
var t = this.view.translate;
this.container.scrollLeft = (bounds.x + t.x) * this.view.scale -
Math.max((cw - bounds.width * this.view.scale) / 2 + border / 2, 0);
this.container.scrollTop = (bounds.y + t.y) * this.view.scale -
Math.max((ch - bounds.height * this.view.scale) / 2 + border / 2, 0);
}), 0);
}
};

Expand Down
Loading

0 comments on commit 43df730

Please sign in to comment.