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: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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
it's version 9.1.
after setting emailpreview=1, the export_view is still js code.
how to rollback to base64 encode images.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
9.1 is too old, you need to update to get the change.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.