Sometimes, though rarely, users find they have a draw.io macro on a Confluence page, but no diagram showing. The most common way this happens is when a user manually copies the page content to another page. This loses the diagram attachment, use the built-in page copy functionality to copy the attachment as well.
If you find a broken draw.io diagram in a Confluence page, as long as the original diagram is on the system, you can recover it.
To display a draw.io diagram on a page, the draw.io macro contains an attribute that specifies a diagram name that is attached to a page (like a link).
Find the name of the moved diagram file
- Determine the name of the diagram attachment first. As an administrator, look at the page source - the underlying format that Confluence uses to describe the page. Click on … > View Storage Format in the top right to see a page’s source.
- Within the source, look for the structured-macro with the name “drawio”.
- Within the this macro definition, look for the diagramName parameter. In the following example, the diagramName is rulers-measurements.drawio.
<p><ac:structured-macro ac:name="drawio" ac:schema-version="1" data-layout="default" ac:macro-id="41ddd3f1-9613-4f13-b0f1-9b24b68db2eb"> <ac:parameter ac:name="contentId">678821920</ac:parameter><ac:parameter ac:name="simple">0</ac:parameter><ac:parameter ac:name="zoom">1</ac:parameter> <ac:parameter ac:name="inComment">0</ac:parameter><ac:parameter ac:name="pageId">678854685</ac:parameter><ac:parameter ac:name="diagramDisplayName">rulers-measurements.drawio</ac:parameter> <ac:parameter ac:name="lbox">1</ac:parameter><ac:parameter ac:name="contentVer">1</ac:parameter><ac:parameter ac:name="revision">1</ac:parameter><ac:parameter ac:name="baseUrl">https://drawio.atlassian.net/wiki</ac:parameter> <ac:parameter ac:name="diagramName">rulers-measurements.drawio</ac:parameter> <ac:parameter ac:name="width">1151</ac:parameter><ac:parameter ac:name="links" /><ac:parameter ac:name="tbstyle" /><ac:parameter ac:name="height">911</ac:parameter></ac:structured-macro></p>
Search for the diagram file and restore it
- Copy the diagram name and enter it into Confluence’s search function.
Tip: Restrict the search results to just Attachments. - If the revision parameter is 1, you can simply copy the diagram attachment back to your original page to fix the problem with the draw.io macro.
- If the revisionparameter is higher:
- Download the attachment from the incorrect page to your device.
- Edit the original page and delete the old macro.
- Insert a new draw.io diagram macro.
- In the diagram editor, drag and drop the file you had previously saved onto the drawing canvas.
- Save the diagram, and save the Confluence page.
Repeat these steps for each draw.io diagram macro on the page that is broken.