diff --git a/apps/remix-ide/src/app/tabs/compile-tab.js b/apps/remix-ide/src/app/tabs/compile-tab.js index 775b251872..0b73843de7 100644 --- a/apps/remix-ide/src/app/tabs/compile-tab.js +++ b/apps/remix-ide/src/app/tabs/compile-tab.js @@ -11,7 +11,7 @@ import { compile } from '@remix-project/remix-solidity' const EventEmitter = require('events') const $ = require('jquery') const yo = require('yo-yo') -const copy = require('copy-text-to-clipboard') +const copy = require('copy-to-clipboard') var QueryParams = require('../../lib/query-params') const modalDialogCustom = require('../ui/modal-dialog-custom') const parseContracts = require('./compileTab/contractParser') diff --git a/apps/remix-ide/src/app/ui/copy-to-clipboard.js b/apps/remix-ide/src/app/ui/copy-to-clipboard.js index 9974cc5782..26c96b0d2f 100644 --- a/apps/remix-ide/src/app/ui/copy-to-clipboard.js +++ b/apps/remix-ide/src/app/ui/copy-to-clipboard.js @@ -1,6 +1,6 @@ var yo = require('yo-yo') // -------------- copyToClipboard ---------------------- -const copy = require('copy-text-to-clipboard') +const copy = require('copy-to-clipboard') var addTooltip = require('./tooltip') // -------------- styling ---------------------- var csjs = require('csjs-inject') 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 fbfdc6dfba..1f1a54d946 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 @@ -1,27 +1,26 @@ import React, { useState } from 'react' -import copy from 'copy-text-to-clipboard' +import copy from 'copy-to-clipboard' import { OverlayTrigger, Tooltip } from 'react-bootstrap' import './copy-to-clipboard.css' -export const CopyToClipboard = ({ content, tip='Copy', icon='fa-copy', ...otherProps }) => { +export const CopyToClipboard = ({ content, tip = 'Copy', icon = 'fa-copy', direction = 'right', ...otherProps }) => { const [message, setMessage] = useState(tip) - - const handleClick = (event) => { + 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 try { if (typeof content !== 'string') { content = JSON.stringify(content, null, '\t') } + copy(content) + setMessage('Copied') } catch (e) { console.error(e) } - copy(content) - setMessage('Copied') } else { setMessage('Cannot copy empty content!') } - event.preventDefault() + e.preventDefault() return false } diff --git a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx index 7bebc389d8..75342f0556 100644 --- a/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx +++ b/libs/remix-ui/solidity-compiler/src/lib/contract-selection.tsx @@ -165,7 +165,7 @@ export const ContractSelection = (props: ContractSelectionProps) => { const log =