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
@ -73,9 +71,9 @@ export function ContractGUI (props: ContractGUIProps) {
}
if(encodeObj.error){
console.error(encodeObj.error)
setClipboardContent(encodeObj.error)
returnencodeObj.error
}else{
setClipboardContent(encodeObj.data)
returnencodeObj.data
}
}
@ -191,7 +189,7 @@ export function ContractGUI (props: ContractGUIProps) {
})}
</div>
<divclassName="udapp_group udapp_multiArg">
<CopyToClipboardcontent={clipboardContent}tip='Encode values of input fields & copy to clipboard'icon='fa-clipboard'direction={'left'}onmousedown={onCTCMouseDown}/>
<CopyToClipboardtip='Encode values of input fields & copy to clipboard'icon='fa-clipboard'direction={'left'}getContent={getContentOnCTC}/>