Skip to content

Commit

Permalink
Prevent search 'cl' to show raw HTML in product row
Browse files Browse the repository at this point in the history
  • Loading branch information
janwerkhoven committed Sep 24, 2023
1 parent 39a6c61 commit 3f758af
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
9 changes: 8 additions & 1 deletion app/helpers/markdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const convertInlineElements = (str) => {
};

export default helper(function markdown(params) {
const string = params[0];
let string = params[0];

// { noParagraphs: true }
const options = params[1] || {};
Expand All @@ -75,6 +75,13 @@ export default helper(function markdown(params) {
return string;
}

// It is possible to pass Ember's SafeString into the markdown helper.
// https://api.emberjs.com/ember/5.3/classes/SafeString/methods
// Here we make sure we continue with a simple string.
if (typeof string === 'object' && typeof string.string === 'string') {
string = string.string;
}

let html = '';

// 1. First replace the legacy \r and Window's \r\n with simply \n
Expand Down
7 changes: 6 additions & 1 deletion app/pods/components/product-list/row/template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,16 @@
{{else}}
{{#if @product.pitch}}
<div class='pitch'>
{{markdown
(mark @search (t @product.pitch 'product.2' @product.id))
}}
</div>
{{!-- <div class='pitch'>
{{mark
@search
(markdown (t @product.pitch 'product.2' @product.id))
}}
</div>
</div> --}}
{{/if}}
{{#if (and this.features this.media.isDesktopWidescreen)}}
<div class='features'>
Expand Down

0 comments on commit 3f758af

Please sign in to comment.