Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions onboarding/src/Components/FeaturesList.js
Original file line number Diff line number Diff line change
@@ -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.
*/
Expand Down
3 changes: 2 additions & 1 deletion onboarding/src/Components/StarterSiteCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +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';
import { decodeHtmlEntities } from '../utils/common';

const hashColor = ( value = '' ) => {
let hash = 0;
Expand Down Expand Up @@ -77,7 +78,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 ] );
Expand Down
7 changes: 7 additions & 0 deletions onboarding/src/utils/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,18 @@ const textToFileURL = ( text ) => {
return URL.createObjectURL( blob );
};

const decodeHtmlEntities = ( str ) => {
const txt = document.createElement( 'textarea' );
txt.innerHTML = str;
return txt.value;
};

export {
trailingSlashIt,
untrailingSlashIt,
sendPostMessage,
EDITOR_MAP,
ONBOARDING_CAT,
textToFileURL,
decodeHtmlEntities,
};
Loading