diff options
Diffstat (limited to 'client/src/app/shared')
25 files changed, 75 insertions, 26 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 @@ | |||
1 | import { Component, ElementRef, Input, OnChanges, ViewChild } from '@angular/core' | ||
2 | import { CustomMarkupService } from './custom-markup.service' | ||
3 | |||
4 | @Component({ | ||
5 | selector: 'my-custom-markup-container', | ||
6 | templateUrl: './custom-markup-container.component.html' | ||
7 | }) | ||
8 | export 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' |
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()) |
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 @@ | |||
1 | export * from './custom-markup.service' | 1 | export * from './custom-markup.service' |
2 | export * from './custom-markup-container.component' | ||
2 | export * from './dynamic-element.service' | 3 | export * from './dynamic-element.service' |
3 | export * from './custom-markup-help.component' | 4 | export * from './custom-markup-help.component' |
4 | export * from './shared-custom-markup.module' | 5 | export * 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 @@ | |||
1 | import { Component, Input } from '@angular/core' | 1 | import { Component, Input } from '@angular/core' |
2 | import { VideoChannel } from '../shared-main' | 2 | import { 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 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { VideoChannel, VideoChannelService } from '../shared-main' | 2 | import { 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 @@ | |||
1 | export * from './button-markup.component' | ||
2 | export * from './channel-miniature-markup.component' | ||
3 | export * from './embed-markup.component' | ||
4 | export * from './playlist-miniature-markup.component' | ||
5 | export * from './video-miniature-markup.component' | ||
6 | export * 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 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { MiniatureDisplayOptions } from '../shared-video-miniature' | 2 | import { MiniatureDisplayOptions } from '../../shared-video-miniature' |
3 | import { VideoPlaylist, VideoPlaylistService } from '../shared-video-playlist' | 3 | import { 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 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { AuthService } from '@app/core' | 2 | import { AuthService } from '@app/core' |
3 | import { Video, VideoService } from '../shared-main' | 3 | import { Video, VideoService } from '../../shared-main' |
4 | import { MiniatureDisplayOptions } from '../shared-video-miniature' | 4 | import { 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 @@ | |||
1 | import { Component, Input, OnInit } from '@angular/core' | 1 | import { Component, Input, OnInit } from '@angular/core' |
2 | import { AuthService } from '@app/core' | 2 | import { AuthService } from '@app/core' |
3 | import { VideoSortField } from '@shared/models' | 3 | import { VideoSortField } from '@shared/models' |
4 | import { Video, VideoService } from '../shared-main' | 4 | import { Video, VideoService } from '../../shared-main' |
5 | import { MiniatureDisplayOptions } from '../shared-video-miniature' | 5 | import { 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' | |||
5 | import { SharedMainModule } from '../shared-main' | 5 | import { SharedMainModule } from '../shared-main' |
6 | import { SharedVideoMiniatureModule } from '../shared-video-miniature' | 6 | import { SharedVideoMiniatureModule } from '../shared-video-miniature' |
7 | import { SharedVideoPlaylistModule } from '../shared-video-playlist' | 7 | import { SharedVideoPlaylistModule } from '../shared-video-playlist' |
8 | import { ButtonMarkupComponent } from './button-markup.component' | 8 | import { CustomMarkupContainerComponent } from './custom-markup-container.component' |
9 | import { ChannelMiniatureMarkupComponent } from './channel-miniature-markup.component' | ||
10 | import { CustomMarkupHelpComponent } from './custom-markup-help.component' | 9 | import { CustomMarkupHelpComponent } from './custom-markup-help.component' |
11 | import { CustomMarkupService } from './custom-markup.service' | 10 | import { CustomMarkupService } from './custom-markup.service' |
12 | import { DynamicElementService } from './dynamic-element.service' | 11 | import { DynamicElementService } from './dynamic-element.service' |
13 | import { EmbedMarkupComponent } from './embed-markup.component' | 12 | import { |
14 | import { PlaylistMiniatureMarkupComponent } from './playlist-miniature-markup.component' | 13 | ButtonMarkupComponent, |
15 | import { VideoMiniatureMarkupComponent } from './video-miniature-markup.component' | 14 | ChannelMiniatureMarkupComponent, |
16 | import { 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: [ |
diff --git a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts index ab75c31ae..8e7bf2021 100644 --- a/client/src/app/shared/shared-instance/instance-about-accordion.component.ts +++ b/client/src/app/shared/shared-instance/instance-about-accordion.component.ts | |||
@@ -23,7 +23,6 @@ export class InstanceAboutAccordionComponent implements OnInit { | |||
23 | 23 | ||
24 | about: About | 24 | about: About |
25 | aboutHtml = { | 25 | aboutHtml = { |
26 | description: '', | ||
27 | terms: '', | 26 | terms: '', |
28 | codeOfConduct: '', | 27 | codeOfConduct: '', |
29 | moderationInformation: '', | 28 | moderationInformation: '', |
diff --git a/client/src/app/shared/shared-instance/instance.service.ts b/client/src/app/shared/shared-instance/instance.service.ts index 0a30446df..70e022178 100644 --- a/client/src/app/shared/shared-instance/instance.service.ts +++ b/client/src/app/shared/shared-instance/instance.service.ts | |||
@@ -40,7 +40,6 @@ export class InstanceService { | |||
40 | 40 | ||
41 | async buildHtml (about: About) { | 41 | async buildHtml (about: About) { |
42 | const html = { | 42 | const html = { |
43 | description: '', | ||
44 | terms: '', | 43 | terms: '', |
45 | codeOfConduct: '', | 44 | codeOfConduct: '', |
46 | moderationInformation: '', | 45 | moderationInformation: '', |
diff --git a/client/src/app/shared/shared-instance/shared-instance.module.ts b/client/src/app/shared/shared-instance/shared-instance.module.ts index 13c681ab8..77a64b538 100644 --- a/client/src/app/shared/shared-instance/shared-instance.module.ts +++ b/client/src/app/shared/shared-instance/shared-instance.module.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | 1 | ||
2 | import { NgModule } from '@angular/core' | 2 | import { NgModule } from '@angular/core' |
3 | import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap' | 3 | import { NgbAccordionModule } from '@ng-bootstrap/ng-bootstrap' |
4 | import { SharedCustomMarkupModule } from '../shared-custom-markup' | ||
4 | import { SharedMainModule } from '../shared-main/shared-main.module' | 5 | import { SharedMainModule } from '../shared-main/shared-main.module' |
5 | import { FeatureBooleanComponent } from './feature-boolean.component' | 6 | import { FeatureBooleanComponent } from './feature-boolean.component' |
6 | import { InstanceAboutAccordionComponent } from './instance-about-accordion.component' | 7 | import { InstanceAboutAccordionComponent } from './instance-about-accordion.component' |
@@ -12,7 +13,8 @@ import { InstanceService } from './instance.service' | |||
12 | @NgModule({ | 13 | @NgModule({ |
13 | imports: [ | 14 | imports: [ |
14 | SharedMainModule, | 15 | SharedMainModule, |
15 | NgbAccordionModule | 16 | NgbAccordionModule, |
17 | SharedCustomMarkupModule | ||
16 | ], | 18 | ], |
17 | 19 | ||
18 | declarations: [ | 20 | declarations: [ |