]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commit
Set scroll position at top of the textarea when opening the subtitle editor.
authorlutangar <johan.dufour@gmail.com>
Tue, 30 Aug 2022 15:13:26 +0000 (17:13 +0200)
committerChocobozzz <chocobozzz@cpy.re>
Thu, 8 Sep 2022 06:41:36 +0000 (08:41 +0200)
commit2873a53efd8913b6b5fbf305320f88731cd07771
tree5063f5b38f222ce27f6923dc4bb8765f713ac4c7
parent5f016383a4fabf2f296cda6d5e383719ee9d5e27
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)
client/src/app/+videos/+video-edit/shared/video-caption-edit-modal-content/video-caption-edit-modal-content.component.html [new file with mode: 0644]
client/src/app/+videos/+video-edit/shared/video-caption-edit-modal-content/video-caption-edit-modal-content.component.scss [moved from client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.scss with 100% similarity]
client/src/app/+videos/+video-edit/shared/video-caption-edit-modal-content/video-caption-edit-modal-content.component.ts [moved from client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.ts with 70% similarity]
client/src/app/+videos/+video-edit/shared/video-caption-edit-modal/video-caption-edit-modal.component.html [deleted file]
client/src/app/+videos/+video-edit/shared/video-edit.component.html
client/src/app/+videos/+video-edit/shared/video-edit.component.ts
client/src/app/+videos/+video-edit/shared/video-edit.module.ts