aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-custom-markup
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-custom-markup')
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup-container.component.html1
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts26
-rw-r--r--client/src/app/shared/shared-custom-markup/custom-markup.service.ts24
-rw-r--r--client/src/app/shared/shared-custom-markup/index.ts1
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.html (renamed from client/src/app/shared/shared-custom-markup/button-markup.component.html)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.scss (renamed from client/src/app/shared/shared-custom-markup/button-markup.component.scss)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.ts (renamed from client/src/app/shared/shared-custom-markup/button-markup.component.ts)2
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.html (renamed from client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.html)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.scss (renamed from client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.scss)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts (renamed from client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.ts)2
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts (renamed from client/src/app/shared/shared-custom-markup/embed-markup.component.ts)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/index.ts6
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.html (renamed from client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.html)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.scss (renamed from client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.scss)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts (renamed from client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.ts)4
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.html (renamed from client/src/app/shared/shared-custom-markup/video-miniature-markup.component.html)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.scss (renamed from client/src/app/shared/shared-custom-markup/video-miniature-markup.component.scss)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts (renamed from client/src/app/shared/shared-custom-markup/video-miniature-markup.component.ts)4
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html (renamed from client/src/app/shared/shared-custom-markup/videos-list-markup.component.html)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss (renamed from client/src/app/shared/shared-custom-markup/videos-list-markup.component.scss)0
-rw-r--r--client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts (renamed from client/src/app/shared/shared-custom-markup/videos-list-markup.component.ts)4
-rw-r--r--client/src/app/shared/shared-custom-markup/shared-custom-markup.module.ts21
22 files changed, 72 insertions, 23 deletions
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup-container.component.html b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.html
new file mode 100644
index 000000000..3ad88645d
--- /dev/null
+++ b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.html
@@ -0,0 +1 @@
<div #contentWrapper></div>
diff --git a/client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts
new file mode 100644
index 000000000..3d49c6768
--- /dev/null
+++ b/client/src/app/shared/shared-custom-markup/custom-markup-container.component.ts
@@ -0,0 +1,26 @@
1import { Component, ElementRef, Input, OnChanges, ViewChild } from '@angular/core'
2import { CustomMarkupService } from './custom-markup.service'
3
4@Component({
5 selector: 'my-custom-markup-container',
6 templateUrl: './custom-markup-container.component.html'
7})
8export class CustomMarkupContainerComponent implements OnChanges {
9 @ViewChild('contentWrapper') contentWrapper: ElementRef<HTMLInputElement>
10
11 @Input() content: string
12
13 constructor (
14 private customMarkupService: CustomMarkupService
15 ) { }
16
17 async ngOnChanges () {
18 await this.buildElement()
19 }
20
21 private async buildElement () {
22 const element = await this.customMarkupService.buildElement(this.content)
23 this.contentWrapper.nativeElement.appendChild(element)
24 }
25
26}
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())
diff --git a/client/src/app/shared/shared-custom-markup/index.ts b/client/src/app/shared/shared-custom-markup/index.ts
index a9ac2516c..3bff3a914 100644
--- a/client/src/app/shared/shared-custom-markup/index.ts
+++ b/client/src/app/shared/shared-custom-markup/index.ts
@@ -1,4 +1,5 @@
1export * from './custom-markup.service' 1export * from './custom-markup.service'
2export * from './custom-markup-container.component'
2export * from './dynamic-element.service' 3export * from './dynamic-element.service'
3export * from './custom-markup-help.component' 4export * from './custom-markup-help.component'
4export * from './shared-custom-markup.module' 5export * from './shared-custom-markup.module'
diff --git a/client/src/app/shared/shared-custom-markup/button-markup.component.html b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.html
index 619bb9d8c..619bb9d8c 100644
--- a/client/src/app/shared/shared-custom-markup/button-markup.component.html
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.html
diff --git a/client/src/app/shared/shared-custom-markup/button-markup.component.scss b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.scss
index f43d6b400..f43d6b400 100644
--- a/client/src/app/shared/shared-custom-markup/button-markup.component.scss
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.scss
diff --git a/client/src/app/shared/shared-custom-markup/button-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.ts
index c0aab2edd..987b37d19 100644
--- a/client/src/app/shared/shared-custom-markup/button-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/button-markup.component.ts
@@ -1,5 +1,5 @@
1import { Component, Input } from '@angular/core' 1import { Component, Input } from '@angular/core'
2import { VideoChannel } from '../shared-main' 2import { VideoChannel } from '../../shared-main'
3 3
4/* 4/*
5 * Markup component that creates a button 5 * Markup component that creates a button
diff --git a/client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.html b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.html
index da81006b9..da81006b9 100644
--- a/client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.html
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.html
diff --git a/client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.scss b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.scss
index 85018afe2..85018afe2 100644
--- a/client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.scss
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.scss
diff --git a/client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
index 97bb5567e..25deafb80 100644
--- a/client/src/app/shared/shared-custom-markup/channel-miniature-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/channel-miniature-markup.component.ts
@@ -1,5 +1,5 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { VideoChannel, VideoChannelService } from '../shared-main' 2import { VideoChannel, VideoChannelService } from '../../shared-main'
3 3
4/* 4/*
5 * Markup component that creates a channel miniature only 5 * Markup component that creates a channel miniature only
diff --git a/client/src/app/shared/shared-custom-markup/embed-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts
index a854d89f6..a854d89f6 100644
--- a/client/src/app/shared/shared-custom-markup/embed-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/embed-markup.component.ts
diff --git a/client/src/app/shared/shared-custom-markup/peertube-custom-tags/index.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/index.ts
new file mode 100644
index 000000000..ee2a8f330
--- /dev/null
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/index.ts
@@ -0,0 +1,6 @@
1export * from './button-markup.component'
2export * from './channel-miniature-markup.component'
3export * from './embed-markup.component'
4export * from './playlist-miniature-markup.component'
5export * from './video-miniature-markup.component'
6export * from './videos-list-markup.component'
diff --git a/client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.html b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.html
index 4e1d1a13f..4e1d1a13f 100644
--- a/client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.html
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.html
diff --git a/client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.scss b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.scss
index 281cef726..281cef726 100644
--- a/client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.scss
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.scss
diff --git a/client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
index 7aee450f1..eddc3636e 100644
--- a/client/src/app/shared/shared-custom-markup/playlist-miniature-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/playlist-miniature-markup.component.ts
@@ -1,6 +1,6 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { MiniatureDisplayOptions } from '../shared-video-miniature' 2import { MiniatureDisplayOptions } from '../../shared-video-miniature'
3import { VideoPlaylist, VideoPlaylistService } from '../shared-video-playlist' 3import { VideoPlaylist, VideoPlaylistService } from '../../shared-video-playlist'
4 4
5/* 5/*
6 * Markup component that creates a playlist miniature only 6 * Markup component that creates a playlist miniature only
diff --git a/client/src/app/shared/shared-custom-markup/video-miniature-markup.component.html b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.html
index 9b4930b6d..9b4930b6d 100644
--- a/client/src/app/shared/shared-custom-markup/video-miniature-markup.component.html
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.html
diff --git a/client/src/app/shared/shared-custom-markup/video-miniature-markup.component.scss b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.scss
index 81e265f29..81e265f29 100644
--- a/client/src/app/shared/shared-custom-markup/video-miniature-markup.component.scss
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.scss
diff --git a/client/src/app/shared/shared-custom-markup/video-miniature-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts
index 79add0c3b..c833c56c7 100644
--- a/client/src/app/shared/shared-custom-markup/video-miniature-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/video-miniature-markup.component.ts
@@ -1,7 +1,7 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { AuthService } from '@app/core' 2import { AuthService } from '@app/core'
3import { Video, VideoService } from '../shared-main' 3import { Video, VideoService } from '../../shared-main'
4import { MiniatureDisplayOptions } from '../shared-video-miniature' 4import { MiniatureDisplayOptions } from '../../shared-video-miniature'
5 5
6/* 6/*
7 * Markup component that creates a video miniature only 7 * Markup component that creates a video miniature only
diff --git a/client/src/app/shared/shared-custom-markup/videos-list-markup.component.html b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html
index 501f35e04..501f35e04 100644
--- a/client/src/app/shared/shared-custom-markup/videos-list-markup.component.html
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.html
diff --git a/client/src/app/shared/shared-custom-markup/videos-list-markup.component.scss b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss
index dcd931090..dcd931090 100644
--- a/client/src/app/shared/shared-custom-markup/videos-list-markup.component.scss
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.scss
diff --git a/client/src/app/shared/shared-custom-markup/videos-list-markup.component.ts b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
index cc25d0a51..8d9e223da 100644
--- a/client/src/app/shared/shared-custom-markup/videos-list-markup.component.ts
+++ b/client/src/app/shared/shared-custom-markup/peertube-custom-tags/videos-list-markup.component.ts
@@ -1,8 +1,8 @@
1import { Component, Input, OnInit } from '@angular/core' 1import { Component, Input, OnInit } from '@angular/core'
2import { AuthService } from '@app/core' 2import { AuthService } from '@app/core'
3import { VideoSortField } from '@shared/models' 3import { VideoSortField } from '@shared/models'
4import { Video, VideoService } from '../shared-main' 4import { Video, VideoService } from '../../shared-main'
5import { MiniatureDisplayOptions } from '../shared-video-miniature' 5import { MiniatureDisplayOptions } from '../../shared-video-miniature'
6 6
7/* 7/*
8 * Markup component list videos depending on criterias 8 * Markup component list videos depending on criterias
diff --git a/client/src/app/shared/shared-custom-markup/shared-custom-markup.module.ts b/client/src/app/shared/shared-custom-markup/shared-custom-markup.module.ts
index 66f6b98f6..dccd64709 100644
--- a/client/src/app/shared/shared-custom-markup/shared-custom-markup.module.ts
+++ b/client/src/app/shared/shared-custom-markup/shared-custom-markup.module.ts
@@ -5,15 +5,18 @@ import { SharedGlobalIconModule } from '../shared-icons'
5import { SharedMainModule } from '../shared-main' 5import { SharedMainModule } from '../shared-main'
6import { SharedVideoMiniatureModule } from '../shared-video-miniature' 6import { SharedVideoMiniatureModule } from '../shared-video-miniature'
7import { SharedVideoPlaylistModule } from '../shared-video-playlist' 7import { SharedVideoPlaylistModule } from '../shared-video-playlist'
8import { ButtonMarkupComponent } from './button-markup.component' 8import { CustomMarkupContainerComponent } from './custom-markup-container.component'
9import { ChannelMiniatureMarkupComponent } from './channel-miniature-markup.component'
10import { CustomMarkupHelpComponent } from './custom-markup-help.component' 9import { CustomMarkupHelpComponent } from './custom-markup-help.component'
11import { CustomMarkupService } from './custom-markup.service' 10import { CustomMarkupService } from './custom-markup.service'
12import { DynamicElementService } from './dynamic-element.service' 11import { DynamicElementService } from './dynamic-element.service'
13import { EmbedMarkupComponent } from './embed-markup.component' 12import {
14import { PlaylistMiniatureMarkupComponent } from './playlist-miniature-markup.component' 13 ButtonMarkupComponent,
15import { VideoMiniatureMarkupComponent } from './video-miniature-markup.component' 14 ChannelMiniatureMarkupComponent,
16import { VideosListMarkupComponent } from './videos-list-markup.component' 15 EmbedMarkupComponent,
16 PlaylistMiniatureMarkupComponent,
17 VideoMiniatureMarkupComponent,
18 VideosListMarkupComponent
19} from './peertube-custom-tags'
17 20
18@NgModule({ 21@NgModule({
19 imports: [ 22 imports: [
@@ -33,7 +36,8 @@ import { VideosListMarkupComponent } from './videos-list-markup.component'
33 EmbedMarkupComponent, 36 EmbedMarkupComponent,
34 VideosListMarkupComponent, 37 VideosListMarkupComponent,
35 ButtonMarkupComponent, 38 ButtonMarkupComponent,
36 CustomMarkupHelpComponent 39 CustomMarkupHelpComponent,
40 CustomMarkupContainerComponent
37 ], 41 ],
38 42
39 exports: [ 43 exports: [
@@ -43,7 +47,8 @@ import { VideosListMarkupComponent } from './videos-list-markup.component'
43 VideosListMarkupComponent, 47 VideosListMarkupComponent,
44 EmbedMarkupComponent, 48 EmbedMarkupComponent,
45 ButtonMarkupComponent, 49 ButtonMarkupComponent,
46 CustomMarkupHelpComponent 50 CustomMarkupHelpComponent,
51 CustomMarkupContainerComponent
47 ], 52 ],
48 53
49 providers: [ 54 providers: [