Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page creation and duplication: Decode HTML entities in success notices #62313

Merged
merged 7 commits into from
Jun 11, 2024
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/edit-post/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
"@wordpress/editor": "file:../editor",
"@wordpress/element": "file:../element",
"@wordpress/hooks": "file:../hooks",
"@wordpress/html-entities": "file:../html-entities",
"@wordpress/i18n": "file:../i18n",
"@wordpress/icons": "file:../icons",
"@wordpress/keyboard-shortcuts": "file:../keyboard-shortcuts",
Expand Down
3 changes: 2 additions & 1 deletion packages/edit-post/src/components/layout/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { privateApis as commandsPrivateApis } from '@wordpress/commands';
import { privateApis as coreCommandsPrivateApis } from '@wordpress/core-commands';
import { privateApis as blockLibraryPrivateApis } from '@wordpress/block-library';
import { addQueryArgs } from '@wordpress/url';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand Down Expand Up @@ -236,7 +237,7 @@ function Layout( { initialPost } ) {
sprintf(
// translators: %s: Title of the created post e.g: "Post 1".
__( '"%s" successfully created.' ),
title
decodeEntities( title )
),
{
type: 'snackbar',
Expand Down
4 changes: 4 additions & 0 deletions packages/edit-site/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

### Enhancements

- Add ´@wordpress/html-entities´ package to the list of dependencies in package.json. ([#62313](https://github.com/WordPress/gutenberg/pull/62313))
carolinan marked this conversation as resolved.
Show resolved Hide resolved

## 6.0.0 (2024-05-31)

### Breaking Changes
Expand Down
3 changes: 2 additions & 1 deletion packages/edit-site/src/components/add-new-page/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useDispatch } from '@wordpress/data';
import { useState } from '@wordpress/element';
import { store as coreStore } from '@wordpress/core-data';
import { store as noticesStore } from '@wordpress/notices';
import { decodeEntities } from '@wordpress/html-entities';

export default function AddNewPageModal( { onSave, onClose } ) {
const [ isCreatingPage, setIsCreatingPage ] = useState( false );
Expand Down Expand Up @@ -47,7 +48,7 @@ export default function AddNewPageModal( { onSave, onClose } ) {
sprintf(
// translators: %s: Title of the created template e.g: "Category".
__( '"%s" successfully created.' ),
newPage.title?.rendered || title
decodeEntities( newPage.title?.rendered || title )
),
{
type: 'snackbar',
Expand Down
3 changes: 2 additions & 1 deletion packages/edit-site/src/components/editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { useCallback, useMemo } from '@wordpress/element';
import { store as noticesStore } from '@wordpress/notices';
import { privateApis as routerPrivateApis } from '@wordpress/router';
import { store as preferencesStore } from '@wordpress/preferences';
import { decodeEntities } from '@wordpress/html-entities';

/**
* Internal dependencies
Expand Down Expand Up @@ -176,7 +177,7 @@ export default function Editor( { isLoading } ) {
sprintf(
// translators: %s: Title of the created post e.g: "Post 1".
__( '"%s" successfully created.' ),
_title
decodeEntities( _title )
carolinan marked this conversation as resolved.
Show resolved Hide resolved
),
{
type: 'snackbar',
Expand Down
2 changes: 1 addition & 1 deletion packages/editor/src/components/post-actions/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -783,7 +783,7 @@ const duplicatePostAction = {
sprintf(
// translators: %s: Title of the created template e.g: "Category".
__( '"%s" successfully created.' ),
newItem.title?.rendered || title
decodeEntities( newItem.title?.rendered || title )
),
{
id: 'duplicate-post-action',
Expand Down
Loading