diff --git a/src/content/UserPage/UserPage.js b/src/content/UserPage/UserPage.js index 9d2a48c..6b5a48e 100644 --- a/src/content/UserPage/UserPage.js +++ b/src/content/UserPage/UserPage.js @@ -7,6 +7,8 @@ const UserPage = () => { const [inputTextValue, inputTextSetValue] = React.useState('') const [outputTextValue, outputTextSetValue] = React.useState('') const [loading, loadingSetValue] = React.useState('') + const [copyButton, setCopyButton] = React.useState('') + const textAreaRef = React.useRef(null) const inputTextOnChange = e => { inputTextSetValue(e.target.value) @@ -43,12 +45,19 @@ const UserPage = () => { xhr.send(inputTextValue) loadingSetValue(true) } + setCopyButton(true) } const cleanText = () => { inputTextSetValue('') } + const handleCopy = e => { + textAreaRef.current.select() + document.execCommand('copy') + e.target.focus() + } + return (