diff options
author | Chocobozzz <me@florianbigard.com> | 2017-12-29 09:18:00 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2017-12-29 09:18:00 +0100 |
commit | eacf925ea668ba48c30f4e8e3c117d8daaebfe77 (patch) | |
tree | 596be586962e8d2bae90561d0781e24b09acf8b8 /client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | |
parent | 59651eee5600839cdc62911a211d61457d8456b7 (diff) | |
download | PeerTube-eacf925ea668ba48c30f4e8e3c117d8daaebfe77.tar.gz PeerTube-eacf925ea668ba48c30f4e8e3c117d8daaebfe77.tar.zst PeerTube-eacf925ea668ba48c30f4e8e3c117d8daaebfe77.zip |
Comment textarea focus on init
Diffstat (limited to 'client/src/app/videos/+video-watch/comment/video-comment-add.component.ts')
-rw-r--r-- | client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts index d05232202..a6525987e 100644 --- a/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts +++ b/client/src/app/videos/+video-watch/comment/video-comment-add.component.ts | |||
@@ -1,4 +1,4 @@ | |||
1 | import { Component, EventEmitter, Input, OnInit, Output } from '@angular/core' | 1 | import { Component, ElementRef, EventEmitter, Input, OnInit, Output, ViewChild } from '@angular/core' |
2 | import { FormBuilder, FormGroup } from '@angular/forms' | 2 | import { FormBuilder, FormGroup } from '@angular/forms' |
3 | import { NotificationsService } from 'angular2-notifications' | 3 | import { NotificationsService } from 'angular2-notifications' |
4 | import { Observable } from 'rxjs/Observable' | 4 | import { Observable } from 'rxjs/Observable' |
@@ -17,6 +17,7 @@ import { VideoCommentService } from './video-comment.service' | |||
17 | export class VideoCommentAddComponent extends FormReactive implements OnInit { | 17 | export class VideoCommentAddComponent extends FormReactive implements OnInit { |
18 | @Input() video: Video | 18 | @Input() video: Video |
19 | @Input() parentComment: VideoComment | 19 | @Input() parentComment: VideoComment |
20 | @Input() focusOnInit = false | ||
20 | 21 | ||
21 | @Output() commentCreated = new EventEmitter<VideoCommentCreate>() | 22 | @Output() commentCreated = new EventEmitter<VideoCommentCreate>() |
22 | 23 | ||
@@ -28,6 +29,8 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
28 | 'text': VIDEO_COMMENT_TEXT.MESSAGES | 29 | 'text': VIDEO_COMMENT_TEXT.MESSAGES |
29 | } | 30 | } |
30 | 31 | ||
32 | @ViewChild('textarea') private textareaElement: ElementRef | ||
33 | |||
31 | constructor ( | 34 | constructor ( |
32 | private formBuilder: FormBuilder, | 35 | private formBuilder: FormBuilder, |
33 | private notificationsService: NotificationsService, | 36 | private notificationsService: NotificationsService, |
@@ -46,6 +49,10 @@ export class VideoCommentAddComponent extends FormReactive implements OnInit { | |||
46 | 49 | ||
47 | ngOnInit () { | 50 | ngOnInit () { |
48 | this.buildForm() | 51 | this.buildForm() |
52 | |||
53 | if (this.focusOnInit === true) { | ||
54 | this.textareaElement.nativeElement.focus() | ||
55 | } | ||
49 | } | 56 | } |
50 | 57 | ||
51 | formValidated () { | 58 | formValidated () { |