chore(react/note_icon): case insensitive search

This commit is contained in:
Elian Doran 2025-08-21 15:07:41 +03:00
parent b20ffdf7db
commit 4d71b73f38
No known key found for this signature in database
2 changed files with 5 additions and 4 deletions

View File

@ -64,7 +64,6 @@ export default class NoteIconWidget extends NoteContextAwareWidget {
); );
} }
const search = String(this.$iconSearch.val())?.trim()?.toLowerCase();
this.$iconSearch.focus(); this.$iconSearch.focus();
} }

View File

@ -62,14 +62,16 @@ function NoteIconList() {
// Filter by text and/or category. // Filter by text and/or category.
let icons: Icon[] = fullIconData.icons; let icons: Icon[] = fullIconData.icons;
if (search || categoryId) { const processedSearch = search?.trim()?.toLowerCase();
if (processedSearch || categoryId) {
icons = icons.filter((icon) => { icons = icons.filter((icon) => {
if (categoryId !== "0" && String(icon.category_id) !== categoryId) { if (categoryId !== "0" && String(icon.category_id) !== categoryId) {
return false; return false;
} }
if (search) { if (processedSearch) {
if (!icon.name.includes(search) && !icon.term?.find((t) => t.includes(search))) { if (!icon.name.includes(processedSearch) &&
!icon.term?.find((t) => t.includes(processedSearch))) {
return false; return false;
} }
} }