Skip to content

Commit

Permalink
feat: prop for disabling attaches in form editor
Browse files Browse the repository at this point in the history
  • Loading branch information
nyet-ty committed Jul 24, 2023
1 parent 3739cac commit fb98e68
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/FormEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ interface FormEditorProps {
error?: {
message?: string;
};
disableAttaches?: boolean;

messages?: {
attachmentsButton: string;
Expand Down Expand Up @@ -266,6 +267,7 @@ export const FormEditor = React.forwardRef<HTMLDivElement, FormEditorProps>(
onBlur,
onCancel,
messages = {},
disableAttaches,
},
ref,
) => {
Expand Down Expand Up @@ -411,7 +413,7 @@ export const FormEditor = React.forwardRef<HTMLDivElement, FormEditorProps>(
{...onESC}
onClick={disabled ? undefined : () => {}}
>
{nullable(isDragActive, () => (
{nullable(isDragActive && !disableAttaches, () => (
<StyledDropZone>
<input {...uploadInputProps} />
</StyledDropZone>
Expand Down Expand Up @@ -460,7 +462,7 @@ export const FormEditor = React.forwardRef<HTMLDivElement, FormEditorProps>(
onMount={handleEditorDidMount}
/>

{nullable(focused, () => (
{nullable(focused && !disableAttaches, () => (
<StyledUploadButton>
<StyledUploadInput onChange={onFileInputChange} type="file" multiple />

Expand Down

0 comments on commit fb98e68

Please sign in to comment.