Skip to content

Commit

Permalink
Fix filter on filenames with diacritical marks (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rvervuurt authored Oct 15, 2024
1 parent 3f3bf0c commit a39a772
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions assets/js/input.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,10 @@
const iconsFilter = document.querySelector('#filterIcons');

function filterIcons(wordToMatch) {
const normalizedWord = wordToMatch.normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
return acfSvgIconPicker.svgs.filter(icon => {
var name = icon.name.replace(/[-_]/g, ' ');
const regex = new RegExp(wordToMatch, 'gi');
var name = icon.name.replace(/[-_]/g, ' ').normalize("NFD").replace(/[\u0300-\u036f]/g, "").toLowerCase();
const regex = new RegExp(normalizedWord, 'gi');
return name.match(regex);
});
}
Expand Down

0 comments on commit a39a772

Please sign in to comment.