From 7ffc11d987218f0e52e39d3238c5f7c2c4fe7f7f Mon Sep 17 00:00:00 2001 From: Kevin Killingsworth Date: Mon, 25 Feb 2019 23:32:04 -0600 Subject: [PATCH] Fix html in preview of product titles (https://github.com/woocommerce/woocommerce-blocks/pull/444) * Fix html in preview of product titles Previously the html wasn't rendered in the preview for product titles. This renders the html. * Update test snapshot * Also decode html for featured preview name. * Un-escape HTML for featured post title render --- .../assets/js/blocks/featured-product/block.js | 9 ++++++--- .../js/components/product-preview/index.js | 5 ++++- .../test/__snapshots__/index.js.snap | 18 ++++++++++++------ .../blocks/class-wc-block-featured-product.php | 2 +- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js b/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js index 28f61419562..dac13ed85e7 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js @@ -278,9 +278,12 @@ class FeaturedProduct extends Component { style={ style } >
-

- { product.name } -

+

{ showDesc && (
{ return (
{ image } -
{ product.name }
+
- Winter Jacket -
+ dangerouslySetInnerHTML={ + Object { + "__html": "Winter Jacket", + } + } + />
- Winter Jacket -
+ dangerouslySetInnerHTML={ + Object { + "__html": "Winter Jacket", + } + } + />
%s

', - esc_html( $product->get_title() ) + wp_kses_post( $product->get_title() ) ); $desc_str = sprintf(