From fd56c6c94df2ea1f7d2434fca3215590af75cbde Mon Sep 17 00:00:00 2001 From: Manish Menaria Date: Wed, 29 Nov 2023 16:17:53 +0530 Subject: [PATCH] HTML Entity Decoding in Taxonomy Controls --- .../inspector-controls/taxonomy-controls/taxonomy-item.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/assets/js/blocks/product-collection/inspector-controls/taxonomy-controls/taxonomy-item.tsx b/assets/js/blocks/product-collection/inspector-controls/taxonomy-controls/taxonomy-item.tsx index fc01914cfa8..f452a918da8 100644 --- a/assets/js/blocks/product-collection/inspector-controls/taxonomy-controls/taxonomy-item.tsx +++ b/assets/js/blocks/product-collection/inspector-controls/taxonomy-controls/taxonomy-item.tsx @@ -6,6 +6,7 @@ import { Taxonomy } from '@wordpress/core-data/src/entity-types'; import { useState, useMemo, useRef } from '@wordpress/element'; import { useDebounce } from '@wordpress/compose'; import { FormTokenField } from '@wordpress/components'; +import { decodeEntities } from '@wordpress/html-entities'; type Term = { id: number; @@ -250,6 +251,10 @@ const TaxonomyItem = ( { taxonomy, termIds, onChange }: TaxonomyItemProps ) => { onChange( newTermIds ); }; + const decodeHTMLEntities = ( value: string ) => { + return decodeEntities( value ) || ''; + }; + return (
{ disabled={ isResolvingTermMaps } // @ts-expect-error Using experimental features __experimentalShowHowTo={ false } + displayTransform={ decodeHTMLEntities } />
);