Skip to content

Commit 54f533f

Browse files
committed
MC-38363: Improve name displaying in "Recently Viewed Products" side bar
1 parent 970d67a commit 54f533f

File tree

2 files changed

+18
-3
lines changed
  • app/code/Magento/Catalog/view/base/web

2 files changed

+18
-3
lines changed

app/code/Magento/Catalog/view/base/web/js/product/name.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,33 @@
55

66
define([
77
'Magento_Ui/js/grid/columns/column',
8-
'Magento_Catalog/js/product/list/column-status-validator'
9-
], function (Column, columnStatusValidator) {
8+
'Magento_Catalog/js/product/list/column-status-validator',
9+
'escaper'
10+
], function (Column, columnStatusValidator, escaper) {
1011
'use strict';
1112

1213
return Column.extend({
14+
defaults: {
15+
allowedTags: ['div', 'span', 'b', 'strong', 'i', 'em', 'u', 'a']
16+
},
17+
1318
/**
1419
* Depends on this option, product name can be shown or hide. Depends on backend configuration
1520
*
1621
* @returns {Boolean}
1722
*/
1823
isAllowed: function () {
1924
return columnStatusValidator.isValid(this.source(), 'name', 'show_attributes');
25+
},
26+
27+
/**
28+
* Name column.
29+
*
30+
* @param {String} label
31+
* @returns {String}
32+
*/
33+
getNameUnsanitizedHtml: function (label) {
34+
return escaper.escapeHtml(label, this.allowedTags);
2035
}
2136
});
2237
});

app/code/Magento/Catalog/view/base/web/template/product/name.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
-->
77
<strong if="isAllowed()"
88
class="product-item-name">
9-
<a attr="href: $row().url" html="$col.getLabel($row())"/>
9+
<a attr="href: $row().url" html="getNameUnsanitizedHtml($col.getLabel($row()))"/>
1010
</strong>

0 commit comments

Comments
 (0)