Handles normalization on search fields for browser and desktop
This commit is contained in:
parent
2a2e9a0d7f
commit
4d4a4259c2
|
@ -193,11 +193,10 @@ 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(normalizedSearchText);
|
||||
this.hasSearched = this.searchService.isSearchable(this.searchText);
|
||||
this.ciphers = await this.searchService.searchCiphers(
|
||||
normalizedSearchText,
|
||||
this.searchText,
|
||||
filterDeleted,
|
||||
this.allCiphers
|
||||
);
|
||||
|
@ -208,12 +207,12 @@ export class VaultFilterComponent implements OnInit, OnDestroy {
|
|||
}
|
||||
this.searchPending = true;
|
||||
this.searchTimeout = setTimeout(async () => {
|
||||
this.hasSearched = this.searchService.isSearchable(normalizedSearchText);
|
||||
this.hasSearched = this.searchService.isSearchable(this.searchText);
|
||||
if (!this.hasLoadedAllCiphers && !this.hasSearched) {
|
||||
await this.loadCiphers();
|
||||
} else {
|
||||
this.ciphers = await this.searchService.searchCiphers(
|
||||
normalizedSearchText,
|
||||
this.searchText,
|
||||
filterDeleted,
|
||||
this.allCiphers
|
||||
);
|
||||
|
|
|
@ -29,7 +29,7 @@ export class SearchBarService {
|
|||
}
|
||||
|
||||
setSearchText(value: string) {
|
||||
this.searchText.next(value);
|
||||
this.searchText.next(value?.normalize("NFD").replace(/[\u0300-\u036f]/g, ""));
|
||||
}
|
||||
|
||||
private updateState() {
|
||||
|
|
|
@ -17,7 +17,7 @@ export class SearchComponent {
|
|||
});
|
||||
|
||||
this.searchText.valueChanges.subscribe((value) => {
|
||||
this.searchBarService.setSearchText(value.normalize("NFD").replace(/[\u0300-\u036f]/g, ""));
|
||||
this.searchBarService.setSearchText(value);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue