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:
@@ -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(/ /g, ' ')
|
||||
.replace(/&/g, '&')
|
||||
.replace(/</g, '<')
|
||||
.replace(/>/g, '>')
|
||||
.replace(/"/g, '"')
|
||||
.trim()
|
||||
}
|
||||
const userNotes = htmlToText(noteRecord?.notes || '')
|
||||
|
||||
// Format bible references
|
||||
let bibleReferencesText = ''
|
||||
|
||||
@@ -41,10 +41,9 @@ export default defineEventHandler(async (event) => {
|
||||
})
|
||||
}
|
||||
|
||||
// Get user's notes
|
||||
// Get user's notes (already stored as HTML from rich text editor)
|
||||
const noteRecord = getSermonNote(user.id!, sermonId)
|
||||
// Convert line breaks to HTML breaks for email display
|
||||
const userNotes = noteRecord?.notes ? noteRecord.notes.replace(/\n/g, '<br>') : ''
|
||||
const userNotes = noteRecord?.notes || '<p>No notes taken</p>'
|
||||
|
||||
// Format bible references for HTML email
|
||||
let bibleReferencesText = ''
|
||||
|
||||
Reference in New Issue
Block a user