diff --git a/packages/edit-post/src/plugins/copy-content-menu-item/index.js b/packages/edit-post/src/plugins/copy-content-menu-item/index.js index 06c83f73d1077..af93ecb542ba6 100644 --- a/packages/edit-post/src/plugins/copy-content-menu-item/index.js +++ b/packages/edit-post/src/plugins/copy-content-menu-item/index.js @@ -2,17 +2,27 @@ * WordPress dependencies */ import { ClipboardButton } from '@wordpress/components'; -import { withSelect } from '@wordpress/data'; +import { withDispatch, withSelect } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { withState, compose } from '@wordpress/compose'; -function CopyContentMenuItem( { editedPostContent, hasCopied, setState } ) { +function CopyContentMenuItem( { createNotice, editedPostContent, hasCopied, setState } ) { return ( setState( { hasCopied: true } ) } + onCopy={ () => { + setState( { hasCopied: true } ); + createNotice( + 'info', + 'All content copied.', + { + isDismissible: true, + type: 'snackbar', + } + ); + } } onFinishCopy={ () => setState( { hasCopied: false } ) } > { hasCopied ? @@ -26,5 +36,14 @@ export default compose( withSelect( ( select ) => ( { editedPostContent: select( 'core/editor' ).getEditedPostAttribute( 'content' ), } ) ), + withDispatch( ( dispatch ) => { + const { + createNotice, + } = dispatch( 'core/notices' ); + + return { + createNotice, + }; + } ), withState( { hasCopied: false } ) )( CopyContentMenuItem );