diff --git a/packages/edit-site/src/components/actions/index.js b/packages/edit-site/src/components/actions/index.js
index ca673e3867bdaf..3c185cfe0661fc 100644
--- a/packages/edit-site/src/components/actions/index.js
+++ b/packages/edit-site/src/components/actions/index.js
@@ -6,7 +6,7 @@ import { addQueryArgs } from '@wordpress/url';
import { useDispatch } from '@wordpress/data';
import { decodeEntities } from '@wordpress/html-entities';
import { store as coreStore } from '@wordpress/core-data';
-import { __, sprintf } from '@wordpress/i18n';
+import { __, sprintf, _n } from '@wordpress/i18n';
import { store as noticesStore } from '@wordpress/notices';
import { useMemo } from '@wordpress/element';
import { privateApis as routerPrivateApis } from '@wordpress/router';
@@ -28,23 +28,34 @@ export const trashPostAction = {
id: 'move-to-trash',
label: __( 'Move to Trash' ),
isPrimary: true,
+ isBulk: true,
icon: trash,
isEligible( { status } ) {
return status !== 'trash';
},
hideModalHeader: true,
- RenderModal: ( { item: post, closeModal } ) => {
+ RenderModal: ( { items: posts, closeModal } ) => {
const { createSuccessNotice, createErrorNotice } =
useDispatch( noticesStore );
const { deleteEntityRecord } = useDispatch( coreStore );
return (
- { sprintf(
- // translators: %s: The page's title.
- __( 'Are you sure you want to delete "%s"?' ),
- decodeEntities( post.title.rendered )
- ) }
+ { posts.length > 1
+ ? sprintf(
+ // translators: %s: The number of posts (always plural).
+ __(
+ 'Are you sure you want to delete %s posts?'
+ ),
+ decodeEntities( posts.length )
+ )
+ : sprintf(
+ // translators: %s: The page's title.
+ __( 'Are you sure you want to delete "%s"?' ),
+ decodeEntities(
+ posts && posts[ 0 ]?.title?.rendered
+ )
+ ) }
);
diff --git a/packages/edit-site/src/components/dataviews/item-actions.js b/packages/edit-site/src/components/dataviews/item-actions.js
index c35fe4f77e4dfd..4d084fb2f6ba32 100644
--- a/packages/edit-site/src/components/dataviews/item-actions.js
+++ b/packages/edit-site/src/components/dataviews/item-actions.js
@@ -2,28 +2,18 @@
* WordPress dependencies
*/
import {
+ DropdownMenu,
+ MenuGroup,
+ MenuItem,
Button,
Modal,
__experimentalHStack as HStack,
- privateApis as componentsPrivateApis,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { useMemo, useState } from '@wordpress/element';
import { moreVertical } from '@wordpress/icons';
-/**
- * Internal dependencies
- */
-import { unlock } from '../../lock-unlock';
-
-const {
- DropdownMenuV2Ariakit: DropdownMenu,
- DropdownMenuGroupV2Ariakit: DropdownMenuGroup,
- DropdownMenuItemV2Ariakit: DropdownMenuItem,
- DropdownMenuItemLabelV2Ariakit: DropdownMenuItemLabel,
-} = unlock( componentsPrivateApis );
-
-function ButtonTrigger( { action, onClick } ) {
+export function PrimaryActionTrigger( { action, onClick } ) {
return (