How to use the @wordpress/escape-html.escapeHTML function in @wordpress/escape-html

To help you get started, we’ve selected a few @wordpress/escape-html 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 woocommerce / woocommerce-gutenberg-products-block / assets / js / blocks / reviews / edit-utils.js View on Github external
label={ __( 'Product rating', 'woo-gutenberg-products-block' ) }
				checked={ attributes.showReviewRating }
				onChange={ () =>
					setAttributes( {
						showReviewRating: ! attributes.showReviewRating,
					} )
				}
			/>
			{ attributes.showReviewRating && ! REVIEW_RATINGS_ENABLED && (
				
					
						{ sprintf(
							escapeHTML(
								/* translators: A notice that links to WooCommerce settings. */
								__(
									'Product rating is disabled in your %sstore settings%s.',
									'woo-gutenberg-products-block'
								)
							),
							`<a href="${ getAdminLink(
								'admin.php?page=wc-settings&amp;tab=products'
							) }">`,
							'</a>'
						) }
					
				
			) }
github WordPress / gutenberg / packages / element / src / serialize.js View on Github external
export function renderElement( element, context, legacyContext = {} ) {
	if ( null === element || undefined === element || false === element ) {
		return '';
	}

	if ( Array.isArray( element ) ) {
		return renderChildren( element, context, legacyContext );
	}

	switch ( typeof element ) {
		case 'string':
			return escapeHTML( element );

		case 'number':
			return element.toString();
	}

	const { type, props } = element;

	switch ( type ) {
		case StrictMode:
		case Fragment:
			return renderChildren( props.children, context, legacyContext );

		case RawHTML:
			const { children, ...wrapperProps } = props;

			return renderNativeComponent(
github Automattic / vip-go-mu-plugins-built / jetpack / extensions / blocks / slideshow / swiper-callbacks.js View on Github external
function announceCurrentSlide( swiper ) {
	const currentSlide = swiper.slides[ swiper.activeIndex ];
	if ( ! currentSlide ) {
		return;
	}
	const figcaption = currentSlide.getElementsByTagName( 'FIGCAPTION' )[ 0 ];
	const img = currentSlide.getElementsByTagName( 'IMG' )[ 0 ];
	if ( swiper.a11y.liveRegion ) {
		swiper.a11y.liveRegion[ 0 ].innerHTML = figcaption
			? figcaption.innerHTML
			: escapeHTML( img.alt );
	}
}
github WordPress / gutenberg / packages / rich-text / src / to-html-string.js View on Github external
return children.map( ( child ) => {
		return child.text === undefined ? createElementHTML( child ) : escapeHTML( child.text );
	} ).join( '' );
}

@wordpress/escape-html

Escape HTML utils.

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

Package Health Score

98 / 100
Full package analysis