From b906b22dea5001394bc0e8c316d086c8e86abb22 Mon Sep 17 00:00:00 2001 From: Amit Raj <77401999+amitraj2203@users.noreply.github.com> Date: Thu, 27 Jun 2024 13:25:56 +0530 Subject: [PATCH] Fix issue of HTML entities rendering in command menu (#62606) * Fix issue of HTML entities rendering in command menu * Update link to API in block-editor README.md * Undo previous changes * Fix issue of HTML entities rendering in command menu * Add @wordpress/html-entities dependency in packages/core-commands --- package-lock.json | 2 ++ packages/core-commands/package.json | 1 + packages/core-commands/src/site-editor-navigation-commands.js | 3 ++- 3 files changed, 5 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 6ceb95551a3e8..3725b111e4f3f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -53690,6 +53690,7 @@ "@wordpress/core-data": "file:../core-data", "@wordpress/data": "file:../data", "@wordpress/element": "file:../element", + "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", "@wordpress/icons": "file:../icons", "@wordpress/private-apis": "file:../private-apis", @@ -69039,6 +69040,7 @@ "@wordpress/core-data": "file:../core-data", "@wordpress/data": "file:../data", "@wordpress/element": "file:../element", + "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", "@wordpress/icons": "file:../icons", "@wordpress/private-apis": "file:../private-apis", diff --git a/packages/core-commands/package.json b/packages/core-commands/package.json index 0dccaf7c9c809..4180b6c356aaf 100644 --- a/packages/core-commands/package.json +++ b/packages/core-commands/package.json @@ -34,6 +34,7 @@ "@wordpress/core-data": "file:../core-data", "@wordpress/data": "file:../data", "@wordpress/element": "file:../element", + "@wordpress/html-entities": "file:../html-entities", "@wordpress/i18n": "file:../i18n", "@wordpress/icons": "file:../icons", "@wordpress/private-apis": "file:../private-apis", diff --git a/packages/core-commands/src/site-editor-navigation-commands.js b/packages/core-commands/src/site-editor-navigation-commands.js index ba34fffd98824..b575fd433f6d0 100644 --- a/packages/core-commands/src/site-editor-navigation-commands.js +++ b/packages/core-commands/src/site-editor-navigation-commands.js @@ -18,6 +18,7 @@ import { import { privateApis as routerPrivateApis } from '@wordpress/router'; import { addQueryArgs, getPath } from '@wordpress/url'; import { useDebounce } from '@wordpress/compose'; +import { decodeEntities } from '@wordpress/html-entities'; /** * Internal dependencies @@ -93,7 +94,7 @@ const getNavigationCommandLoaderPerPostType = ( postType ) => name: postType + '-' + record.id, searchLabel: record.title?.rendered + ' ' + record.id, label: record.title?.rendered - ? record.title?.rendered + ? decodeEntities( record.title?.rendered ) : __( '(no title)' ), icon: icons[ postType ], };