How to use the @wordpress/html-entities.decodeEntities function in @wordpress/html-entities

To help you get started, we’ve selected a few @wordpress/html-entities examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github php4dev / heroku-wordpress / wp-content / plugins / woocommerce / packages / woocommerce-blocks / assets / js / atomic / components / product / button / index.js View on Github external
const getButtonText = () => {
		if ( Number.isFinite( cartQuantity ) && addedToCart ) {
			return sprintf(
				// translators: %s number of products in cart.
				_n(
					'%d in cart',
					'%d in cart',
					cartQuantity,
					'woocommerce'
				),
				cartQuantity
			);
		}
		return decodeEntities( productCartDetails.text );
	};
github php4dev / heroku-wordpress / wp-content / plugins / woocommerce / packages / woocommerce-blocks / assets / js / blocks / attribute-filter / block.js View on Github external
const filteredTerm = getFilteredTerm( term.id );

				// If there is no match this term doesn't match the current product collection - only render if checked.
				if (
					! filteredTerm &&
					! checked.includes( term.slug ) &&
					! isTermInQueryState( term.slug )
				) {
					return null;
				}

				const count = filteredTerm ? filteredTerm.count : 0;

				return {
					value: term.slug,
					name: decodeEntities( term.name ),
					label: (
						<label name="{">
					),
				};
			} )
			.filter( Boolean );</label>
github php4dev / heroku-wordpress / wp-content / plugins / woo-gutenberg-products-block / assets / js / blocks / attribute-filter / block.js View on Github external
const filteredTerm = getFilteredTerm( term.id );

				// If there is no match this term doesn't match the current product collection - only render if checked.
				if (
					! filteredTerm &amp;&amp;
					! checked.includes( term.slug ) &amp;&amp;
					! isTermInQueryState( term.slug )
				) {
					return null;
				}

				const count = filteredTerm ? filteredTerm.count : 0;

				return {
					value: term.slug,
					name: decodeEntities( term.name ),
					label: (
						<label name="{">
					),
				};
			} )
			.filter( Boolean );</label>
github Automattic / wp-calypso / apps / full-site-editing / full-site-editing-plugin / full-site-editing / lib / site-options / use-site-options.js View on Github external
.then( result =>
				setSiteOptions( {
					...siteOptions,
					option: decodeEntities( result[ siteOption ] ),
					previousOption: decodeEntities( result[ siteOption ] ),
					loaded: true,
					error: false,
				} )
			)
github Automattic / newspack-plugin / assets / wizards / seo / views / separator / index.js View on Github external
{ Object.keys( SEPARATORS ).map( key =&gt; {
						const value = decodeEntities( SEPARATORS[ key ] );
						return (
							<button> onChange( { titleSeparator: key } ) }
								isPressed={ key === titleSeparator }
								isSecondary={ key !== titleSeparator }
							&gt;
								{ value }
							</button>
						);
					} ) }
github WordPress / gutenberg / packages / editor / src / components / post-author / index.js View on Github external
{ authors.map( ( author ) =&gt; (
						<option value="{">{ decodeEntities( author.name ) }</option>
					) ) }
github WordPress / gutenberg / packages / block-editor / src / components / default-block-appender / index.native.js View on Github external
export function DefaultBlockAppender( {
	isLocked,
	isVisible,
	onAppend,
	placeholder,
	containerStyle,
} ) {
	if ( isLocked || ! isVisible ) {
		return null;
	}

	const value = decodeEntities( placeholder ) || __( 'Start writing…' );

	return (
		
			
		
	);
}
github php4dev / heroku-wordpress / wp-content / plugins / woo-gutenberg-products-block / assets / js / blocks / attribute-filter / block.js View on Github external
if (
					! filteredTerm &amp;&amp;
					! checked.includes( term.slug ) &amp;&amp;
					! isTermInQueryState( term.slug )
				) {
					return null;
				}

				const count = filteredTerm ? filteredTerm.count : 0;

				return {
					value: term.slug,
					name: decodeEntities( term.name ),
					label: (
						<label name="{">
					),
				};
			} )
			.filter( Boolean );</label>
github php4dev / heroku-wordpress / wp-content / plugins / woocommerce / packages / woocommerce-blocks / assets / js / blocks / active-filters / active-attribute-filters.js View on Github external
return null;
					}

					let prefix = '';

					if ( index &gt; 0 &amp;&amp; operator === 'and' ) {
						prefix = (
							<span>
								{ __( 'and', 'woocommerce' ) }
							</span>
						);
					}

					return renderRemovableListItem( {
						type: attributeLabel,
						name: decodeEntities( termObject.name || slug ),
						prefix,
						removeCallback: () =&gt; {
							removeAttributeFilterBySlug(
								productAttributes,
								setProductAttributes,
								attributeObject,
								slug
							);
						},
						showLabel: false,
						displayStyle,
					} );
				} ) }
github Automattic / wp-calypso / apps / full-site-editing / full-site-editing-plugin / blog-posts-block / newspack-homepage-articles / blocks / homepage-articles / edit.js View on Github external
titleForPost = post => {
		if ( ! post.title ) {
			return '';
		}
		if ( typeof post.title === 'string' ) {
			return decodeEntities( post.title.trim() );
		}
		if ( typeof post.title === 'object' && post.title.rendered ) {
			return decodeEntities( post.title.rendered.trim() );
		}
	};

@wordpress/html-entities

HTML entity utilities for WordPress.

GPL-2.0-or-later
Latest version published 3 days ago

Package Health Score

95 / 100
Full package analysis

Popular @wordpress/html-entities functions