Skip to content

Commit

Permalink
Fixes the "publish images" feature.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonbrowndotje committed Nov 10, 2023
1 parent 1ad62c6 commit 9c0f1ac
Showing 1 changed file with 5 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

function publishAllViews() {
numberOfPublishedImages = 0;
publishImages(structurizr.workspace.getViews().map(function(v) { return v.key; }));
publishImages(structurizr.workspace.getViews());
}

function publishViewsFinished() {
Expand All @@ -15,17 +15,16 @@

function publishImages(viewsToExport) {
if (viewsToExport && viewsToExport.length > 0) {
const viewToExport = viewsToExport[0];
const view = viewsToExport[0];

structurizr.diagram.changeView(viewToExport, function () {
changeView(view, function () {
structurizr.diagram.exportCurrentDiagramToPNG(true, false, function(diagramAsPNG) {
publishImage(viewToExport, viewToExport + '.png', diagramAsPNG, function() {
publishImage(view.key, view.key + '.png', diagramAsPNG, function() {
numberOfPublishedImages++;

const view = structurizr.workspace.findViewByKey(viewToExport);
if (view.type !== structurizr.constants.IMAGE_VIEW_TYPE) {
structurizr.diagram.exportCurrentDiagramKeyToPNG(function (diagramKeyAsPNG) {
publishImage(viewToExport, viewToExport + '-key.png', diagramKeyAsPNG, function () {
publishImage(view.key, view.key + '-key.png', diagramKeyAsPNG, function () {
viewsToExport.splice(0, 1);
publishImages(viewsToExport);
})
Expand Down

0 comments on commit 9c0f1ac

Please sign in to comment.