mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
select entire share url on click
This commit is contained in:
parent
5e2d399fb2
commit
db83b7a99c
1 changed files with 6 additions and 0 deletions
|
|
@ -8,6 +8,11 @@ const styles = require('./styles');
|
|||
|
||||
const SharePrompt = ({ className, url }) => {
|
||||
const inputRef = React.useRef(null);
|
||||
const selectInputContent = React.useCallback(() => {
|
||||
if (inputRef.current !== null) {
|
||||
inputRef.current.select();
|
||||
}
|
||||
}, []);
|
||||
const copyToClipboard = React.useCallback(() => {
|
||||
if (inputRef.current !== null) {
|
||||
inputRef.current.select();
|
||||
|
|
@ -38,6 +43,7 @@ const SharePrompt = ({ className, url }) => {
|
|||
type={'text'}
|
||||
readOnly={true}
|
||||
defaultValue={url}
|
||||
onClick={selectInputContent}
|
||||
tabIndex={-1}
|
||||
/>
|
||||
<Button className={styles['copy-button']} onClick={copyToClipboard}>
|
||||
|
|
|
|||
Loading…
Reference in a new issue