aboutsummaryrefslogtreecommitdiffhomepage
path: root/client/src/app/shared/shared-actor-image/actor-banner-edit.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'client/src/app/shared/shared-actor-image/actor-banner-edit.component.ts')
-rw-r--r--client/src/app/shared/shared-actor-image/actor-banner-edit.component.ts12
1 files changed, 11 insertions, 1 deletions
diff --git a/client/src/app/shared/shared-actor-image/actor-banner-edit.component.ts b/client/src/app/shared/shared-actor-image/actor-banner-edit.component.ts
index 48451744c..8c12d3c4c 100644
--- a/client/src/app/shared/shared-actor-image/actor-banner-edit.component.ts
+++ b/client/src/app/shared/shared-actor-image/actor-banner-edit.component.ts
@@ -1,4 +1,5 @@
1import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core' 1import { Component, ElementRef, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges, ViewChild } from '@angular/core'
2import { DomSanitizer, SafeResourceUrl } from '@angular/platform-browser'
2import { Notifier, ServerService } from '@app/core' 3import { Notifier, ServerService } from '@app/core'
3import { VideoChannel } from '@app/shared/shared-main' 4import { VideoChannel } from '@app/shared/shared-main'
4import { NgbPopover } from '@ng-bootstrap/ng-bootstrap' 5import { NgbPopover } from '@ng-bootstrap/ng-bootstrap'
@@ -17,6 +18,7 @@ export class ActorBannerEditComponent implements OnInit {
17 @ViewChild('bannerPopover') bannerPopover: NgbPopover 18 @ViewChild('bannerPopover') bannerPopover: NgbPopover
18 19
19 @Input() actor: VideoChannel 20 @Input() actor: VideoChannel
21 @Input() previewImage = false
20 22
21 @Output() bannerChange = new EventEmitter<FormData>() 23 @Output() bannerChange = new EventEmitter<FormData>()
22 @Output() bannerDelete = new EventEmitter<void>() 24 @Output() bannerDelete = new EventEmitter<void>()
@@ -25,7 +27,10 @@ export class ActorBannerEditComponent implements OnInit {
25 maxBannerSize = 0 27 maxBannerSize = 0
26 bannerExtensions = '' 28 bannerExtensions = ''
27 29
30 preview: SafeResourceUrl
31
28 constructor ( 32 constructor (
33 private sanitizer: DomSanitizer,
29 private serverService: ServerService, 34 private serverService: ServerService,
30 private notifier: Notifier 35 private notifier: Notifier
31 ) { } 36 ) { }
@@ -54,13 +59,18 @@ export class ActorBannerEditComponent implements OnInit {
54 formData.append('bannerfile', bannerfile) 59 formData.append('bannerfile', bannerfile)
55 this.bannerPopover?.close() 60 this.bannerPopover?.close()
56 this.bannerChange.emit(formData) 61 this.bannerChange.emit(formData)
62
63 if (this.previewImage) {
64 this.preview = this.sanitizer.bypassSecurityTrustResourceUrl(URL.createObjectURL(bannerfile))
65 }
57 } 66 }
58 67
59 deleteBanner () { 68 deleteBanner () {
69 this.preview = undefined
60 this.bannerDelete.emit() 70 this.bannerDelete.emit()
61 } 71 }
62 72
63 hasBanner () { 73 hasBanner () {
64 return !!this.actor.bannerUrl 74 return !!this.preview || !!this.actor.bannerUrl
65 } 75 }
66} 76}