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 88d91d3867..6f37267f3c 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 @@ -12,10 +12,11 @@ interface ICopyToClipboard { direction?: Placement, className?: string, title?: string, - children?: JSX.Element + children?: JSX.Element, + onmousedown?: any } export const CopyToClipboard = (props: ICopyToClipboard) => { - let { content, tip = 'Copy', icon = 'fa-copy', direction = 'right', children, ...otherProps } = props + let { content, tip = 'Copy', icon = 'fa-copy', direction = 'right', children, onmousedown, ...otherProps } = props const [message, setMessage] = useState(tip) const handleClick = (e) => { 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 @@ -41,7 +42,7 @@ export const CopyToClipboard = (props: ICopyToClipboard) => { return ( // eslint-disable-next-line jsx-a11y/anchor-is-valid - + { message } diff --git a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx index 2006999b35..0175f272f9 100644 --- a/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx +++ b/libs/remix-ui/run-tab/src/lib/components/contractGUI.tsx @@ -18,25 +18,6 @@ export function ContractGUI (props: ContractGUIProps) { const [clipboardContent, setClipboardContent] = useState('') const multiFields = useRef>([]) - useEffect(() => { - const multiString = getMultiValsString() - const multiJSON = JSON.parse('[' + multiString + ']') - let encodeObj - - if (props.evmBC) { - encodeObj = txFormat.encodeData(props.funcABI, multiJSON, props.evmBC) - } else { - encodeObj = txFormat.encodeData(props.funcABI, multiJSON, null) - } - if (encodeObj.error) { - console.error(encodeObj.error) - // throw new Error(encodeObj.error) - setClipboardContent(encodeObj.error) - } else { - setClipboardContent(encodeObj.data) - } - }, []) - useEffect(() => { if (props.title) { setTitle(props.title) @@ -75,6 +56,24 @@ export function ContractGUI (props: ContractGUIProps) { } }, [props.lookupOnly, props.funcABI, title]) + const onCTCMouseDown = () => { + const multiString = getMultiValsString() + const multiJSON = JSON.parse('[' + multiString + ']') + let encodeObj + + if (props.evmBC) { + encodeObj = txFormat.encodeData(props.funcABI, multiJSON, props.evmBC) + } else { + encodeObj = txFormat.encodeData(props.funcABI, multiJSON, null) + } + if (encodeObj.error) { + console.error(encodeObj.error) + setClipboardContent(encodeObj.error) + } else { + setClipboardContent(encodeObj.data) + } + } + const switchMethodViewOn = () => { setToggleContainer(true) makeMultiVal() @@ -187,7 +186,7 @@ export function ContractGUI (props: ContractGUIProps) { })}
- +