feat: add Monaco markdown editor with live preview and auto-save - #22
Conversation
Integrate @monaco-editor/react as the primary document editing surface with: - Lazy-loaded Monaco editor with markdown syntax highlighting - Split/edit/preview view modes with react-markdown rendering - Debounced auto-save hook (2s delay) that persists to document API - Dark/light theme sync via app theme context - Responsive layout filling available viewport space - @tailwindcss/typography for styled markdown preview Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
950ed66 to
8d091d1
Compare
|
✅ Approved! Solid implementation of the Monaco editor integration with well-separated concerns. Code QualityMarkdownEditor.tsx — Clean lazy-loading with Suspense, proper theme sync via MarkdownPreview.tsx — Minimal, focused component. Good use of Tailwind typography plugin for prose rendering. use-auto-save.ts — Well-designed hook with debouncing, ref-based memoization to avoid stale closures, unmount flush for data safety, and save-in-progress guard to prevent concurrent writes. DocumentEditPage.tsx — Clean page component with loading/error states, toolbar with view mode toggles (edit/split/preview), and proper credential handling on fetch calls. Route correctly added in App.tsx with ProtectedRoute wrapper. globals.css — Typography plugin integration via Test ExecutionTest plan from PR description:
Test ScopingStrategy: Full suite (config files changed — |
Summary
Changes
src/components/MarkdownEditor.tsx— Lazy-loaded Monaco wrapper with theme sync and markdown configsrc/components/MarkdownPreview.tsx— Markdown renderer using react-markdown with Tailwind typographysrc/hooks/use-auto-save.ts— Debounced auto-save hook (2s delay) with unmount flushsrc/pages/DocumentEditPage.tsx— Full editor page with toolbar, save status, and split/edit/preview modessrc/App.tsx— Add document edit route at/projects/:projectId/documents/:documentId/editsrc/styles/globals.css— Add @tailwindcss/typography plugin for prose stylespackage.json— Add @monaco-editor/react, react-markdown, @tailwindcss/typography dependenciesAcceptance Criteria Verification
@monaco-editor/reactin document editing viewlanguage="markdown"set on editor/api/projects/:id/documents/:idon mounth-[calc(100vh-3.5rem)]andautomaticLayout: truewordWrap: "on",minimap: { enabled: false },fontSize: 14Test Plan
pnpm test)tsc --noEmit)pnpm lint)Closes #14