Skip to content

Commit

Permalink
Merge pull request #1790 from Nitvex/#1789-add-autofocus-for-textarea…
Browse files Browse the repository at this point in the history
…-in-open

added autofocus attribute for texarea
  • Loading branch information
evgeniiFrolov1 authored Oct 28, 2022
2 parents cce0afe + 6a89648 commit f80ddbf
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 f80ddbf

Please sign in to comment.