import AutoExpandingTextArea from "@/components/Low/AutoExpandingTextarea"; import { Card, CardContent } from "@/components/ui/card"; import { useState } from "react"; import { MdEdit, MdEditOff } from "react-icons/md"; interface Props { value: string; onChange: (text: string) => void; wrapperCard?: boolean; } const PromptEdit: React.FC = ({ value, onChange, wrapperCard = true }) => { const [editing, setEditing] = useState(false); const renderTextWithLineBreaks = (text: string) => { const unescapedText = text.replace(/\\n/g, '\n'); return unescapedText.split('\n').map((line, index, array) => ( {line} {index < array.length - 1 &&
}
)); }; const promptEditTsx = (
{editing ? ( setEditing(false)} /> ) : (

Question/Instructions displayed to the student:

{renderTextWithLineBreaks(value)}

)}
); if (!wrapperCard) { return promptEditTsx; } return ( {promptEditTsx} ); }; export default PromptEdit;