Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Host-integrated Mermaid download and fullscreen hooks

Aperta
#490 0 commenti 1 reazione 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
typescript
Ambito
frontend

Direzione di ricerca

Inizia individuando la Mermaid controls configuration e gli handler esistenti per download e fullscreen. Traccia i relativi payload e il comportamento predefinito, quindi aggiungi i callback opzionali in modo che un risultato gestito salti l’azione predefinita corrispondente, mentre in assenza di callback venga mantenuto il comportamento attuale; verifica i payload dei callback e i default invariati con i test Mermaid pertinenti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement
Problem Statement

When Streamdown is embedded inside a desktop webview or an iframe sidebar panel, the Mermaid download and fullscreen actions are confined to the web context:

  • Download is sandboxed to the browser/webview and cannot invoke host-native save dialogs or write files to user-selected locations.
  • Fullscreen is limited to the iframe/panel container, not a true host-level expanded view.

This blocks good UX for desktop integrations where the host application needs to handle these actions natively.

Proposed Solution

Add optional callback hooks to the Mermaid controls configuration:

  • onMermaidDownload(payload) — called before the default download. Receives the generated Blob, suggested filename, mimeType, chart source, and config. If the callback returns { handled: true }, the default browser download is skipped.
  • onMermaidFullscreen(payload) — called before the default fullscreen. Receives chart source and config. If the callback returns { handled: true }, the default fullscreen behavior is skipped.

If no callbacks are provided, existing behavior is unchanged.

Alternatives Considered
  • Custom renderer plugin: Using the existing customRenderer API to replace the entire Mermaid block. This is too heavy-handed — it requires reimplementing the full Mermaid UI just to intercept two actions.
Use Case
import { Streamdown } from "streamdown";

<Streamdown
  mermaid={{
    config: { theme: "dark" },
    onDownload: async ({ blob, filename, mimeType, chart, config }) => {
      // Forward blob to desktop host via postMessage / bridge API
      window.parent.postMessage(
        { type: "save-file", blob, filename, mimeType },
        "*"
      );
      return { handled: true }; // skip default browser download
    },
    onFullscreen: ({ chart, config }) => {
      // Ask host to open chart in a dedicated large window
      window.parent.postMessage(
        { type: "open-fullscreen", chart, config },
        "*"
      );
      return { handled: true }; // skip default in-panel fullscreen
    },
  }}
>
  {markdown}
</Streamdown>;
Priority

Important

Contribution
  • I am willing to help implement this feature
Additional Context

No response

Lingua principale
TypeScript
Stelle
5.7k
Fork
316
Merge medio
3g 13h
PR unite (30g)
28

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di vercel/streamdown

Tutte le issue di vercel/streamdown

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.