]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - client/src/app/shared/shared-forms/reactive-file.component.ts
Add reset button for file inputs in studio page
[github/Chocobozzz/PeerTube.git] / client / src / app / shared / shared-forms / reactive-file.component.ts
index 9d27ad07a2b3be15a61bc78e924d9ad944df8501..50b7d4c3e797f2261c008e021947eb5337f2d327 100644 (file)
@@ -20,8 +20,12 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor {
   @Input() inputName: string
   @Input() extensions: string[] = []
   @Input() maxFileSize: number
+
   @Input() displayFilename = false
+  @Input() displayReset = false
+
   @Input() icon: GlobalIconName
+  @Input() buttonTooltip: string
 
   @Output() fileChanged = new EventEmitter<Blob>()
 
@@ -62,8 +66,14 @@ export class ReactiveFileComponent implements OnInit, ControlValueAccessor {
       this.file = file
 
       this.propagateChange(this.file)
-      this.fileChanged.emit(this.file)
     }
+    this.fileChanged.emit(this.file)
+  }
+
+  reset () {
+    this.writeValue(undefined)
+    this.propagateChange(undefined)
+    this.fileChanged.emit(undefined)
   }
 
   propagateChange = (_: any) => { /* empty */ }