feat: Add rich text formatting to sermon notes

Implement comprehensive rich text editing capabilities using Tiptap editor with full formatting toolbar and functionality.

Features:
- Bold, italic, underline, strikethrough text formatting
- Highlight text with yellow marker
- Bullet and numbered lists
- Heading styles (H2, H3)
- Text alignment (left, center, right)
- Undo/redo support
- Clear formatting option
- Intuitive toolbar with icons and tooltips
- Responsive font size support

Technical changes:
- Added Tiptap dependencies to package.json (@tiptap/vue-3, starter-kit, extensions)
- Created RichTextEditor component with full toolbar and formatting options
- Integrated editor into sermon notes section replacing textarea
- Updated download API to convert HTML to formatted plain text
- Updated email API to handle HTML content properly
- Notes now stored as HTML with rich formatting preserved

The editor provides a professional writing experience with all standard formatting tools while maintaining automatic save functionality and seamless integration with email/download features.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-07 09:47:23 -05:00
parent 3f1c573a67
commit 3a50cbebdd
5 changed files with 340 additions and 10 deletions

View File

@@ -42,7 +42,26 @@ export default defineEventHandler(async (event) => {
// Get user's notes
const noteRecord = getSermonNote(user.id!, sermonId)
const userNotes = noteRecord?.notes || 'No notes taken'
// Convert HTML to plain text for download
const htmlToText = (html: string) => {
if (!html) return 'No notes taken'
return html
.replace(/<br\s*\/?>/gi, '\n')
.replace(/<\/p>/gi, '\n')
.replace(/<p[^>]*>/gi, '')
.replace(/<\/h[1-6]>/gi, '\n')
.replace(/<h[1-6][^>]*>/gi, '')
.replace(/<li[^>]*>/gi, '• ')
.replace(/<\/li>/gi, '\n')
.replace(/<[^>]+>/g, '')
.replace(/&nbsp;/g, ' ')
.replace(/&amp;/g, '&')
.replace(/&lt;/g, '<')
.replace(/&gt;/g, '>')
.replace(/&quot;/g, '"')
.trim()
}
const userNotes = htmlToText(noteRecord?.notes || '')
// Format bible references
let bibleReferencesText = ''