From 92f36d8d5360d9548c75691a0df3e66e513269dc Mon Sep 17 00:00:00 2001 From: filip mertens Date: Mon, 28 Jun 2021 11:50:14 +0200 Subject: [PATCH] fixes href working --- .../src/lib/copy-to-clipboard/copy-to-clipboard.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx b/libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx index e382d9dd7c..2bea5aed07 100644 --- a/libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx +++ b/libs/remix-ui/clipboard/src/lib/copy-to-clipboard/copy-to-clipboard.tsx @@ -6,8 +6,8 @@ import './copy-to-clipboard.css' export const CopyToClipboard = ({ content, tip='Copy', icon='fa-copy', ...otherProps }) => { const [message, setMessage] = useState(tip) - const handleClick = () => { - 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 + 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') { content = JSON.stringify(content, null, '\t') @@ -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,10 +29,10 @@ export const CopyToClipboard = ({ content, tip='Copy', icon='fa-copy', ...otherP } return ( - + - { message } + { message } }>