diff --git a/examples/crm/src/companies/CompanyInputs.tsx b/examples/crm/src/companies/CompanyInputs.tsx index f9141c93b3..181a4f5c9b 100644 --- a/examples/crm/src/companies/CompanyInputs.tsx +++ b/examples/crm/src/companies/CompanyInputs.tsx @@ -16,8 +16,8 @@ import { import { isLinkedinUrl } from '../misc/isLinkedInUrl'; import { useConfigurationContext } from '../root/ConfigurationContext'; import { Sale } from '../types'; -import { CompanyAvatar } from './CompanyAvatar'; import { sizes } from './sizes'; +import ImageEditorField from '../misc/ImageEditorField'; const isUrl = (url: string) => { if (!url) return; @@ -64,7 +64,12 @@ export const CompanyInputs = () => { const CompanyDisplayInputs = () => { return ( - + ); diff --git a/examples/crm/src/misc/ImageEditorField.tsx b/examples/crm/src/misc/ImageEditorField.tsx index 25c0849850..ed379b97d9 100644 --- a/examples/crm/src/misc/ImageEditorField.tsx +++ b/examples/crm/src/misc/ImageEditorField.tsx @@ -21,7 +21,7 @@ import { DialogCloseButton } from './DialogCloseButton'; const ImageEditorField = (props: ImageEditorFieldProps) => { const { getValues } = useFormContext(); - const imageUrl = getValues()[props.source]; + const imageUrl = getValues(props.source); const [isDialogOpen, setIsDialogOpen] = useState(false); if (!imageUrl) { @@ -72,7 +72,7 @@ const ImageEditorDialog = (props: ImageEditorDialogProps) => { const croppedImage = cropper?.getCroppedCanvas().toDataURL(); if (croppedImage) { setImageSrc(croppedImage); - setValue(props.source, croppedImage); + setValue(props.source, croppedImage, { shouldDirty: true }); props.onClose(); if (props.onSave) {