File tree Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Expand file tree Collapse file tree 1 file changed +8
-11
lines changed Original file line number Diff line number Diff line change @@ -6,17 +6,14 @@ function replaceHighlightTags(
66 highlightPreTag ?: string ,
77 highlightPostTag ?: string
88) : string {
9- // If the value of the attribute is a string,
10- // the highlight is applied by MeiliSearch (<em> tags)
11- // and we replace the <em> by the expected tag for InstantSearch
12- if ( isString ( value ) ) {
13- highlightPreTag = highlightPreTag || '__ais-highlight__'
14- highlightPostTag = highlightPostTag || '__/ais-highlight__'
15- return value
16- . replace ( / < e m > / g, highlightPreTag )
17- . replace ( / < \/ e m > / g, highlightPostTag )
18- }
19- return value
9+ // Value has to be a string.
10+ // Some field may have highlight applied by MeiliSearch (<em> tags)
11+ // We replace the <em> by the expected tag for InstantSearch
12+ highlightPreTag = highlightPreTag || '__ais-highlight__'
13+ highlightPostTag = highlightPostTag || '__/ais-highlight__'
14+ return JSON . stringify ( value )
15+ . replace ( / < e m > / g, highlightPreTag )
16+ . replace ( / < \/ e m > / g, highlightPostTag )
2017}
2118
2219function createHighlighResult < T extends Record < string , any > > ( {
You can’t perform that action at this time.
0 commit comments