aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-05-31 11:33:49 +0200
committerChocobozzz <me@florianbigard.com>2021-05-31 11:33:49 +0200
commit8ee25e17b88b970703f4df9e74cb4726bbffd837 (patch)
tree450d73715c747c82efe6c919ebeda6411c01c5e0 /client/src/app/shared/shared-custom-markup/custom-markup.service.ts
parent15f35256af15b97d2298cc44e76ffcafe73a1c88 (diff)
downloadPeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.tar.gz
PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.tar.zst
PeerTube-8ee25e17b88b970703f4df9e74cb4726bbffd837.zip
Add ability to set custom markdown in description
Diffstat (limited to 'client/src/app/shared/shared-custom-markup/custom-markup.service.ts')
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup.service.ts24
1 files changed, 17 insertions, 7 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
index 09414da95..dbb07914e 100644
--- a/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
+++ b/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
@@ -8,13 +8,15 @@ import {
8 VideoMiniatureMarkupData, 8 VideoMiniatureMarkupData,
9 VideosListMarkupData 9 VideosListMarkupData
10} from '@shared/models' 10} from '@shared/models'
11import { ButtonMarkupComponent } from './button-markup.component'
12import { ChannelMiniatureMarkupComponent } from './channel-miniature-markup.component'
13import { DynamicElementService } from './dynamic-element.service' 11import { DynamicElementService } from './dynamic-element.service'
14import { EmbedMarkupComponent } from './embed-markup.component' 12import {
15import { PlaylistMiniatureMarkupComponent } from './playlist-miniature-markup.component' 13 ButtonMarkupComponent,
16import { VideoMiniatureMarkupComponent } from './video-miniature-markup.component' 14 ChannelMiniatureMarkupComponent,
17import { VideosListMarkupComponent } from './videos-list-markup.component' 15 EmbedMarkupComponent,
16 PlaylistMiniatureMarkupComponent,
17 VideoMiniatureMarkupComponent,
18 VideosListMarkupComponent
19} from './peertube-custom-tags'
18 20
19type BuilderFunction = (el: HTMLElement) => ComponentRef<any> 21type BuilderFunction = (el: HTMLElement) => ComponentRef<any>
20 22
@@ -30,10 +32,18 @@ export class CustomMarkupService {
30 'peertube-videos-list': el => this.videosListBuilder(el) 32 'peertube-videos-list': el => this.videosListBuilder(el)
31 } 33 }
32 34
35 private customMarkdownRenderer: (text: string) => Promise<HTMLElement>
36
33 constructor ( 37 constructor (
34 private dynamicElementService: DynamicElementService, 38 private dynamicElementService: DynamicElementService,
35 private markdown: MarkdownService 39 private markdown: MarkdownService
36 ) { } 40 ) {
41 this.customMarkdownRenderer = async (text: string) => this.buildElement(text)
42 }
43
44 getCustomMarkdownRenderer () {
45 return this.customMarkdownRenderer
46 }
37 47
38 async buildElement (text: string) { 48 async buildElement (text: string) {
39 const html = await this.markdown.customPageMarkdownToHTML(text, this.getSupportedTags()) 49 const html = await this.markdown.customPageMarkdownToHTML(text, this.getSupportedTags())