cmd or ctrl enter to submit
This commit is contained in:
parent
06c75eb78e
commit
4a770b61b6
@ -110,7 +110,7 @@ function FormGroup ({ className, label, children }) {
|
|||||||
|
|
||||||
function InputInner ({ prepend, append, hint, showValid, ...props }) {
|
function InputInner ({ prepend, append, hint, showValid, ...props }) {
|
||||||
const [field, meta] = props.readOnly ? [{}, {}] : useField(props)
|
const [field, meta] = props.readOnly ? [{}, {}] : useField(props)
|
||||||
|
const formik = props.readOnly ? null : useFormikContext()
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<InputGroup hasValidation>
|
<InputGroup hasValidation>
|
||||||
@ -120,6 +120,11 @@ function InputInner ({ prepend, append, hint, showValid, ...props }) {
|
|||||||
</InputGroup.Prepend>
|
</InputGroup.Prepend>
|
||||||
)}
|
)}
|
||||||
<BootstrapForm.Control
|
<BootstrapForm.Control
|
||||||
|
onKeyDown={(e) => {
|
||||||
|
if (e.keyCode === 13 && (e.metaKey || e.ctrlKey)) {
|
||||||
|
formik?.submitForm()
|
||||||
|
}
|
||||||
|
}}
|
||||||
{...field} {...props}
|
{...field} {...props}
|
||||||
isInvalid={meta.touched && meta.error}
|
isInvalid={meta.touched && meta.error}
|
||||||
isValid={showValid && meta.touched && !meta.error}
|
isValid={showValid && meta.touched && !meta.error}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user