Skip to content

Commit

Permalink
feat(dropdown,search): highlightMatches option
Browse files Browse the repository at this point in the history
This PR adds a new option highlightMatches to dropdown and search module
Customizing the mark (background)-color is prepared in the LESS files for a custom theme, but disabled by default. (as the default would do nothing anyway)
I decided to leave this to each browsers defaults as its visuals are most familiar to usual browser search and the mark HTML tag uses the exact same styling.

Also fixed some typo inside search.less
Also made ignoreSearchCase available for search as we have the same for dropdown already
  • Loading branch information
lubber-de committed Feb 11, 2024
1 parent 24be0d4 commit 3ddf735
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/definitions/modules/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -1484,10 +1484,8 @@
if (shouldEscape.test(string)) {
string = string.replace(/&(?![\d#a-z]{1,12};)/gi, '&');
string = string.replace(badChars, escapedChar);
if (settings.highlightMatches) {
// FUI controlled HTML is still allowed
string = string.replace(/&lt;(\/)*mark&gt;/g, '<$1mark>');
}
// FUI controlled HTML is still allowed
string = string.replace(/&lt;(\/)*mark&gt;/g, '<$1mark>');
}

return string;
Expand Down

0 comments on commit 3ddf735

Please sign in to comment.