mirror of
https://github.com/hexastack/hexabot
synced 2025-02-01 23:23:51 +00:00
Merge pull request #466 from Hexastack/457-issue-content-add-edit-dialogs-are-missing-autofocus
Some checks are pending
Build and Push Docker API Image / build-and-push (push) Waiting to run
Build and Push Docker Base Image / build-and-push (push) Waiting to run
Build and Push Docker NLU Image / build-and-push (push) Waiting to run
Build and Push Docker UI Image / build-and-push (push) Waiting to run
Some checks are pending
Build and Push Docker API Image / build-and-push (push) Waiting to run
Build and Push Docker Base Image / build-and-push (push) Waiting to run
Build and Push Docker NLU Image / build-and-push (push) Waiting to run
Build and Push Docker UI Image / build-and-push (push) Waiting to run
fix(frontend): add missing autofocus for content add edit dialogs
This commit is contained in:
commit
5d5dbda90c
@ -53,12 +53,14 @@ interface ContentFieldInput {
|
||||
[key: string]: any;
|
||||
}
|
||||
>;
|
||||
idx: number;
|
||||
}
|
||||
|
||||
const ContentFieldInput: React.FC<ContentFieldInput> = ({
|
||||
contentField: contentField,
|
||||
field,
|
||||
errors,
|
||||
idx,
|
||||
}) => {
|
||||
const { t } = useTranslate();
|
||||
|
||||
@ -68,6 +70,7 @@ const ContentFieldInput: React.FC<ContentFieldInput> = ({
|
||||
case ContentFieldType.URL:
|
||||
return (
|
||||
<Input
|
||||
autoFocus={idx === 0}
|
||||
multiline={contentField.type === ContentFieldType.TEXTAREA}
|
||||
rows={contentField.type === ContentFieldType.TEXTAREA ? 5 : 1}
|
||||
label={t(`label.${contentField.name}`, {
|
||||
@ -225,7 +228,7 @@ export const ContentDialog: FC<ContentDialogProps> = ({
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<ContentContainer>
|
||||
{(contentType?.fields || []).map((contentField) => (
|
||||
{(contentType?.fields || []).map((contentField, index) => (
|
||||
<ContentItem key={contentField.name}>
|
||||
<Controller
|
||||
name={contentField.name}
|
||||
@ -248,6 +251,7 @@ export const ContentDialog: FC<ContentDialogProps> = ({
|
||||
contentField={contentField}
|
||||
field={field}
|
||||
errors={errors}
|
||||
idx={index}
|
||||
/>
|
||||
</FormControl>
|
||||
)}
|
||||
|
Loading…
Reference in New Issue
Block a user