mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-05 02:39:33 +02:00
Correctly truncate HTML
We can because we don't use the video truncated description since v5.0
This commit is contained in:
parent
e4f82eaa8b
commit
c5f8dc0533
12 changed files with 58 additions and 96 deletions
|
@ -1,4 +1,3 @@
|
|||
import truncate from 'lodash-es/truncate'
|
||||
import { Subject } from 'rxjs'
|
||||
import { debounceTime, distinctUntilChanged } from 'rxjs/operators'
|
||||
import { ViewportScroller } from '@angular/common'
|
||||
|
@ -26,7 +25,7 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
|
|||
|
||||
@Input() formError: string
|
||||
|
||||
@Input() truncate: number
|
||||
@Input() truncateTo3Lines: boolean
|
||||
|
||||
@Input() markdownType: 'text' | 'enhanced' | 'to-unsafe-html' = 'text'
|
||||
@Input() customMarkdownRenderer?: (text: string) => Promise<string | HTMLElement>
|
||||
|
@ -42,7 +41,6 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
|
|||
@ViewChild('textarea') textareaElement: ElementRef
|
||||
@ViewChild('previewElement') previewElement: ElementRef
|
||||
|
||||
truncatedPreviewHTML: SafeHtml | string = ''
|
||||
previewHTML: SafeHtml | string = ''
|
||||
|
||||
isMaximized = false
|
||||
|
@ -129,7 +127,6 @@ export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
|
|||
private async updatePreviews () {
|
||||
if (this.content === null || this.content === undefined) return
|
||||
|
||||
this.truncatedPreviewHTML = await this.markdownRender(truncate(this.content, { length: this.truncate }))
|
||||
this.previewHTML = await this.markdownRender(this.content)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue