"use client"; import React, { useState } from 'react'; import { useForm, Controller } from 'react-hook-form'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Card } from '@/components/ui/card'; import CustomEditor from './custom-editor'; import FormEditor from './form-editor'; export default function EditorTest() { const [testData, setTestData] = useState('Initial test content'); const [editorType, setEditorType] = useState('custom'); const { control, setValue, watch, handleSubmit } = useForm({ defaultValues: { title: 'Test Title', description: testData, creatorName: 'Test Creator' } }); const watchedValues = watch(); const handleSetValue = () => { const newContent = `
Updated content at ${new Date().toLocaleTimeString()}
This content was set via setValue
`; setValue('description', newContent); setTestData(newContent); }; const handleSetEmpty = () => { setValue('description', ''); setTestData(''); }; const handleSetHTML = () => { const htmlContent = `This is a bold paragraph with italic text.
Updated at: ${new Date().toLocaleTimeString()}
`; setValue('description', htmlContent); setTestData(htmlContent); }; const onSubmit = (data: any) => { console.log('Form submitted:', data); alert('Form submitted! Check console for data.'); }; return ({JSON.stringify(watchedValues, null, 2)}