diff --git a/components/text.js b/components/text.js index ec9cd7fb..e7a21c00 100644 --- a/components/text.js +++ b/components/text.js @@ -13,6 +13,12 @@ import GithubSlugger from 'github-slugger' import Link from '../svgs/link.svg' import {toString} from 'mdast-util-to-string' +function copyToClipboard (id) { + if (navigator && navigator.clipboard && navigator.clipboard.writeText) + return navigator.clipboard.writeText(str); + return Promise.reject('The Clipboard API is not available.'); +} + function myRemarkPlugin () { return (tree) => { visit(tree, (node) => { @@ -38,7 +44,13 @@ function Heading ({ h, slugger, noFragments, topLevel, children, node, ...props return (