diff --git a/package.json b/package.json index 08b116d..71441c6 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "@types/react": "^17.0.0", "@types/react-dom": "^17.0.0", "autoprefixer": "^9", + "copy-to-clipboard": "^3.3.1", "postcss": "^7", "react": "^17.0.2", "react-dom": "^17.0.2", diff --git a/src/components/App.tsx b/src/components/App.tsx index 8fdd670..ce095fa 100644 --- a/src/components/App.tsx +++ b/src/components/App.tsx @@ -1,11 +1,10 @@ import React, { useState } from "react" +import copy from "copy-to-clipboard" import RetakesConfig from "../types/RetakesConfig" import AllDecks from "./AllDecks" import MenuBar from "./MenuBar" import Modal from "./Modal" - - const App: React.FC = () => { const [retakesConfig,setRetakesConfig] = useState(new RetakesConfig()) const [showExport,setShowExport] = useState(false) @@ -31,10 +30,13 @@ const App: React.FC = () => { cols={50} rows={10} value={exportText} readOnly - className="text-black bg-transparent border-2 border-gray-900" + className="bg-transparent border-2 border-gray-900" /> -
Copy to clipboard
+
copy(exportText)} + >Copy to clipboard
) diff --git a/yarn.lock b/yarn.lock index 30a8cc1..efcbea8 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3649,6 +3649,13 @@ copy-descriptor@^0.1.0: resolved "https://registry.yarnpkg.com/copy-descriptor/-/copy-descriptor-0.1.1.tgz#676f6eb3c39997c2ee1ac3a924fd6124748f578d" integrity sha1-Z29us8OZl8LuGsOpJP1hJHSPV40= +copy-to-clipboard@^3.3.1: + version "3.3.1" + resolved "https://registry.yarnpkg.com/copy-to-clipboard/-/copy-to-clipboard-3.3.1.tgz#115aa1a9998ffab6196f93076ad6da3b913662ae" + integrity sha512-i13qo6kIHTTpCm8/Wup+0b1mVWETvu2kIMzKoK8FpkLkFxlt0znUAHcMzox+T8sPlqtZXq3CulEjQHsYiGFJUw== + dependencies: + toggle-selection "^1.0.6" + core-js-compat@^3.18.0, core-js-compat@^3.19.0, core-js-compat@^3.6.2: version "3.19.1" resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.19.1.tgz#fe598f1a9bf37310d77c3813968e9f7c7bb99476" @@ -10836,6 +10843,11 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" +toggle-selection@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/toggle-selection/-/toggle-selection-1.0.6.tgz#6e45b1263f2017fa0acc7d89d78b15b8bf77da32" + integrity sha1-bkWxJj8gF/oKzH2J14sVuL932jI= + toidentifier@1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.0.tgz#7e1be3470f1e77948bc43d94a3c8f4d7752ba553"