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 3cbaf8697cd36..6600fc79d9c27 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,7 +2,7 @@ * WordPress dependencies */ import { MenuItem } from '@wordpress/components'; -import { useSelect, useDispatch } from '@wordpress/data'; +import { select, useDispatch } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; import { useCopyToClipboard } from '@wordpress/compose'; import { store as noticesStore } from '@wordpress/notices'; @@ -10,11 +10,6 @@ import { store as editorStore } from '@wordpress/editor'; export default function CopyContentMenuItem() { const { createNotice } = useDispatch( noticesStore ); - const getText = useSelect( - ( select ) => () => - select( editorStore ).getEditedPostAttribute( 'content' ), - [] - ); function onSuccess() { createNotice( 'info', __( 'All content copied.' ), { @@ -23,7 +18,10 @@ export default function CopyContentMenuItem() { } ); } - const ref = useCopyToClipboard( getText, onSuccess ); + const ref = useCopyToClipboard( + () => select( editorStore ).getEditedPostAttribute( 'content' ), + onSuccess + ); return { __( 'Copy all blocks' ) }; }