Merge pull request #167 from laymonage/use-innertext

Use `innerText` to copy code content
This commit is contained in:
Timothy 2021-08-07 17:53:31 +08:00 committed by GitHub
commit a73160947a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,7 +14,7 @@ const Pre = (props) => {
}
const onCopy = () => {
setCopied(true)
navigator.clipboard.writeText(textInput.current.textContent)
navigator.clipboard.writeText(textInput.current.innerText)
setTimeout(() => {
setCopied(false)
}, 2000)