manually focus search. only search on 2 characters

This commit is contained in:
Kyle Spearrin 2018-04-18 15:49:03 -04:00
parent f783826c33
commit 152fc981a1
3 changed files with 9 additions and 2 deletions

View File

@ -65,7 +65,7 @@ export class AddEditComponent extends BaseAddEditComponent implements OnInit {
}
});
setTimeout(() => {
window.setTimeout(() => {
if (!this.editMode) {
if (this.cipher.name != null && this.cipher.name !== '') {
document.getElementById('loginUsername').focus();

View File

@ -7,7 +7,7 @@
</div>
<div class="search">
<input type="search" placeholder="{{'searchVault' | i18n}}" id="search"
[(ngModel)]="searchText" (input)="searchVault()" appAutofocus>
[(ngModel)]="searchText" (input)="searchVault()">
<i class="fa fa-search"></i>
</div>
<div class="right">

View File

@ -100,6 +100,10 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
}
}, 5000);
}
window.setTimeout(() => {
document.getElementById('search').focus();
}, 200);
}
ngOnDestroy() {
@ -149,6 +153,9 @@ export class CurrentTabComponent implements OnInit, OnDestroy {
}
searchVault() {
if (this.searchText == null || this.searchText.length < 2) {
return;
}
this.router.navigate(['/tabs/vault'], { queryParams: { searchText: this.searchText } });
}