Skip to content

Commit

Permalink
Show name of deleted menu in notice
Browse files Browse the repository at this point in the history
  • Loading branch information
getdave committed Mar 25, 2022
1 parent dcfd4f1 commit 98cca66
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
15 changes: 11 additions & 4 deletions packages/block-library/src/navigation/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
Button,
Spinner,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { __, sprintf } from '@wordpress/i18n';
import { speak } from '@wordpress/a11y';

/**
Expand Down Expand Up @@ -169,7 +169,6 @@ function Navigation( {

const [ showNavigationMenuDeleteNotice ] = useNavigationNotice( {
name: 'block-library/core/navigation/delete',
message: __( 'Navigation Menu successfully deleted.' ),
} );

const [
Expand Down Expand Up @@ -799,9 +798,17 @@ function Navigation( {
{ hasResolvedCanUserDeleteNavigationMenu &&
canUserDeleteNavigationMenu && (
<NavigationMenuDeleteControl
onDelete={ () => {
onDelete={ ( deletedMenuTitle = '' ) => {
resetToEmptyBlock();
showNavigationMenuDeleteNotice();
showNavigationMenuDeleteNotice(
sprintf(
// translators: %s: the name of a menu (e.g. Header navigation).
__(
'Navigation menu %s successfully deleted.'
),
deletedMenuTitle
)
);
} }
/>
) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function NavigationMenuDeleteControl( { onDelete } ) {
id,
{ force: true }
);
onDelete();
onDelete( title );
} }
>
{ __( 'Confirm' ) }
Expand Down

0 comments on commit 98cca66

Please sign in to comment.