File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/Common/ClipboardButton Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import { useState , useEffect , useCallback } from 'react'
18
18
import Tippy from '@tippyjs/react'
19
- import { copyToClipboard , noop } from '../Helper'
19
+ import { copyToClipboard , noop , stopPropagation } from '../Helper'
20
20
import ClipboardProps from './types'
21
21
import { ReactComponent as ICCopy } from '../../Assets/Icon/ic-copy.svg'
22
22
import { ReactComponent as Check } from '../../Assets/Icon/ic-check.svg'
@@ -42,10 +42,16 @@ export default function ClipboardButton({
42
42
const [ copied , setCopied ] = useState < boolean > ( false )
43
43
const [ enableTippy , setEnableTippy ] = useState < boolean > ( false )
44
44
45
- const handleTextCopied = ( ) => setCopied ( true )
45
+ const handleTextCopied = ( ) => { setCopied ( true ) }
46
46
const handleEnableTippy = ( ) => setEnableTippy ( true )
47
47
const handleDisableTippy = ( ) => setEnableTippy ( false )
48
- const handleCopyContent = useCallback ( ( ) => copyToClipboard ( content , handleTextCopied ) , [ content ] )
48
+ const handleCopyContent = useCallback (
49
+ ( e ?) => {
50
+ stopPropagation ( e )
51
+ copyToClipboard ( content , handleTextCopied )
52
+ } ,
53
+ [ content ] ,
54
+ )
49
55
50
56
useEffect ( ( ) => {
51
57
if ( ! copied ) return
You can’t perform that action at this time.
0 commit comments