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(typeofcontent!=='string'){
content=JSON.stringify(content,null,'\t')
}
copy(content)
setMessage('Copied')
}catch(e){
console.error(e)
constcopyData=()=>{
try{
if(content===''){
setMessage('Cannot copy empty content!')
return
}
if(typeofcontent!=='string'){
content=JSON.stringify(content,null,'\t')
}
copy(content)
setMessage('Copied')
}catch(e){
console.error(e)
}
}
consthandleClick=(e)=>{
if(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