@ -18,10 +18,6 @@ export const UrlInput = (props: Props) => {
|
|||||||
let inputRef: HTMLInputElement | HTMLTextAreaElement | undefined
|
let inputRef: HTMLInputElement | HTMLTextAreaElement | undefined
|
||||||
|
|
||||||
const handleInput = (inputValue: string) => {
|
const handleInput = (inputValue: string) => {
|
||||||
if (!inputValue.startsWith('https://'))
|
|
||||||
return inputValue === 'https:/'
|
|
||||||
? undefined
|
|
||||||
: setInputValue(`https://${inputValue}`)
|
|
||||||
setInputValue(inputValue)
|
setInputValue(inputValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,6 +25,8 @@ export const UrlInput = (props: Props) => {
|
|||||||
inputRef?.value !== '' && inputRef?.reportValidity()
|
inputRef?.value !== '' && inputRef?.reportValidity()
|
||||||
|
|
||||||
const submit = () => {
|
const submit = () => {
|
||||||
|
if (inputRef && !inputRef?.value.startsWith('http'))
|
||||||
|
inputRef.value = `https://${inputRef.value}`
|
||||||
if (checkIfInputIsValid())
|
if (checkIfInputIsValid())
|
||||||
props.onSubmit({ value: inputRef?.value ?? inputValue() })
|
props.onSubmit({ value: inputRef?.value ?? inputValue() })
|
||||||
else inputRef?.focus()
|
else inputRef?.focus()
|
||||||
|
Reference in New Issue
Block a user