From ccd9a8e54bce20d7911551e647267632b0c30a1b Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Wed, 1 Jul 2026 19:58:39 +0530 Subject: [PATCH 1/2] fix: decode HTML entities --- onboarding/src/Components/StarterSiteCard.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/onboarding/src/Components/StarterSiteCard.js b/onboarding/src/Components/StarterSiteCard.js index 6b292d3a..d30ff9d4 100644 --- a/onboarding/src/Components/StarterSiteCard.js +++ b/onboarding/src/Components/StarterSiteCard.js @@ -5,6 +5,12 @@ import { useEffect, useMemo, useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { track } from '../utils/rest'; +const decodeHtmlEntities = ( str ) => { + const txt = document.createElement( 'textarea' ); + txt.innerHTML = str; + return txt.value; +}; + const hashColor = ( value = '' ) => { let hash = 0; for ( let index = 0; index < value.length; index++ ) { @@ -77,7 +83,7 @@ const StarterSiteCard = ( { .filter( ( shot ) => shot && shot.screenshot ) .map( ( shot ) => ( { key: shot.key || shot.label || 'page', - label: shot.label || shot.key || __( 'Page', 'templates-patterns-collection' ), + label: decodeHtmlEntities( shot.label || shot.key || __( 'Page', 'templates-patterns-collection' ) ), screenshot: shot.screenshot, } ) ); }, [ data?.page_shots, screenshot ] ); From 75dab817a92f7dfc86e33be6ad2f72dfb1bd112d Mon Sep 17 00:00:00 2001 From: girishpanchal30 Date: Wed, 1 Jul 2026 20:05:18 +0530 Subject: [PATCH 2/2] refactor: decode HTML entities --- onboarding/src/Components/FeaturesList.js | 7 +------ onboarding/src/Components/StarterSiteCard.js | 7 +------ onboarding/src/utils/common.js | 7 +++++++ 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/onboarding/src/Components/FeaturesList.js b/onboarding/src/Components/FeaturesList.js index 88151265..411c41b4 100644 --- a/onboarding/src/Components/FeaturesList.js +++ b/onboarding/src/Components/FeaturesList.js @@ -1,14 +1,9 @@ import { useState, useEffect } from '@wordpress/element'; import { __ } from '@wordpress/i18n'; +import { decodeHtmlEntities } from '../utils/common'; const MAX_FEATURE_LIST_LENGTH = 6; -const decodeHtmlEntities = (str) => { - const textArea = document.createElement('textarea'); - textArea.innerHTML = str; - return textArea.value; -}; - /** * Plugins to promote. */ diff --git a/onboarding/src/Components/StarterSiteCard.js b/onboarding/src/Components/StarterSiteCard.js index d30ff9d4..4a5ae1ae 100644 --- a/onboarding/src/Components/StarterSiteCard.js +++ b/onboarding/src/Components/StarterSiteCard.js @@ -4,12 +4,7 @@ import { withDispatch, withSelect } from '@wordpress/data'; import { useEffect, useMemo, useState } from '@wordpress/element'; import { __, sprintf } from '@wordpress/i18n'; import { track } from '../utils/rest'; - -const decodeHtmlEntities = ( str ) => { - const txt = document.createElement( 'textarea' ); - txt.innerHTML = str; - return txt.value; -}; +import { decodeHtmlEntities } from '../utils/common'; const hashColor = ( value = '' ) => { let hash = 0; diff --git a/onboarding/src/utils/common.js b/onboarding/src/utils/common.js index 4e0525aa..a33b8fb2 100644 --- a/onboarding/src/utils/common.js +++ b/onboarding/src/utils/common.js @@ -51,6 +51,12 @@ const textToFileURL = ( text ) => { return URL.createObjectURL( blob ); }; +const decodeHtmlEntities = ( str ) => { + const txt = document.createElement( 'textarea' ); + txt.innerHTML = str; + return txt.value; +}; + export { trailingSlashIt, untrailingSlashIt, @@ -58,4 +64,5 @@ export { EDITOR_MAP, ONBOARDING_CAT, textToFileURL, + decodeHtmlEntities, };