Unverified Commit c2102b79 authored by bunsenstraat's avatar bunsenstraat Committed by GitHub

Merge pull request #1335 from ethereum/copyfix

href shouldn't work
parents 941d0b63 92f36d8d
......@@ -6,7 +6,7 @@ import './copy-to-clipboard.css'
export const CopyToClipboard = ({ content, tip='Copy', icon='fa-copy', ...otherProps }) => {
const [message, setMessage] = useState(tip)
const handleClick = () => {
const handleClick = (event) => {
if (content && content !== '') { // module `copy` keeps last copied thing in the memory, so don't show tooltip if nothing is copied, because nothing was added to memory
try {
if (typeof content !== 'string') {
......@@ -20,6 +20,8 @@ export const CopyToClipboard = ({ content, tip='Copy', icon='fa-copy', ...otherP
} else {
setMessage('Cannot copy empty content!')
}
event.preventDefault()
return false
}
const reset = () => {
......@@ -27,7 +29,7 @@ export const CopyToClipboard = ({ content, tip='Copy', icon='fa-copy', ...otherP
}
return (
<a href="#" onClick={handleClick} onMouseLeave={reset}>
<a href='#' onClick={handleClick} onMouseLeave={reset}>
<OverlayTrigger placement="right" overlay={
<Tooltip id="overlay-tooltip">
{ message }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment