stripped off accented characters from search field for browser client

This commit is contained in:
gbubemismith 2022-05-20 16:39:51 +01:00
parent 71cfcd3329
commit 2a2e9a0d7f
1 changed files with 5 additions and 4 deletions

View File

@ -193,10 +193,11 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
clearTimeout(this.searchTimeout);
}
const filterDeleted = (c: CipherView) => !c.isDeleted;
const normalizedSearchText = this.searchText?.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
if (timeout == null) {
this.hasSearched = this.searchService.isSearchable(this.searchText);
this.hasSearched = this.searchService.isSearchable(normalizedSearchText);
this.ciphers = await this.searchService.searchCiphers(
this.searchText,
normalizedSearchText,
filterDeleted,
this.allCiphers
);
@ -207,12 +208,12 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
}
this.searchPending = true;
this.searchTimeout = setTimeout(async () => {
this.hasSearched = this.searchService.isSearchable(this.searchText);
this.hasSearched = this.searchService.isSearchable(normalizedSearchText);
if (!this.hasLoadedAllCiphers && !this.hasSearched) {
await this.loadCiphers();
} else {
this.ciphers = await this.searchService.searchCiphers(
this.searchText,
normalizedSearchText,
filterDeleted,
this.allCiphers
);