diff --git a/components/details/details-content.tsx b/components/details/details-content.tsx
index 7eddee8..c091a55 100644
--- a/components/details/details-content.tsx
+++ b/components/details/details-content.tsx
@@ -313,6 +313,23 @@ export default function DetailContent() {
);
}
+ function decodeHtmlString(raw: string = "") {
+ if (!raw) return "";
+
+ // 1️⃣ Hapus newline escape, backslash, dsb
+ let decoded = raw
+ .replace(/\\n/g, "\n")
+ .replace(/\\"/g, '"') // ubah \" jadi "
+ .replace(/\\'/g, "'") // ubah \' jadi '
+ .replace(/\\\\/g, "\\") // ubah \\ jadi \
+ .trim();
+
+ // 2️⃣ Decode entity HTML (misal ")
+ const el = document.createElement("textarea");
+ el.innerHTML = decoded;
+ return el.value;
+ }
+
return (
<>
@@ -472,7 +489,9 @@ export default function DetailContent() {
diff --git a/components/form/article/edit-article-form.tsx b/components/form/article/edit-article-form.tsx
index 06b15bd..b0c0d09 100644
--- a/components/form/article/edit-article-form.tsx
+++ b/components/form/article/edit-article-form.tsx
@@ -193,7 +193,13 @@ export default function EditArticleForm(props: { isDetail: boolean }) {
setValue("customCreatorName", data?.customCreatorName);
setValue("slug", data?.slug);
setValue("source", data?.source);
- setValue("description", data?.htmlDescription);
+ const cleanDescription = data?.htmlDescription
+ ? data.htmlDescription
+ .replace(/\\"/g, '"')
+ .replace(/\\n/g, "\n", "\\") // ubah newline escaped
+ .trim()
+ : "";
+ setValue("description", cleanDescription);
setValue("tags", data?.tags ? data.tags.split(",") : []);
setThumbnail(data?.thumbnailUrl);
setDiseId(data?.aiArticleId);