feat(webui): preview Markdown files with a source toggle
This commit is contained in:
1 parent
742ea48df3
commit
0869c928a2
18 files changed
+182
-17
No files matched your search
@@ -15,6 +15,7 @@ interface MarkdownTextProps {
|
||||
streaming?: boolean;
|
||||
preserveStreamingLayout?: boolean;
|
||||
onOpenFilePreview?: (path: string) => void;
|
||||
documentPath?: string;
|
||||
}
|
||||
|
||||
const loadMarkdownRenderer = () => import("@/components/MarkdownTextRenderer");
|
||||
@@ -27,6 +28,7 @@ const MemoizedMarkdownRenderer = memo(function MemoizedMarkdownRenderer({
|
||||
streaming,
|
||||
preserveStreamingLayout,
|
||||
onOpenFilePreview,
|
||||
documentPath,
|
||||
}: {
|
||||
source: string;
|
||||
className?: string;
|
||||
@@ -34,6 +36,7 @@ const MemoizedMarkdownRenderer = memo(function MemoizedMarkdownRenderer({
|
||||
streaming: boolean;
|
||||
preserveStreamingLayout: boolean;
|
||||
onOpenFilePreview?: (path: string) => void;
|
||||
documentPath?: string;
|
||||
}) {
|
||||
return (
|
||||
<LazyMarkdownRenderer
|
||||
@@ -42,6 +45,7 @@ const MemoizedMarkdownRenderer = memo(function MemoizedMarkdownRenderer({
|
||||
streaming={streaming}
|
||||
preserveStreamingLayout={preserveStreamingLayout}
|
||||
onOpenFilePreview={onOpenFilePreview}
|
||||
documentPath={documentPath}
|
||||
>
|
||||
{source}
|
||||
</LazyMarkdownRenderer>
|
||||
@@ -80,6 +84,7 @@ export function MarkdownText({
|
||||
streaming = false,
|
||||
preserveStreamingLayout = false,
|
||||
onOpenFilePreview,
|
||||
documentPath,
|
||||
}: MarkdownTextProps) {
|
||||
const renderedSource = children;
|
||||
const renderPhase = streaming ? "streaming" : "complete";
|
||||
@@ -111,6 +116,7 @@ export function MarkdownText({
|
||||
streaming={streaming}
|
||||
preserveStreamingLayout={preserveStreamingLayout}
|
||||
onOpenFilePreview={onOpenFilePreview}
|
||||
documentPath={documentPath}
|
||||
/>
|
||||
</Suspense>
|
||||
</MarkdownRendererBoundary>
|
||||
|
||||
Reference in new issue
Block a user