Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How get embedded draw.io diagrams when accessing a page via Confluence REST API? Edited

A draw.io diagram on a page used to be an embedded, base64-encoded png in the body.export_view of a page, e.g:

GET https://confluence.company.com/rest/api/content/123456789?expand=metadata.labels,children.page,version,body.export_view

Old Response

{
"id": "123456789",
"type": "page",
"status": "current",
...
"body": {
"export_view": {
"value": "<img class=\"drawio-diagram-image\" src=\"data&colon;image/png;base64,c0debabe..."
}
}
}

 

But since a recent upgrade of the draw.io plugin (8.5.1 -> 9.2.6), I get a useless JS code block for every diagram on a page

New Response

{ 
"id": "123456789",
"type": "page",
"status": "current",
...
"body": {
"export_view": {
"value": "<span id=\"drawio-macro-content-cae9a5a5-bb84-4eba-83d2-b2f5798cf226\" style=\"position:relative;display:inline-block;max-width:100%;overflow:hidden;border:1px solid transparent;\"></span>\n\n<script type=\"text/javascript\">\n(function()\n{\n\t$ = AJS.$;\n\t\n\tvar graphContainer = document.getElementById('drawio-macro-content-cae9a5a5-bb84-4eba-83d2-b2f5798cf226');\n\tvar DrawioProperties = { contextPath : AJS.contextPath() };\n\t\n\tvar readerOpts = {};\n\t\t\treaderOpts.loadUrl = '' + '/rest/drawio/1.0/diagram/crud/..."
}
}
}

 

Is there any way to replace the JS code block with e.g. link to the rendered diagram?
(Maybe a configuration option for the plugin?)

Theoretically I could parse the JS script block and use the properties of readerOpts to construct the link to the rendered diagram that's available as attachment on the page anyway, but I really don't want to go down that rabbit hole.

1 answer

1 accepted

0 votes
Answer accepted

Are you sure it's a change to the plugin and not a Confluence update that caused the change?

Reasonably sure, yes. (I'm only a user of this particular confluence server, not an admin)

The change of the output format directly coincides with the plugin update.

I was able to dig up the previous version: 8.5.1

Any chance to get the old behaviour back?

We have implemented an admin setting which will act as a switch. Default will be 1 which will embed the diagram in the output.

It will be in the next release. 

that's great to hear!

Looking forward to the next version, so I can remove the JS script block parsing again...

Any ETA on the release?

Is this fix in 9.2.8?

It is. Search for 'emailpreview' in the docs here.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Posted in Confluence

What do you think is the most *delightful* Confluence feature? Comment for a prize!

- Create your own custom emoji 🔥 - "Shake for Feedback" on mobile 📱 - An endless supply of GIFs via GIPHY 🤩 Is there anything quite as nice as a pleasant surprise? Comment below with what...

429 views 23 9
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you