diff --git a/src/components/DialogAssetEdit/index.tsx b/src/components/DialogAssetEdit/index.tsx index 165dda41..08dc72a6 100644 --- a/src/components/DialogAssetEdit/index.tsx +++ b/src/components/DialogAssetEdit/index.tsx @@ -20,7 +20,6 @@ import AssetMetadata from '../AssetMetadata' import Dialog from '../Dialog' import DocumentList from '../DocumentList' import FileAssetPreview from '../FileAssetPreview' -import FormFieldInputFilename from '../FormFieldInputFilename' import FormFieldInputTags from '../FormFieldInputTags' import FormFieldInputText from '../FormFieldInputText' import FormFieldInputTextarea from '../FormFieldInputTextarea' @@ -35,14 +34,9 @@ type Props = { type FormData = yup.InferType const formSchema = yup.object().shape({ - originalFilename: yup.string().required('Filename cannot be empty') + originalFilename: yup.string().trim().required('Filename cannot be empty') }) -const getFilenameWithoutExtension = (asset?: Asset): string | undefined => { - const extensionIndex = asset?.originalFilename?.toLowerCase().lastIndexOf(`.${asset.extension}`) - return asset?.originalFilename?.slice(0, extensionIndex) -} - const DialogAssetEdit = (props: Props) => { const { children, @@ -73,7 +67,7 @@ const DialogAssetEdit = (props: Props) => { const generateDefaultValues = (asset?: Asset) => ({ altText: asset?.altText || '', description: asset?.description || '', - originalFilename: asset ? getFilenameWithoutExtension(asset) : undefined, + originalFilename: asset?.originalFilename || '', opt: {media: {tags: assetTagOptions}}, title: asset?.title || '' }) @@ -165,9 +159,7 @@ const DialogAssetEdit = (props: Props) => { _weak: true })) || null } - }, - // Append extension to filename - originalFilename: `${sanitizedFormData.originalFilename}.${assetItem?.asset.extension}` + } } }) ) @@ -323,14 +315,13 @@ const DialogAssetEdit = (props: Props) => { value={assetTagOptions} /> {/* Filename */} - {/* Title */} ((props: Props, ref) => { - const {description, disabled, error, extension, label, name, placeholder, value} = props - - return ( - - {/* Label */} - - - {/* Input */} - - - - - - - - - - ) -}) - -export default FormFieldInputText