diff options
author | Chocobozzz <me@florianbigard.com> | 2021-03-24 13:32:55 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-03-24 18:18:41 +0100 |
commit | a3664dfdc95897075e7b8abd670706e53f5a1ec3 (patch) | |
tree | ed7036e9051abc971d401599676b7df34efa7ced /client/src/app/shared/shared-main | |
parent | ec99e8486af6aab5a8affa2e7b9088635647b2ce (diff) | |
download | PeerTube-a3664dfdc95897075e7b8abd670706e53f5a1ec3.tar.gz PeerTube-a3664dfdc95897075e7b8abd670706e53f5a1ec3.tar.zst PeerTube-a3664dfdc95897075e7b8abd670706e53f5a1ec3.zip |
Auto focus plugin search input
Diffstat (limited to 'client/src/app/shared/shared-main')
3 files changed, 16 insertions, 0 deletions
diff --git a/client/src/app/shared/shared-main/angular/autofocus.directive.ts b/client/src/app/shared/shared-main/angular/autofocus.directive.ts new file mode 100644 index 000000000..5f087d79d --- /dev/null +++ b/client/src/app/shared/shared-main/angular/autofocus.directive.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | import { AfterViewInit, Directive, ElementRef } from '@angular/core' | ||
2 | |||
3 | @Directive({ | ||
4 | selector: '[autofocus]' | ||
5 | }) | ||
6 | export class AutofocusDirective implements AfterViewInit { | ||
7 | constructor (private host: ElementRef) { } | ||
8 | |||
9 | ngAfterViewInit () { | ||
10 | this.host.nativeElement.focus() | ||
11 | } | ||
12 | } | ||
diff --git a/client/src/app/shared/shared-main/angular/index.ts b/client/src/app/shared/shared-main/angular/index.ts index 29f8b3650..8ea47bb33 100644 --- a/client/src/app/shared/shared-main/angular/index.ts +++ b/client/src/app/shared/shared-main/angular/index.ts | |||
@@ -1,3 +1,4 @@ | |||
1 | export * from './autofocus.directive' | ||
1 | export * from './bytes.pipe' | 2 | export * from './bytes.pipe' |
2 | export * from './duration-formatter.pipe' | 3 | export * from './duration-formatter.pipe' |
3 | export * from './from-now.pipe' | 4 | export * from './from-now.pipe' |
diff --git a/client/src/app/shared/shared-main/shared-main.module.ts b/client/src/app/shared/shared-main/shared-main.module.ts index 9d550996d..3e21d491a 100644 --- a/client/src/app/shared/shared-main/shared-main.module.ts +++ b/client/src/app/shared/shared-main/shared-main.module.ts | |||
@@ -19,6 +19,7 @@ import { LoadingBarHttpClientModule } from '@ngx-loading-bar/http-client' | |||
19 | import { SharedGlobalIconModule } from '../shared-icons' | 19 | import { SharedGlobalIconModule } from '../shared-icons' |
20 | import { AccountService, ActorAvatarInfoComponent, VideoAvatarChannelComponent } from './account' | 20 | import { AccountService, ActorAvatarInfoComponent, VideoAvatarChannelComponent } from './account' |
21 | import { | 21 | import { |
22 | AutofocusDirective, | ||
22 | BytesPipe, | 23 | BytesPipe, |
23 | DurationFormatterPipe, | 24 | DurationFormatterPipe, |
24 | FromNowPipe, | 25 | FromNowPipe, |
@@ -71,6 +72,7 @@ import { VideoChannelService } from './video-channel' | |||
71 | NumberFormatterPipe, | 72 | NumberFormatterPipe, |
72 | BytesPipe, | 73 | BytesPipe, |
73 | DurationFormatterPipe, | 74 | DurationFormatterPipe, |
75 | AutofocusDirective, | ||
74 | 76 | ||
75 | InfiniteScrollerDirective, | 77 | InfiniteScrollerDirective, |
76 | PeerTubeTemplateDirective, | 78 | PeerTubeTemplateDirective, |
@@ -125,6 +127,7 @@ import { VideoChannelService } from './video-channel' | |||
125 | BytesPipe, | 127 | BytesPipe, |
126 | NumberFormatterPipe, | 128 | NumberFormatterPipe, |
127 | DurationFormatterPipe, | 129 | DurationFormatterPipe, |
130 | AutofocusDirective, | ||
128 | 131 | ||
129 | InfiniteScrollerDirective, | 132 | InfiniteScrollerDirective, |
130 | PeerTubeTemplateDirective, | 133 | PeerTubeTemplateDirective, |