From 8f77b6b1852b45723fa31d9c594ac1f96b54bb84 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 10 Dec 2019 13:43:23 +0300 Subject: [PATCH] Added 3rdparty library to clipboard --- cvat-ui/package.json | 1 + cvat-ui/src/components/cvat-app.tsx | 2 +- cvat-ui/src/components/task-page/job-list.tsx | 5 +++-- cvat-ui/src/utils/copy-to-clipboard.ts | 8 -------- 4 files changed, 5 insertions(+), 11 deletions(-) delete mode 100644 cvat-ui/src/utils/copy-to-clipboard.ts diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 59b3196f..84c8c2da 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -41,6 +41,7 @@ "@types/react-router-dom": "^5.1.0", "@types/react-share": "^3.0.1", "antd": "^3.25.2", + "copy-to-clipboard": "^3.2.0", "dotenv-webpack": "^1.7.0", "moment": "^2.24.0", "prop-types": "^15.7.2", diff --git a/cvat-ui/src/components/cvat-app.tsx b/cvat-ui/src/components/cvat-app.tsx index 2c642fee..4da7a460 100644 --- a/cvat-ui/src/components/cvat-app.tsx +++ b/cvat-ui/src/components/cvat-app.tsx @@ -139,7 +139,7 @@ export default class CVATApplication extends React.PureComponent { /> ), duration: null, - description: error.length > 200 ? 'Open browser console to get details' : error, + description: error.length > 200 ? 'Open the Browser Console to get details' : error, }); console.error(error); diff --git a/cvat-ui/src/components/task-page/job-list.tsx b/cvat-ui/src/components/task-page/job-list.tsx index 77f75b4a..bf2d1a88 100644 --- a/cvat-ui/src/components/task-page/job-list.tsx +++ b/cvat-ui/src/components/task-page/job-list.tsx @@ -12,10 +12,11 @@ import { import Text from 'antd/lib/typography/Text'; import moment from 'moment'; +import copy from 'copy-to-clipboard'; import UserSelector from './user-selector'; import getCore from '../../core'; -import copyToClipboard from '../../utils/copy-to-clipboard'; + const core = getCore(); @@ -145,7 +146,7 @@ export default function JobListComponent(props: Props): JSX.Element { } serialized += '\n'; } - copyToClipboard(serialized); + copy(serialized); }} > diff --git a/cvat-ui/src/utils/copy-to-clipboard.ts b/cvat-ui/src/utils/copy-to-clipboard.ts deleted file mode 100644 index 561b25d1..00000000 --- a/cvat-ui/src/utils/copy-to-clipboard.ts +++ /dev/null @@ -1,8 +0,0 @@ -export default function copyToClipboard(str: string): void { - const el = document.createElement('textarea'); - el.value = str; - document.body.appendChild(el); - el.select(); - document.execCommand('copy'); - document.body.removeChild(el); -}