Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Product Collection - Fix HTML Entity Decoding in Taxonomy Controls (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
imanish003 authored Dec 1, 2023
1 parent c47bca9 commit 26e367a
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -250,6 +251,10 @@ const TaxonomyItem = ( { taxonomy, termIds, onChange }: TaxonomyItemProps ) => {
onChange( newTermIds );
};

const decodeHTMLEntities = ( value: string ) => {
return decodeEntities( value ) || '';
};

return (
<div className="wc-block-editor-product-collection-inspector__taxonomy-control">
<FormTokenField
Expand All @@ -261,6 +266,7 @@ const TaxonomyItem = ( { taxonomy, termIds, onChange }: TaxonomyItemProps ) => {
disabled={ isResolvingTermMaps }
// @ts-expect-error Using experimental features
__experimentalShowHowTo={ false }
displayTransform={ decodeHTMLEntities }
/>
</div>
);
Expand Down

0 comments on commit 26e367a

Please sign in to comment.