Added Markdown formatting in playlist descriptions

Implements https://github.com/Chocobozzz/PeerTube/issues/3627
This commit is contained in:
Poslovitch 2021-10-23 21:57:59 +00:00 committed by Chocobozzz
parent 3c4d6c1d9c
commit 9f3bf1432d
4 changed files with 15 additions and 12 deletions

View File

@ -41,11 +41,11 @@
</div>
<div class="form-group">
<label i18n for="description">Description</label>
<textarea
<label i18n for="description">Description</label><my-help helpType="markdownText"></my-help>
<my-markdown-textarea
id="description" formControlName="description"
class="form-control" [ngClass]="{ 'input-error': formErrors['description'] }"
></textarea>
[ngClass]="{ 'input-error': formErrors['description'] }"
></my-markdown-textarea>
<div *ngIf="formErrors.description" class="form-error">
{{ formErrors.description }}
</div>

View File

@ -16,12 +16,6 @@ input[type=text] {
display: block;
}
textarea {
@include peertube-textarea(500px, 150px);
display: block;
}
.peertube-select-container {
@include peertube-select-container(340px);
}

View File

@ -32,6 +32,6 @@
<span i18n class="updated-at">Updated {{ playlist.updatedAt | myFromNow }}</span>
</div>
<div *ngIf="displayDescription" class="video-info-description">{{ playlist.description }}</div>
<div *ngIf="displayDescription" class="video-info-description" [innerHTML]="playlistDescription"></div>
</div>
</div>

View File

@ -1,6 +1,7 @@
import { LinkType } from 'src/types/link.type'
import { Component, Input, OnInit } from '@angular/core'
import { VideoPlaylist } from './video-playlist.model'
import { MarkdownService } from '@app/core'
@Component({
selector: 'my-video-playlist-miniature',
@ -22,9 +23,17 @@ export class VideoPlaylistMiniatureComponent implements OnInit {
routerLink: any
playlistHref: string
playlistTarget: string
playlistDescription: string
ngOnInit () {
constructor (
private markdownService: MarkdownService
) {}
async ngOnInit () {
this.buildPlaylistUrl()
if (this.displayDescription) {
this.playlistDescription = await this.markdownService.textMarkdownToHTML(this.playlist.description)
}
}
buildPlaylistUrl () {