Skip to content

Commit

Permalink
Fix text highlight in search result (#55695) (#55809)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga authored Jan 27, 2020
1 parent f003900 commit 5238f64
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ const getJSXdisplayFromMeta = (
const charIndex = path.lastIndexOf(stringMatch!);
const startString = path.substr(0, charIndex);
const endString = path.substr(charIndex + stringMatch!.length);

display = (
<span style={{ lineHeight: 1.5 }}>
{startString}
Expand Down Expand Up @@ -164,7 +165,7 @@ const getSearchMetadata = (searchData: SearchData, fieldData: FieldData): Search
.sort((a, b) => b![0].length - a![0].length);

if (arrayMatch.length) {
stringMatch = arrayMatch[0]![0].toLowerCase();
stringMatch = arrayMatch[0]![0];
}
}

Expand Down Expand Up @@ -244,7 +245,7 @@ export const searchFields = (term: string, fields: NormalizedFields['byId']): Se
field,
metadata: getSearchMetadata(searchData, {
name: field.source.name,
path: field.path.join(' > ').toLowerCase(),
path: field.path.join(' > '),
type: field.source.type,
}),
}))
Expand Down

0 comments on commit 5238f64

Please sign in to comment.