Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/typeahead/typeahead-container.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ export class TypeaheadContainerComponent implements OnDestroy {
// Replaces the capture string with the same string inside of a "strong" tag
if (typeof query === 'object') {
const queryLen: number = query.length;
const PLACEHOLDER_CHAR = '\u2063'; // Invisible Separator
const STRONG_PLACEHOLDER_COUNT = 17; // 8 + 9: strong tag length (opening and closing)
for (let i = 0; i < queryLen; i += 1) {
// query[i] is already latinized and lower case
startIdx = itemStrHelper.indexOf(query[i]);
Expand All @@ -275,7 +277,8 @@ export class TypeaheadContainerComponent implements OnDestroy {
`${itemStr.substring(0, startIdx)}<strong>${itemStr.substring(startIdx, startIdx + tokenLen)}</strong>` +
`${itemStr.substring(startIdx + tokenLen)}`;
itemStrHelper =
`${itemStrHelper.substring(0, startIdx)}????????${'??'.repeat(tokenLen)}??????????` +
`${itemStrHelper.substring(0, startIdx)}`+
`${PLACEHOLDER_CHAR.repeat(STRONG_PLACEHOLDER_COUNT + tokenLen)}`+
`${itemStrHelper.substring(startIdx + tokenLen)}`;
}
}
Expand Down
Loading