Skip to content

Commit

Permalink
Decode HTML in search result highlights
Browse files Browse the repository at this point in the history
  • Loading branch information
shinyichen committed May 20, 2021
1 parent ced0e1f commit 5839127
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/js/widgets/list_of_things/item_view.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,19 @@ define([
},

render: function() {
// a hacky way to decode html in highglights
if (this.model.get('highlights')) {
const highlights = this.model.get('highlights');
this.model.set(
'highlights',
highlights.map((h) =>
$('<textarea/>')
.html(h)
.text()
)
);
}

if (this.model.get('visible')) {
return Marionette.ItemView.prototype.render.apply(this, arguments);
}
Expand Down

0 comments on commit 5839127

Please sign in to comment.