mirror of
https://github.com/DayuanJiang/next-ai-draw-io.git
synced 2026-10-12 04:29:51 +08:00
feat(mcp-server): add theme menu, dark mode and editable SVG to the preview
- Pass themes=1 and dark=auto to the draw.io iframe, so the Extras menu offers the Theme submenu and draw.io follows the system dark mode; the header and dialogs follow it too through prefers-color-scheme - Download dialog: new Editable SVG (.drawio.svg) format through draw.io's xmlsvg export, default name diagram-YYYY-MM-DD, Enter saves and Escape closes it and the history dialog - export_diagram accepts format "drawio.svg" and detects the .drawio.svg extension - Use system fonts instead of Google Fonts, so the page works offline with a self-hosted draw.io (DRAWIO_BASE_URL)
This commit is contained in:
@@ -104,12 +104,15 @@ interface SessionState {
|
||||
lastPolled?: number // Last browser poll; an open tab keeps the session alive
|
||||
svg?: string // Cached SVG from last browser save
|
||||
syncRequested?: number // Timestamp when sync requested, cleared when browser responds
|
||||
exportFormat?: "png" | "svg" // Set by MCP tool to request browser export
|
||||
exportFormat?: ExportFormat // Set by MCP tool to request browser export
|
||||
exportXml?: string // Single-page projection to load before a page-targeted export
|
||||
exportOptions?: ExportOptions // Extra draw.io export parameters (PNG only)
|
||||
exportData?: string // Base64/SVG data returned by browser after export
|
||||
}
|
||||
|
||||
/** draw.io export formats; xmlsvg is an SVG with the diagram embedded */
|
||||
export type ExportFormat = "png" | "svg" | "xmlsvg"
|
||||
|
||||
/**
|
||||
* draw.io's PNG export takes these directly: width caps the image size
|
||||
* (never upscales), pageId renders a page other than the one on screen.
|
||||
@@ -179,7 +182,7 @@ export function setState(
|
||||
*/
|
||||
export function requestExport(
|
||||
sessionId: string,
|
||||
format: "png" | "svg",
|
||||
format: ExportFormat,
|
||||
projectionXml?: string,
|
||||
options?: ExportOptions,
|
||||
): boolean {
|
||||
|
||||
Reference in New Issue
Block a user