# Diagrams (draw.io and BPMN)

> Show draw.io (.drawio) and BPMN (.bpmn) diagrams inside Docs pages, view them full screen with zoom, and edit them in place without any add-on.

Source: https://docs.sofiaspace.uz/docs/diagrams/

Docs pages can show diagrams directly in the page body. Attach a draw.io file (`.drawio`) or a BPMN process file (`.bpmn` or `.bpmn20.xml`) and readers see the diagram itself, not a file icon. Editors can open the diagram in a full-screen editor, change it and save it back into the page. No plug-in, add-on or separate account is needed. This page explains how to add, view and edit diagrams and what their limits are.

**Who can do this:** anyone who can open the page can view its diagrams. Adding and editing diagrams needs edit access to the page (space **Editor** or **Admin**, or **Can edit** on the page). Available on every plan.

## Which diagram files are supported?

| File | Shown as | Edited with |
| --- | --- | --- |
| `.drawio` | A draw.io diagram | The draw.io (diagrams.net) editor, opened inside Sofia Space |
| `.bpmn`, `.bpmn20.xml` | A BPMN process diagram | A BPMN modeler, opened inside Sofia Space |

Other diagram formats, such as Visio files or images exported from a diagram tool, are attached as ordinary files or images. A `.png` or `.svg` export shows as an image, not an editable diagram.

## Add a diagram to a page

1. Open the page and choose **Edit** (or **Continue draft**).
2. Put the cursor where the diagram should go.
3. In the toolbar, choose **Attach** and pick the `.drawio`, `.bpmn` or `.bpmn20.xml` file. You can also drag the file onto the page.
4. The file is inserted as a diagram. A page that publishes manually needs **Publish** before readers see it.

The file is also added to the page's **Attachments** shelf (**⋯ → Attachments**).

### Start a new diagram from scratch

Sofia Space doesn't have a "new blank diagram" button. To start one:

1. Create an empty diagram in draw.io (diagrams.net) or in any BPMN tool, and save it as a file.
2. Attach that file to the page as above.
3. Select it and choose **Edit** to draw the rest inside Sofia Space.

### A diagram file shows as a plain card

If a `.drawio` or `.bpmn` file was attached as a card, inline file or link:

1. In the editor, click the file to select it.
2. In the small bar that appears, choose **Diagram** (for draw.io) or **BPMN** (for a BPMN file).

The same bar switches it back to **Card**, **Inline** or **Link** if you'd rather show the file than the drawing.

## View a diagram

In the read view, the diagram is drawn in the page at a size that fits. To look closer:

1. Hover the diagram and choose **Open full screen** (the expand button in its corner).
2. Use **Zoom in (+)** and **Zoom out (-)**, or the + and - keys. Drag to move around. **Reset** fits the whole diagram again.
3. Press Esc or choose **Close (Esc)** to return to the page.

Readers can't change the diagram from the read view.

If a diagram can't be shown (for example the file is damaged), the page shows **Could not load this diagram.** in its place.

## Edit a diagram

1. Open the page and choose **Edit** (or **Continue draft**).
2. Click the diagram to select it.
3. In the small bar that appears, choose **Edit** (its tooltip is **Edit diagram**).
4. The diagram opens full screen in the draw.io editor or the BPMN modeler. Make your changes with the editor's own shapes, toolbars and menus.
5. Choose **Save** to put the changed diagram into the page, or **Cancel** to close without changes.

Saving stores the edited diagram as a new file attached to the page and points the page at it. The original file isn't overwritten, so earlier [versions of the page](https://docs.sofiaspace.uz/docs/version-history.md) still show the diagram as it was then.

Saving the diagram changes the page like any other edit:

- On a page that publishes **Manually**, the new diagram is part of your draft. Choose **Publish** for readers to see it.
- On a page that publishes **Automatically**, the change reaches readers right away.

If saving fails, the editor stays open with **Couldn't save — try again.** Your changes are still in the editor; choose **Save** again.

### Why don't I see Edit on a diagram?

- You're in the read view. Choose **Edit** for the page first.
- You don't have edit access to the page.
- Your screen is narrow. Diagram editing needs a window at least 760 pixels wide (a tablet in landscape, or a computer). On a phone you can view diagrams but not edit them.
- The file isn't a `.drawio`, `.bpmn` or `.bpmn20.xml` file.

## Download the diagram file

Readers who want the original file can download it from the page's **Attachments** shelf (**⋯ → Attachments**), then open it in draw.io or another BPMN tool.

## What you can't do

- You can't create a blank diagram from inside Sofia Space; start from a saved file.
- You can't edit diagrams on a phone or in a narrow window.
- You can't edit two diagrams at once, or edit a diagram together with someone in real time inside the diagram editor. On a page that publishes automatically, the last person to save the diagram wins.
- Diagrams in other formats (for example Visio or Lucidchart files) aren't drawn; they attach as ordinary files.

## Related

- [The page editor](https://docs.sofiaspace.uz/docs/editor.md)
- [Images and file attachments](https://docs.sofiaspace.uz/docs/images-and-attachments.md)
- [Drafts, publishing and live editing](https://docs.sofiaspace.uz/docs/drafts-and-live-editing.md)
