Skip to content

Add controls on mermaid diagrams - #1693

Open
Grafikart wants to merge 4 commits into
getprobo:mainfrom
Grafikart:feat/mermaid-zoom
Open

Add controls on mermaid diagrams#1693
Grafikart wants to merge 4 commits into
getprobo:mainfrom
Grafikart:feat/mermaid-zoom

Conversation

@Grafikart

@Grafikart Grafikart commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Add controls to better visualize mermaid graphs inside markdown content

  • Zoom and Pan with mouse support
  • Zoom using buttons
  • Fullscreen mode
  • Highlight on node click for chart graph

I chose to use a simpler library than d3 to limit the footprint for this first version.

image

Summary by cubic

Adds pan/zoom controls, fullscreen, and click-to-highlight for Mermaid diagrams in Markdown and the TipTap editor preview. Previously diagrams were static; now users can zoom via mouse or toolbar, reset, toggle fullscreen, and highlight nodes/edges, with background click clearing the selection.

Package: ui +313 -150

Introduces a shared MermaidDiagram that uses svg-pan-zoom, adds a compact toolbar (zoom in/out, reset, fullscreen), preserves SVG aspect ratio with a minimum height, and handles fullscreen lifecycle. Adds delegated click interactions to emphasize a node with its neighbors and connecting edges, or an edge with its endpoints; background click resets. Replaces the editor’s custom preview with MermaidDiagram and simplifies related CSS (override global SVG sizing constraints). Updates Storybook to scope v1 stories (Atoms/Molecules/Layouts, root) and moves the theme import to preview.css. Adds Markdown stories with Mermaid examples.

Other +7 -0

Updates the lockfile to add the svg-pan-zoom dependency.

Written for commit c0c79e4. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread packages/ui/src/Atoms/Markdown/MermaidDiagram.tsx Outdated
Comment thread packages/ui/src/Atoms/Markdown/MermaidDiagram.tsx
Comment thread packages/ui/src/Atoms/Markdown/MermaidInteractions.ts
Comment thread packages/ui/src/Atoms/Markdown/MermaidDiagram.tsx
Comment thread packages/ui/src/Atoms/Markdown/MermaidDiagram.tsx
Comment thread packages/ui/src/Atoms/Markdown/MermaidDiagram.tsx Outdated
@Grafikart
Grafikart force-pushed the feat/mermaid-zoom branch 3 times, most recently from 2af021a to 88e47ee Compare August 11, 2026 18:51
@gearnode
gearnode requested a review from codenem August 11, 2026 19:27
@codenem

codenem commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

@Grafikart can we have it work with the documents tip tap editor mermaid block as well?

@Grafikart

Copy link
Copy Markdown
Contributor Author

@Grafikart can we have it work with the documents tip tap editor mermaid block as well?

@codenem It's done, tiptap mermaid preview now use the same component.

@Grafikart
Grafikart force-pushed the feat/mermaid-zoom branch 2 times, most recently from b9b0f3d to d9ba7c8 Compare August 24, 2026 08:20
Grafikart and others added 3 commits August 26, 2026 12:33
Signed-off-by: Jonathan <contact@grafikart.fr>
Signed-off-by: Jonathan <contact@grafikart.fr>
Storybook treats each stories[] entry as its own specifier, so
"!../src/v2/**" never ignored the v2 tree. Importing theme.css
from preview.tsx also compiled it without Tailwind, which made
@apply my-2 fail.

Signed-off-by: Émile Ré <emile@probo.com>
@codenem
codenem force-pushed the feat/mermaid-zoom branch from d9ba7c8 to e2c0c98 Compare August 26, 2026 08:33
Signed-off-by: Jonathan <contact@grafikart.fr>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants