export class MarkdownTextareaComponent implements ControlValueAccessor, OnInit {
@Input() content = ''
- @Input() classes: string[] = []
+ @Input() classes: string[] | { [klass: string]: any[] | any } = []
@Input() textareaWidth = '100%'
@Input() textareaHeight = '150px'
@Input() previewColumn = false
@Input() truncate: number
@Input() markdownType: 'text' | 'enhanced' = 'text'
+ @Input() markdownVideo = false
+ @Input() name = 'description'
textareaMarginRight = '0'
flexDirection = 'column'
return this.screenService.isInSmallView() === false
}
- private updatePreviews () {
+ private async updatePreviews () {
if (this.content === null || this.content === undefined) return
- this.truncatedPreviewHTML = this.markdownRender(truncate(this.content, { length: this.truncate }))
- this.previewHTML = this.markdownRender(this.content)
+ this.truncatedPreviewHTML = await this.markdownRender(truncate(this.content, { length: this.truncate }))
+ this.previewHTML = await this.markdownRender(this.content)
}
- private markdownRender (text: string) {
- if (this.markdownType === 'text') return this.markdownService.textMarkdownToHTML(text)
+ private async markdownRender (text: string) {
+ const html = this.markdownType === 'text' ?
+ await this.markdownService.textMarkdownToHTML(text) :
+ await this.markdownService.enhancedMarkdownToHTML(text)
- return this.markdownService.enhancedMarkdownToHTML(text)
+ return this.markdownVideo ? this.markdownService.processVideoTimestamps(html) : html
}
}