diff --git a/src/components/LeftMenu.vue b/src/components/LeftMenu.vue index 6e0ae5907..b02c0d014 100644 --- a/src/components/LeftMenu.vue +++ b/src/components/LeftMenu.vue @@ -34,18 +34,26 @@ const search = ref(null); const filteredItems = computed(() => { if (!search.value) return items.value; + const normalizedSearch = normalize(search.value); return items.value.filter((item) => { - const locale = t(item.title).toLowerCase(); - return locale.includes(search.value.toLowerCase()); + const locale = normalize(t(item.title)); + return locale.includes(normalizedSearch); }); }); const filteredPinnedModules = computed(() => { if (!search.value) return pinnedModules.value; + const normalizedSearch = search.value + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase(); const map = new Map(); for (const [key, pinnedModule] of pinnedModules.value) { - const locale = t(pinnedModule.title).toLowerCase(); - if (locale.includes(search.value.toLowerCase())) map.set(key, pinnedModule); + const locale = t(pinnedModule.title) + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase(); + if (locale.includes(normalizedSearch)) map.set(key, pinnedModule); } return map; }); @@ -147,6 +155,13 @@ async function togglePinned(item, event) { const handleItemExpansion = (itemName) => { expansionItemElements[itemName].scrollToLastElement(); }; + +function normalize(text) { + return text + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase(); +}