feat: implement Tiptap rich text editor and integrate it into admin question management

This commit is contained in:
2026-06-05 19:05:21 +07:00 Unverified
parent 2014c1470f
commit 005e95a556
6 changed files with 374 additions and 12 deletions
+4 -3
View File
@@ -21,6 +21,7 @@ import {
} from "@/app/actions/questions";
import { Plus, Trash, ArrowUp, ArrowDown, Loader2, Save, Image as ImageIcon, X } from "lucide-react";
import Image from 'next/image';
import { RichTextEditor } from "@/components/ui/rich-text-editor";
interface Question {
id: string;
@@ -286,11 +287,11 @@ export default function FormEditorClient({ form, initialQuestions }: FormEditorC
<CardContent className="pt-6 space-y-4">
<div className="flex flex-col sm:flex-row items-start sm:items-center gap-4">
<div className="flex-1 w-full">
<Textarea
<RichTextEditor
value={q.label}
onChange={(e) => handleUpdateQuestion(q.id, { label: e.target.value })}
onChange={(html) => handleUpdateQuestion(q.id, { label: html })}
placeholder="Question Text"
className="font-medium text-base w-full min-h-10 py-2"
className="w-full"
/>
</div>
<div className="flex items-center gap-2 self-end sm:self-auto">