import { Sheet, SheetContent, SheetHeader, SheetTitle } from '@/components/ui/sheet'; import { Textarea } from '@/components/ui/textarea'; import { useMitt } from '@/plugins/MittContext'; import useVideoEditorStore from '@/stores/VideoEditorStore'; import { Type } from 'lucide-react'; import { useEffect, useState } from 'react'; export default function TextSidebar({ isOpen, onClose }) { const { selectedTextElement } = useVideoEditorStore(); const emitter = useMitt(); const [textValue, setTextValue] = useState(''); // Update textarea when selected element changes useEffect(() => { if (selectedTextElement) { setTextValue(selectedTextElement.text || ''); } }, [selectedTextElement]); // Handle text changes const handleTextChange = (e) => { const newText = e.target.value; setTextValue(newText); if (selectedTextElement) { emitter.emit('text-update', { elementId: selectedTextElement.id, updates: { text: newText }, }); } }; return ( !open && onClose()}> Edit Text
{selectedTextElement ? ( <>