aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-custom-markup/custom-markup.service.ts
diff options
context:
space:
mode:
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())