[Feature] Web app: open an existing .drawio file losslessly (the desktop build already has open/save IPC)

Author: caoxiaole07Created Sep 30, 2026Updated Sep 30, 2026

Feature Description

A way to open an existing .drawio file directly in the web app's canvas — parsed and loaded losslessly, no AI round-trip. (A symmetric "save as .drawio" may be worth considering together, but this request focuses on open.)

Problem Context

Today the web app can only get existing diagram content onto the canvas through the AI:

  1. Chat upload — the file input (components/chat-input.tsx) accepts images, PDF and text-ish files (.xml among them). PDFs and text are run through text extraction (lib/use-file-processor.tsx → extractPdfText / extractTextFileContent) and handed to the model as context, so the diagram is replicated: layout coordinates, styles, page structure and custom shapes are re-authored by the model, not preserved — and it burns tokens on a task that needs no intelligence. The .drawio extension is not even in the accept list.
  2. Pasting XML into the chat — same replication story.
  3. MCP load_diagram — lossless, but agent-side only: it requires an MCP client and a live session. A human user in the browser cannot use it.

Meanwhile the desktop build already ships the capability: electron/main/ipc-handlers.ts implements dialog-open-file (filtered to .drawio / .xml) and dialog-save-file, exposed through the preload bridge. The web build simply has no equivalent entry point. (#823 reports the desktop import not responding for one user — related symptom, but this request is about the web gap.)

Our concrete scenario: we run the app as a hosted tool inside a sandboxed cloud workspace, alongside AI agents that produce .drawio files as part of their work. On the agent side the lossless path exists (load_diagram with a file path, and #946 which adds inline xml content). The missing piece is the same thing for a human with a browser: "open the .drawio the agent just produced, review it, and maybe keep chatting about it".

Proposed Solution

A sketch — happy to adapt to your design decisions:

  • Entry: accept .drawio in the existing upload entry (extension + application/xml / text/xml MIME), or add a small "Open file" action near it.
  • Parsing in the browser: plain-XML pages load directly; draw.io's compressed save format (encodeURIComponent → raw-deflate → base64) decompresses with the built-in DecompressionStream("deflate-raw") — no new dependency. A reference implementation already exists in this repo: parseDrawioFileContent in packages/mcp-server/src/load-diagram.ts.
  • Loading: use the same primitive the canvas already uses (DrawIoEmbed from react-drawio), so the loaded diagram becomes the current state and subsequent chat edits apply on top of it — exactly like a diagram the AI just generated.
  • UX, mirroring existing semantics: opening replaces the current document, so confirm first and record a history entry (same "destructive replace, history first" semantics as create_new_diagram on the MCP side); multi-page files load as tabs; UI strings in en / cn / ja.

Happy to contribute the implementation if the direction sounds right.

Related

  • #946 — MCP-side companion: load_diagram accepting inline xml content (agents).
  • #823 — desktop "import from device" not responding (reported by a desktop user).

Source: DayuanJiang/next-ai-draw-io