From 7372f24894f9ae3594d04ba22dca7f88f01e3738 Mon Sep 17 00:00:00 2001 From: Amy Benson Date: Thu, 19 Dec 2024 11:54:52 +0000 Subject: [PATCH] EES-5580 validate EditableContentForm on submit after reinitialisation --- .../src/components/editable/EditableContentForm.tsx | 1 + .../src/components/form/FormFieldEditor.tsx | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/explore-education-statistics-admin/src/components/editable/EditableContentForm.tsx b/src/explore-education-statistics-admin/src/components/editable/EditableContentForm.tsx index 658e0aaaf4f..329fa85c165 100644 --- a/src/explore-education-statistics-admin/src/components/editable/EditableContentForm.tsx +++ b/src/explore-education-statistics-admin/src/components/editable/EditableContentForm.tsx @@ -289,6 +289,7 @@ const EditableContentForm = ({ onChange={setElements} onCancelComment={toggleCommentAddForm.off} onClickAddComment={toggleCommentAddForm.on} + onElementsReady={setElements} onImageUpload={onImageUpload} onImageUploadCancel={onImageUploadCancel} /> diff --git a/src/explore-education-statistics-admin/src/components/form/FormFieldEditor.tsx b/src/explore-education-statistics-admin/src/components/form/FormFieldEditor.tsx index bc969779e6f..678339f261f 100644 --- a/src/explore-education-statistics-admin/src/components/form/FormFieldEditor.tsx +++ b/src/explore-education-statistics-admin/src/components/form/FormFieldEditor.tsx @@ -42,6 +42,7 @@ export default function FormFieldEditor({ testId, onBlur, onChange, + onElementsReady, ...props }: Props) { const { @@ -86,7 +87,10 @@ export default function FormFieldEditor({ } }} onElementsChange={handleElements} - onElementsReady={handleElements} + onElementsReady={els => { + handleElements(els); + onElementsReady?.(els); + }} onChange={nextValue => { setValue( name,