import { Box, Button, ButtonGroup, Paper, TextField, Typography } from '@mui/material'; import Markdown from 'markdown-to-jsx'; import React, { useState } from 'react'; import { useTranslation } from "react-i18next"; import { MarkdownOptions } from "@/core/lib/markdown"; interface MarkdownEditorProps { value: string; onChange: (value: string) => void; label?: string; error?: boolean; helperText?: string; } export const MarkdownEditor: React.FC = ({ value, onChange, label, error, helperText }) => { const [isPreview, setIsPreview] = useState(false); const [t] = useTranslation(); const resolvedLabel = label ?? t('description'); return ( {resolvedLabel} {isPreview ? ( {/* The library handles the parsing based on our secure options */} {value || '*No content*'} ) : ( onChange(e.target.value)} error={error} helperText={helperText} placeholder={t('useMarkdownHint')} /> )} ); };