Code panel

Code in the left rail shows the current page as JSON and applies valid edits as you type. Use it to set exact positions and sizes, look up icon names or copy a whole page.

{
  "nodes": [],
  "arrows": []
}

Icons, images, groups, shapes and text boxes go in nodes, and arrows in arrows. Diagram format describes every field.

Editing#

  • Whenever the text is valid, the canvas updates for everyone who has the diagram open.
  • Clicking outside the panel makes everything since you clicked in one undo step, "Edit code".
  • While the text is invalid, the header shows Invalid, the canvas keeps the last valid version and the problem appears at the bottom, with its path:
nodes[2].position.x must be a number
arrows[0].end.nodeId "db" does not match any node
  • The panel edits one page, so a document with pages isn't accepted.
  • Editor shortcuts, undo included, don't work while you type in it.

If the page changes while your text is invalid, because someone else edits it or you switch pages, the panel replaces your unfinished edit with the current page.

Header buttons#

ButtonWhat it does
Copy JSONCopies the panel's text, to save as a file or paste onto another page.
Add from Mermaid…Lays out a Mermaid diagram in the middle of the view. Not on locked or synced pages.

Export → JSON downloads the same JSON as a file. See Exporting JSON. With view-only access, the panel is read-only.