Skip to content

Commit

Permalink
added autofocus attribute for texarea
Browse files Browse the repository at this point in the history
  • Loading branch information
Nitvex committed Oct 28, 2022
1 parent 78a7a30 commit 6a89648
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const Open: FC<Props> = (props) => {
isRecognizeDisabled={isRecognizeDisabled}
structStr={structStr}
inputHandler={setStructStr}
autoFocus
/>
</Dialog>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,21 @@ import classes from '../Open.module.less'
export type TextEditorProps = {
structStr: string
inputHandler: (str: string) => void
autoFocus?: boolean
}

export const TextEditor = ({ structStr, inputHandler }: TextEditorProps) => {
export const TextEditor = ({
structStr,
inputHandler,
autoFocus = false
}: TextEditorProps) => {
return (
<>
<textarea
className={classes.textareaEditor}
value={structStr}
onChange={(event) => inputHandler(event.target.value)}
autoFocus={autoFocus}
/>
</>
)
Expand Down

0 comments on commit 6a89648

Please sign in to comment.