Documents containing mermaid fences now route through the editor preview chunk-resident renderer (splitMermaidBlocks detection + LazyMermaidMarkdown), so diagrams draw with zoom/pan instead of code blocks, while plain documents keep the byte-for-byte single MarkdownText pass. The lazy stub moves to a light mermaid-lazy.tsx module (re-exported from MarkdownHtml.tsx) so the core client bundle imports it without statically pulling DOMPurify/HTML analysis along. Typecheck, 4 affected suites (22 tests), and the full build pass.
17 lines
800 B
TypeScript
17 lines
800 B
TypeScript
/**
|
|
* The chunk-resident markdown renderer (mermaid lazy chunk): a light stub
|
|
* module so core-bundle consumers (the changes tab's reading mode) can mount
|
|
* the mermaid-aware renderer without statically pulling MarkdownHtml's
|
|
* DOMPurify/HTML-analysis machinery into the core bundle. The chunk itself
|
|
* (src/client/chunks/mermaid) loads on first render via /sidebar/bundle.
|
|
*/
|
|
import type { ComponentType } from 'react'
|
|
import { lazyChunkComponent } from './lazy-chunk.tsx'
|
|
import type { MermaidMarkdownProps } from './mermaid-blocks.ts'
|
|
|
|
/** Shared with the legacy no-HTML preview path in TextEditor (re-exported). */
|
|
export const LazyMermaidMarkdown = lazyChunkComponent<MermaidMarkdownProps>(
|
|
'mermaid',
|
|
(mod) => mod.MermaidMarkdown as ComponentType<MermaidMarkdownProps> | undefined,
|
|
)
|