Merge pull request #4955 from GabrielInTheWorld/hotfixSuperSearch

Hotfix for global search
This commit is contained in:
Emanuel Schütze 2019-08-28 09:23:07 +02:00 committed by GitHub
commit 899eedf403
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 9 deletions

View File

@ -213,7 +213,9 @@ export class SearchService {
.filter(model =>
dedicatedId
? model.id === dedicatedId
: model.formatForSearch().searchValue.some(text => text.toLowerCase().indexOf(query) !== -1)
: model
.formatForSearch()
.searchValue.some(text => text && text.toLowerCase().indexOf(query) !== -1)
)
.sort((a, b) => {
switch (sortingProperty) {

View File

@ -304,14 +304,16 @@ export class SuperSearchComponent implements OnInit {
* @param event KeyboardEvent to listen to keyboard-inputs.
*/
@HostListener('document:keydown', ['$event']) public onKeyNavigation(event: KeyboardEvent): void {
if (event.key === 'Enter') {
this.viewResult(this.selectedModel);
}
if (event.key === 'ArrowUp') {
this.selectNextResult(true);
}
if (event.key === 'ArrowDown') {
this.selectNextResult(false);
if (!!this.selectedModel) {
if (event.key === 'Enter') {
this.viewResult(this.selectedModel);
}
if (event.key === 'ArrowUp') {
this.selectNextResult(true);
}
if (event.key === 'ArrowDown') {
this.selectNextResult(false);
}
}
if (event.altKey && event.shiftKey && event.key === 'V') {
this.showPreview = !this.showPreview;