From 8f40ef524ea762f0edfea49c65a97e11c8306445 Mon Sep 17 00:00:00 2001 From: Manh Hung Nguyen Date: Tue, 6 Feb 2024 16:36:01 +0700 Subject: [PATCH] Fix cannot get file name for Richtext Fixes: AFORM-3942 --- .../src/components/elements/ParagraphTextElementBlock.tsx | 5 +++-- .../forms-sdk/src/helpers/buildConfirmationMessage.ts | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/@episerver/forms-react/src/components/elements/ParagraphTextElementBlock.tsx b/src/@episerver/forms-react/src/components/elements/ParagraphTextElementBlock.tsx index 4ec6057..15746bb 100644 --- a/src/@episerver/forms-react/src/components/elements/ParagraphTextElementBlock.tsx +++ b/src/@episerver/forms-react/src/components/elements/ParagraphTextElementBlock.tsx @@ -1,4 +1,4 @@ -import { FormContainer, ParagraphText, getStringValue } from "@episerver/forms-sdk" +import { FormContainer, FormStorage, ParagraphText, getStringValue } from "@episerver/forms-sdk" import React, { useMemo } from "react"; import ElementWrapper from "./shared/ElementWrapper"; import { useElement } from "../../hooks/useElement"; @@ -16,8 +16,9 @@ export const ParagraphTextElementBlock = (props: ParagraphTextElementBlockProps) const formContext = useForms(); const form = formContext?.formContainer as FormContainer const formKey = form.key; + const formStorage = new FormStorage(form); - const data = formContext?.formSubmissions ?? [] + const data = formStorage.loadFormDataFromStorage() ?? formContext?.formSubmissions ?? [] const doReplaceText = element.properties.disablePlaceholdersReplacement ?? true diff --git a/src/@episerver/forms-sdk/src/helpers/buildConfirmationMessage.ts b/src/@episerver/forms-sdk/src/helpers/buildConfirmationMessage.ts index 4a81585..344a3f5 100644 --- a/src/@episerver/forms-sdk/src/helpers/buildConfirmationMessage.ts +++ b/src/@episerver/forms-sdk/src/helpers/buildConfirmationMessage.ts @@ -22,8 +22,7 @@ export function getStringValue(element: FormSubmission) { const fileList = value let fileNames = "" for (let i = 0; i < fileList.length; i++) { - const file = fileList[i].file - fileNames += `${file.name}` + fileNames += `${fileList[i].name}` if (fileList.length > 0) { fileNames += " | " }