Skip to content

Commit

Permalink
Add copy to clipboard to CopyButton
Browse files Browse the repository at this point in the history
Resolves #17
  • Loading branch information
salcode committed Feb 25, 2022
1 parent 871444b commit 47726d3
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/CopyButton/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import PropTypes from 'prop-types';

import { useCopyToClipboard } from '@wordpress/compose';
import { __ } from '@wordpress/i18n';

export default function CopyButton({
content,
}) {
const ref = useCopyToClipboard(content);
return (
<button>
<button
ref={ref}
>
{__( 'Copy Block Data', 'block-xray-attributes' )}
</button>
);
Expand Down

0 comments on commit 47726d3

Please sign in to comment.