diff options
author | lutangar <johan.dufour@gmail.com> | 2022-08-30 17:13:26 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2022-09-08 08:41:36 +0200 |
commit | 2873a53efd8913b6b5fbf305320f88731cd07771 (patch) | |
tree | 5063f5b38f222ce27f6923dc4bb8765f713ac4c7 /client/src/app/+videos/+video-edit/shared/video-edit.component.html | |
parent | 5f016383a4fabf2f296cda6d5e383719ee9d5e27 (diff) | |
download | PeerTube-2873a53efd8913b6b5fbf305320f88731cd07771.tar.gz PeerTube-2873a53efd8913b6b5fbf305320f88731cd07771.tar.zst PeerTube-2873a53efd8913b6b5fbf305320f88731cd07771.zip |
Set scroll position at top of the textarea when opening the subtitle editor.
## Description
This set the position of the scrollbar at the top of the textarea when opening the __subtitle editor__.
Previously the textarea scroll position was at the bottom of the textarea which doesn't make much sense when you want to edit a subtitle : you most likely want to edit the beginning of the subtitle first.
This also set the caret position on the first character.
## Design decision
I had to use a *component approach* instead of an `<ng-template>` for the edition modal because the `@viewChild` directive doesn't work for elements __inside__ an `<ng-template>`.
I needed the `viewChild` directive to get an `ElementRef` of the `textarea`.
> See the following issue and its workaround :
> - https://github.com/valor-software/ngx-bootstrap/issues/3825
> - https://stackblitz.com/edit/angular-t5dfp7
> - https://medium.com/@izzatnadiri/how-to-pass-data-to-and-receive-from-ng-bootstrap-modals-916f2ad5d66e
## Related issues
Closes [peertube-plugin-transcription/#39](https://gitlab.com/apps_education/peertube/plugin-transcription/-/issues/39)
Diffstat (limited to 'client/src/app/+videos/+video-edit/shared/video-edit.component.html')
-rw-r--r-- | client/src/app/+videos/+video-edit/shared/video-edit.component.html | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/client/src/app/+videos/+video-edit/shared/video-edit.component.html b/client/src/app/+videos/+video-edit/shared/video-edit.component.html index de126bdf7..7be5a3736 100644 --- a/client/src/app/+videos/+video-edit/shared/video-edit.component.html +++ b/client/src/app/+videos/+video-edit/shared/video-edit.component.html | |||
@@ -185,7 +185,7 @@ | |||
185 | 185 | ||
186 | <div i18n class="caption-entry-state">Already uploaded on {{ videoCaption.updatedAt | date }} ✔</div> | 186 | <div i18n class="caption-entry-state">Already uploaded on {{ videoCaption.updatedAt | date }} ✔</div> |
187 | 187 | ||
188 | <span i18n class="caption-entry-edit" (click)="videoCaptionEditModal.show()">Edit</span> | 188 | <span i18n class="caption-entry-edit" (click)="openEditCaptionModal(videoCaption)">Edit</span> |
189 | <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Delete</span> | 189 | <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Delete</span> |
190 | </ng-container> | 190 | </ng-container> |
191 | 191 | ||
@@ -212,13 +212,6 @@ | |||
212 | 212 | ||
213 | <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Cancel deletion</span> | 213 | <span i18n class="caption-entry-delete" (click)="deleteCaption(videoCaption)">Cancel deletion</span> |
214 | </ng-container> | 214 | </ng-container> |
215 | |||
216 | <my-video-caption-edit-modal | ||
217 | #videoCaptionEditModal | ||
218 | [videoCaption]="videoCaption" | ||
219 | [serverConfig]="serverConfig" | ||
220 | (captionEdited)="onCaptionEdited($event)" | ||
221 | ></my-video-caption-edit-modal> | ||
222 | </div> | 215 | </div> |
223 | </div> | 216 | </div> |
224 | 217 | ||