From d4d094ec95d38f3f5485b8cd6fd3bf7a7a805b57 Mon Sep 17 00:00:00 2001 From: hanif salafi Date: Mon, 21 Jul 2025 11:07:08 +0700 Subject: [PATCH] feat: update form description --- components/form/content/audio-form.tsx | 3 ++- components/form/content/audio-update-form.tsx | 3 ++- components/form/content/image-form.tsx | 3 ++- components/form/content/image-update-form.tsx | 3 ++- components/form/content/teks-form.tsx | 3 ++- components/form/content/teks-update-form.tsx | 3 ++- components/form/content/teks-update-seo.tsx | 3 ++- components/form/content/video-form.tsx | 3 ++- components/form/content/video-update-form.tsx | 3 ++- 9 files changed, 18 insertions(+), 9 deletions(-) diff --git a/components/form/content/audio-form.tsx b/components/form/content/audio-form.tsx index 24bf5174..9b354a1b 100644 --- a/components/form/content/audio-form.tsx +++ b/components/form/content/audio-form.tsx @@ -57,6 +57,7 @@ import { getCsrfToken } from "@/service/auth"; import { Link } from "@/i18n/routing"; import { useTranslations } from "next-intl"; import { useParams } from "next/navigation"; +import { htmlToString } from "@/utils/globals"; interface FileWithPreview extends File { preview: string; @@ -543,7 +544,7 @@ export default function FormAudio() { } = { ...data, title: finalTitle, - description: finalDescription, + description: htmlToString(finalDescription), htmlDescription: finalDescription, fileTypeId, categoryId: selectedCategory, diff --git a/components/form/content/audio-update-form.tsx b/components/form/content/audio-update-form.tsx index d262a28a..e5db2adf 100644 --- a/components/form/content/audio-update-form.tsx +++ b/components/form/content/audio-update-form.tsx @@ -50,6 +50,7 @@ import { getCsrfToken } from "@/service/auth"; import { Upload } from "tus-js-client"; import { useTranslations } from "next-intl"; import dynamic from "next/dynamic"; +import { htmlToString } from "@/utils/globals"; const audioSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -348,7 +349,7 @@ export default function FormAudioUpdate() { ...data, id: detail?.id, title: data.title, - description: data.description, + description: htmlToString(data.description), htmlDescription: data.description, fileTypeId, categoryId: selectedTarget, diff --git a/components/form/content/image-form.tsx b/components/form/content/image-form.tsx index 6e6b11ac..c0704b89 100644 --- a/components/form/content/image-form.tsx +++ b/components/form/content/image-form.tsx @@ -60,6 +60,7 @@ import { Link } from "@/i18n/routing"; import { request } from "http"; import { useLocale, useTranslations } from "next-intl"; import { toast } from "sonner"; +import { htmlToString } from "@/utils/globals"; interface FileWithPreview extends File { preview: string; @@ -564,7 +565,7 @@ export default function FormImage() { } = { ...data, title: finalTitle, - description: finalDescription, + description: htmlToString(finalDescription), htmlDescription: finalDescription, fileTypeId, categoryId: selectedCategory, diff --git a/components/form/content/image-update-form.tsx b/components/form/content/image-update-form.tsx index 4f6f0f1a..ce7a4426 100644 --- a/components/form/content/image-update-form.tsx +++ b/components/form/content/image-update-form.tsx @@ -48,6 +48,7 @@ import { error, loading } from "@/lib/swal"; import { getCsrfToken } from "@/service/auth"; import { Upload } from "tus-js-client"; import { useTranslations } from "next-intl"; +import { htmlToString } from "@/utils/globals"; const imageSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -358,7 +359,7 @@ export default function FormImageUpdate() { ...data, id: detail?.id, title: data.title, - description: data.description, + description: htmlToString(data.description), htmlDescription: data.description, fileTypeId, categoryId: selectedTarget, diff --git a/components/form/content/teks-form.tsx b/components/form/content/teks-form.tsx index fb6004dc..57b55602 100644 --- a/components/form/content/teks-form.tsx +++ b/components/form/content/teks-form.tsx @@ -56,6 +56,7 @@ import dynamic from "next/dynamic"; import { getCsrfToken } from "@/service/auth"; import { Link } from "@/i18n/routing"; import { useTranslations } from "next-intl"; +import { htmlToString } from "@/utils/globals"; interface FileWithPreview extends File { preview: string; @@ -573,7 +574,7 @@ export default function FormTeks() { } = { ...data, title: finalTitle, - description: finalDescription, + description: htmlToString(finalDescription), htmlDescription: finalDescription, fileTypeId, categoryId: selectedCategory, diff --git a/components/form/content/teks-update-form.tsx b/components/form/content/teks-update-form.tsx index 8a19fb1c..bd80c47f 100644 --- a/components/form/content/teks-update-form.tsx +++ b/components/form/content/teks-update-form.tsx @@ -46,6 +46,7 @@ import { Upload } from "tus-js-client"; import { getCsrfToken } from "@/service/auth"; import { useTranslations } from "next-intl"; import dynamic from "next/dynamic"; +import { htmlToString } from "@/utils/globals"; const teksSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -337,7 +338,7 @@ export default function FormTeksUpdate() { ...data, id: detail?.id, title: data.title, - description: data.description, + description: htmlToString(data.description), htmlDescription: data.description, fileTypeId, categoryId: selectedTarget, diff --git a/components/form/content/teks-update-seo.tsx b/components/form/content/teks-update-seo.tsx index 488354f5..bb79ed0a 100644 --- a/components/form/content/teks-update-seo.tsx +++ b/components/form/content/teks-update-seo.tsx @@ -62,6 +62,7 @@ import { Legend, ChartOptions, } from "chart.js"; +import { htmlToString } from "@/utils/globals"; ChartJS.register(ArcElement, Tooltip, Legend); const imageSchema = z.object({ @@ -349,7 +350,7 @@ export default function FormTeksSeo() { ...data, id: detail?.id, title: data.title, - description: data.description, + description: htmlToString(data.description), htmlDescription: data.description, fileTypeId, categoryId: selectedTarget, diff --git a/components/form/content/video-form.tsx b/components/form/content/video-form.tsx index c7786b45..d0c0f373 100644 --- a/components/form/content/video-form.tsx +++ b/components/form/content/video-form.tsx @@ -56,6 +56,7 @@ import dynamic from "next/dynamic"; import { getCsrfToken } from "@/service/auth"; import { Link } from "@/i18n/routing"; import { useTranslations } from "next-intl"; +import { htmlToString } from "@/utils/globals"; const CustomEditor = dynamic( () => { @@ -559,7 +560,7 @@ export default function FormVideo() { } = { ...data, title: finalTitle, - description: finalDescription, + description: htmlToString(finalDescription), htmlDescription: finalDescription, fileTypeId, categoryId: selectedCategory, diff --git a/components/form/content/video-update-form.tsx b/components/form/content/video-update-form.tsx index 0cea11d7..f84666eb 100644 --- a/components/form/content/video-update-form.tsx +++ b/components/form/content/video-update-form.tsx @@ -56,6 +56,7 @@ import { getCsrfToken } from "@/service/auth"; import { error, loading } from "@/lib/swal"; import { useTranslations } from "next-intl"; import dynamic from "next/dynamic"; +import { htmlToString } from "@/utils/globals"; const videoSchema = z.object({ title: z.string().min(1, { message: "Judul diperlukan" }), @@ -423,7 +424,7 @@ export default function FormVideoUpdate() { ...data, id: detail?.id, title: data.title, - description: data.description, + description: htmlToString(data.description), htmlDescription: data.description, fileTypeId, categoryId: selectedTarget,