mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-05 09:27:23 +00:00
Unified file link format
This commit is contained in:
parent
1e1e611104
commit
19e051045d
5 changed files with 96 additions and 13 deletions
23
src/components/URLSelector.js
Normal file
23
src/components/URLSelector.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
import { h } from 'preact'
|
||||
|
||||
export default function ({ emitName, emitURL }) {
|
||||
const reURL = /^(http|https):\/\/[^ "]+$/
|
||||
|
||||
const emit = url => {
|
||||
emitName(url)
|
||||
emitURL(url)
|
||||
}
|
||||
|
||||
const urlInputHandler = ({ target }) => {
|
||||
const url = target.value
|
||||
emit(reURL.test(url)
|
||||
? url
|
||||
: null)
|
||||
}
|
||||
|
||||
return (
|
||||
<input
|
||||
type='text'
|
||||
placeholder='https://...'
|
||||
onInput={urlInputHandler} />)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue