diff options
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.ts | 24 |
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' |
11 | import { ButtonMarkupComponent } from './button-markup.component' | ||
12 | import { ChannelMiniatureMarkupComponent } from './channel-miniature-markup.component' | ||
13 | import { DynamicElementService } from './dynamic-element.service' | 11 | import { DynamicElementService } from './dynamic-element.service' |
14 | import { EmbedMarkupComponent } from './embed-markup.component' | 12 | import { |
15 | import { PlaylistMiniatureMarkupComponent } from './playlist-miniature-markup.component' | 13 | ButtonMarkupComponent, |
16 | import { VideoMiniatureMarkupComponent } from './video-miniature-markup.component' | 14 | ChannelMiniatureMarkupComponent, |
17 | import { VideosListMarkupComponent } from './videos-list-markup.component' | 15 | EmbedMarkupComponent, |
16 | PlaylistMiniatureMarkupComponent, | ||
17 | VideoMiniatureMarkupComponent, | ||
18 | VideosListMarkupComponent | ||
19 | } from './peertube-custom-tags' | ||
18 | 20 | ||
19 | type BuilderFunction = (el: HTMLElement) => ComponentRef<any> | 21 | type 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()) |