Skip to content

feat: add draft preview mode to content editor#342

Merged
RUKAYAT-CODER merged 1 commit intorinafcode:mainfrom
collinsezedike:feat/preview-mode-210
Apr 28, 2026
Merged

feat: add draft preview mode to content editor#342
RUKAYAT-CODER merged 1 commit intorinafcode:mainfrom
collinsezedike:feat/preview-mode-210

Conversation

@collinsezedike
Copy link
Copy Markdown
Contributor

Summary

  • src/app/api/preview/route.ts — new POST endpoint that accepts { content: string } and returns { html: string } without persisting anything; serves as the preview API
  • src/app/editor/page.tsx — added a Preview/Back to Editor toggle button; in preview mode the draft is rendered as sanitized HTML using the existing sanitizeHtml (DOMPurify) utility; draft state is fully preserved in React state so switching modes never loses edits

Test plan

  • Open the editor, type some content, click Preview — rendered HTML should appear
  • Click Back to Editor — content should be exactly as left
  • POST /api/preview with { "content": "<p>hello</p>" } returns { "html": "<p>hello</p>" }
  • POST /api/preview with non-string content returns 400

Closes #210

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 28, 2026

@collinsezedike Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@RUKAYAT-CODER RUKAYAT-CODER merged commit fd99ae7 into rinafcode:main Apr 28, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing Preview Mode

2 participants