X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=client%2Fsrc%2Fapp%2Fheader%2Fsearch-typeahead.component.ts;h=d2549315cd4f9db83cea26c84d9bca20c7844043;hb=8fd05f55dc56164b94adf8e58485a2e8bc9637ab;hp=b5d76c70e1143ff45d7369bd9c445ec8783460f1;hpb=2989628b7913383b39ac34c7db8666a21f8e5037;p=github%2FChocobozzz%2FPeerTube.git diff --git a/client/src/app/header/search-typeahead.component.ts b/client/src/app/header/search-typeahead.component.ts index b5d76c70e..d2549315c 100644 --- a/client/src/app/header/search-typeahead.component.ts +++ b/client/src/app/header/search-typeahead.component.ts @@ -4,6 +4,7 @@ import { ListKeyManager } from '@angular/cdk/a11y' import { AfterViewChecked, Component, OnDestroy, OnInit, QueryList, ViewChildren } from '@angular/core' import { ActivatedRoute, Params, Router } from '@angular/router' import { AuthService, ServerService } from '@app/core' +import { logger } from '@root-helpers/logger' import { HTMLServerConfig, SearchTargetType } from '@shared/models' import { SuggestionComponent, SuggestionPayload, SuggestionPayloadType } from './suggestion.component' @@ -91,7 +92,7 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewChecked, OnDes const activeIndex = this.suggestionItems.toArray().findIndex(i => i.result.default === true) if (activeIndex === -1) { - console.error('Cannot find active index.', { suggestionItems: this.suggestionItems }) + logger.error('Cannot find active index.', { suggestionItems: this.suggestionItems }) } this.updateItemsState(activeIndex) @@ -152,7 +153,7 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewChecked, OnDes } } - onSuggestionlicked (payload: SuggestionPayload) { + onSuggestionClicked (payload: SuggestionPayload) { this.doSearch(this.buildSearchTarget(payload)) } @@ -170,6 +171,11 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewChecked, OnDes this.keyboardEventsManager.onKeydown(event) break + + case 'Enter': + event.stopPropagation() + this.doSearch() + break } } @@ -199,7 +205,7 @@ export class SearchTypeaheadComponent implements OnInit, AfterViewChecked, OnDes } private loadUserLanguagesIfNeeded (queryParams: any) { - if (queryParams && queryParams.languageOneOf) return of(queryParams) + if (queryParams?.languageOneOf) return of(queryParams) return this.authService.userInformationLoaded .pipe(