aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorPoslovitch <poslovitch@bentobox.world>2021-10-23 21:57:59 +0000
committerChocobozzz <chocobozzz@cpy.re>2021-10-26 08:48:17 +0200
commit9f3bf1432d9087348563783c85e6ddb43649e2db (patch)
treec4b94971c7ed1c1de93a433ddab165d196f4a719
parent3c4d6c1d9cd942849352656a25fa2d6459da6445 (diff)
downloadPeerTube-9f3bf1432d9087348563783c85e6ddb43649e2db.tar.gz
PeerTube-9f3bf1432d9087348563783c85e6ddb43649e2db.tar.zst
PeerTube-9f3bf1432d9087348563783c85e6ddb43649e2db.zip
Added Markdown formatting in playlist descriptions
Implements https://github.com/Chocobozzz/PeerTube/issues/3627
-rw-r--r--client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html8
-rw-r--r--client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.scss6
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html2
-rw-r--r--client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts11
4 files changed, 15 insertions, 12 deletions
diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html
index 9b9befca4..c39e90a1e 100644
--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html
+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.html
@@ -41,11 +41,11 @@
41 </div> 41 </div>
42 42
43 <div class="form-group"> 43 <div class="form-group">
44 <label i18n for="description">Description</label> 44 <label i18n for="description">Description</label><my-help helpType="markdownText"></my-help>
45 <textarea 45 <my-markdown-textarea
46 id="description" formControlName="description" 46 id="description" formControlName="description"
47 class="form-control" [ngClass]="{ 'input-error': formErrors['description'] }" 47 [ngClass]="{ 'input-error': formErrors['description'] }"
48 ></textarea> 48 ></my-markdown-textarea>
49 <div *ngIf="formErrors.description" class="form-error"> 49 <div *ngIf="formErrors.description" class="form-error">
50 {{ formErrors.description }} 50 {{ formErrors.description }}
51 </div> 51 </div>
diff --git a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.scss b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.scss
index 420391322..47c323d6d 100644
--- a/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.scss
+++ b/client/src/app/+my-library/my-video-playlists/my-video-playlist-edit.component.scss
@@ -16,12 +16,6 @@ input[type=text] {
16 display: block; 16 display: block;
17} 17}
18 18
19textarea {
20 @include peertube-textarea(500px, 150px);
21
22 display: block;
23}
24
25.peertube-select-container { 19.peertube-select-container {
26 @include peertube-select-container(340px); 20 @include peertube-select-container(340px);
27} 21}
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html
index 95f11f030..3cccbe080 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.html
@@ -32,6 +32,6 @@
32 <span i18n class="updated-at">Updated {{ playlist.updatedAt | myFromNow }}</span> 32 <span i18n class="updated-at">Updated {{ playlist.updatedAt | myFromNow }}</span>
33 </div> 33 </div>
34 34
35 <div *ngIf="displayDescription" class="video-info-description">{{ playlist.description }}</div> 35 <div *ngIf="displayDescription" class="video-info-description" [innerHTML]="playlistDescription"></div>
36 </div> 36 </div>
37</div> 37</div>
diff --git a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
index c80ea2e6b..dd9fe0a5a 100644
--- a/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
+++ b/client/src/app/shared/shared-video-playlist/video-playlist-miniature.component.ts
@@ -1,6 +1,7 @@
1import { LinkType } from 'src/types/link.type' 1import { LinkType } from 'src/types/link.type'
2import { Component, Input, OnInit } from '@angular/core' 2import { Component, Input, OnInit } from '@angular/core'
3import { VideoPlaylist } from './video-playlist.model' 3import { VideoPlaylist } from './video-playlist.model'
4import { MarkdownService } from '@app/core'
4 5
5@Component({ 6@Component({
6 selector: 'my-video-playlist-miniature', 7 selector: 'my-video-playlist-miniature',
@@ -22,9 +23,17 @@ export class VideoPlaylistMiniatureComponent implements OnInit {
22 routerLink: any 23 routerLink: any
23 playlistHref: string 24 playlistHref: string
24 playlistTarget: string 25 playlistTarget: string
26 playlistDescription: string
25 27
26 ngOnInit () { 28 constructor (
29 private markdownService: MarkdownService
30 ) {}
31
32 async ngOnInit () {
27 this.buildPlaylistUrl() 33 this.buildPlaylistUrl()
34 if (this.displayDescription) {
35 this.playlistDescription = await this.markdownService.textMarkdownToHTML(this.playlist.description)
36 }
28 } 37 }
29 38
30 buildPlaylistUrl () { 39 buildPlaylistUrl () {