diff --git a/frontend/src/components/WorkspaceOperationPanel.tsx b/frontend/src/components/WorkspaceOperationPanel.tsx index 32b9c2da3..2acc93d58 100644 --- a/frontend/src/components/WorkspaceOperationPanel.tsx +++ b/frontend/src/components/WorkspaceOperationPanel.tsx @@ -72,6 +72,7 @@ const DEFAULT_TREE_WIDTH = 240; const DEFAULT_HISTORY_WIDTH = 320; const MIN_SIDE_WIDTH = 220; const MAX_SIDE_WIDTH = 520; +const HTML_DRAFT_PREVIEW_LIMIT = 20000; function extOf(path: string): string { const idx = path.lastIndexOf('.'); @@ -257,6 +258,18 @@ function buildRevisionDiff(revision: any): string { return chunks.join('\n'); } +function HtmlDraftPreview({ content }: { content: string }) { + const shownContent = content.length > HTML_DRAFT_PREVIEW_LIMIT + ? `${content.slice(0, HTML_DRAFT_PREVIEW_LIMIT)}\n\n... truncated while drafting ...` + : content; + + return ( +
{shownContent}
+