import { useEffect } from 'react' import Box from '@mui/material/Box' import { EditorContent, useEditor } from '@tiptap/react' import TiptapStarterKit from '@tiptap/starter-kit' type RichTextMessageContentProps = { value: string tone?: 'default' | 'review' | 'chat' } export function RichTextMessageContent({ value, tone = 'default' }: RichTextMessageContentProps) { const editor = useEditor({ extensions: [ TiptapStarterKit.configure({ heading: false, codeBlock: false, blockquote: false, horizontalRule: false }), ], content: value.trim() ? value : '

', editable: false, }) useEffect(() => { if (!editor) return const normalizedValue = value.trim() ? value : '

' if (editor.getHTML() === normalizedValue) return editor.commands.setContent(normalizedValue, false) }, [editor, value]) return ( ) }