diff options
Diffstat (limited to 'client/src/app/videos/shared')
4 files changed, 0 insertions, 97 deletions
diff --git a/client/src/app/videos/shared/index.ts b/client/src/app/videos/shared/index.ts index 3c72ed895..7a66944b9 100644 --- a/client/src/app/videos/shared/index.ts +++ b/client/src/app/videos/shared/index.ts | |||
@@ -1,2 +1 @@ | |||
1 | export * from './markdown.service' | export * from './markdown.service' | |
2 | export * from './video-description.component' | ||
diff --git a/client/src/app/videos/shared/video-description.component.html b/client/src/app/videos/shared/video-description.component.html deleted file mode 100644 index da66a9753..000000000 --- a/client/src/app/videos/shared/video-description.component.html +++ /dev/null | |||
@@ -1,9 +0,0 @@ | |||
1 | <textarea | ||
2 | [(ngModel)]="description" (ngModelChange)="onModelChange()" | ||
3 | id="description" placeholder="My super video"> | ||
4 | </textarea> | ||
5 | |||
6 | <tabset #staticTabs class="previews"> | ||
7 | <tab heading="Truncated description preview" [innerHTML]="truncatedDescriptionHTML"></tab> | ||
8 | <tab heading="Complete description preview" [innerHTML]="descriptionHTML"></tab> | ||
9 | </tabset> | ||
diff --git a/client/src/app/videos/shared/video-description.component.scss b/client/src/app/videos/shared/video-description.component.scss deleted file mode 100644 index 6ef81ae58..000000000 --- a/client/src/app/videos/shared/video-description.component.scss +++ /dev/null | |||
@@ -1,19 +0,0 @@ | |||
1 | textarea { | ||
2 | @include peertube-input-text(100%); | ||
3 | |||
4 | font-size: 15px; | ||
5 | height: 150px; | ||
6 | } | ||
7 | |||
8 | .previews /deep/ { | ||
9 | font-size: 15px !important; | ||
10 | |||
11 | .nav { | ||
12 | margin-top: 10px; | ||
13 | } | ||
14 | |||
15 | .tab-content { | ||
16 | min-height: 75px; | ||
17 | padding: 5px; | ||
18 | } | ||
19 | } | ||
diff --git a/client/src/app/videos/shared/video-description.component.ts b/client/src/app/videos/shared/video-description.component.ts deleted file mode 100644 index d9ffb7800..000000000 --- a/client/src/app/videos/shared/video-description.component.ts +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | import { Component, forwardRef, Input, OnInit } from '@angular/core' | ||
2 | import { ControlValueAccessor, NG_VALUE_ACCESSOR } from '@angular/forms' | ||
3 | import { Subject } from 'rxjs/Subject' | ||
4 | import 'rxjs/add/operator/debounceTime' | ||
5 | import 'rxjs/add/operator/distinctUntilChanged' | ||
6 | |||
7 | import { truncate } from 'lodash' | ||
8 | |||
9 | import { MarkdownService } from './markdown.service' | ||
10 | |||
11 | @Component({ | ||
12 | selector: 'my-video-description', | ||
13 | templateUrl: './video-description.component.html', | ||
14 | styleUrls: [ './video-description.component.scss' ], | ||
15 | providers: [ | ||
16 | { | ||
17 | provide: NG_VALUE_ACCESSOR, | ||
18 | useExisting: forwardRef(() => VideoDescriptionComponent), | ||
19 | multi: true | ||
20 | } | ||
21 | ] | ||
22 | }) | ||
23 | |||
24 | export class VideoDescriptionComponent implements ControlValueAccessor, OnInit { | ||
25 | @Input() description = '' | ||
26 | truncatedDescriptionHTML = '' | ||
27 | descriptionHTML = '' | ||
28 | |||
29 | private descriptionChanged = new Subject<string>() | ||
30 | |||
31 | constructor (private markdownService: MarkdownService) {} | ||
32 | |||
33 | ngOnInit () { | ||
34 | this.descriptionChanged | ||
35 | .debounceTime(150) | ||
36 | .distinctUntilChanged() | ||
37 | .subscribe(() => this.updateDescriptionPreviews()) | ||
38 | |||
39 | this.descriptionChanged.next(this.description) | ||
40 | } | ||
41 | |||
42 | propagateChange = (_: any) => { /* empty */ } | ||
43 | |||
44 | writeValue (description: string) { | ||
45 | this.description = description | ||
46 | |||
47 | this.descriptionChanged.next(this.description) | ||
48 | } | ||
49 | |||
50 | registerOnChange (fn: (_: any) => void) { | ||
51 | this.propagateChange = fn | ||
52 | } | ||
53 | |||
54 | registerOnTouched () { | ||
55 | // Unused | ||
56 | } | ||
57 | |||
58 | onModelChange () { | ||
59 | this.propagateChange(this.description) | ||
60 | |||
61 | this.descriptionChanged.next(this.description) | ||
62 | } | ||
63 | |||
64 | private updateDescriptionPreviews () { | ||
65 | this.truncatedDescriptionHTML = this.markdownService.markdownToHTML(truncate(this.description, { length: 250 })) | ||
66 | this.descriptionHTML = this.markdownService.markdownToHTML(this.description) | ||
67 | } | ||
68 | } | ||