Fix: use entire document for dropzone (#7342)

This commit is contained in:
shamoon 2024-07-29 07:26:29 -07:00 committed by GitHub
parent a7536e3ebf
commit 8987cd448f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -38,7 +38,7 @@ export class FileDropComponent {
@ViewChild('ngxFileDrop') ngxFileDrop: NgxFileDropComponent
@HostListener('dragover', ['$event']) onDragOver(event: DragEvent) {
@HostListener('document:dragover', ['$event']) onDragOver(event: DragEvent) {
if (!this.dragDropEnabled || !event.dataTransfer?.types?.includes('Files'))
return
event.preventDefault()
@ -53,7 +53,7 @@ export class FileDropComponent {
clearTimeout(this.fileLeaveTimeoutID)
}
@HostListener('dragleave', ['$event']) public onDragLeave(
@HostListener('document:dragleave', ['$event']) public onDragLeave(
event: DragEvent,
immediate: boolean = false
) {
@ -73,7 +73,7 @@ export class FileDropComponent {
}, ms)
}
@HostListener('drop', ['$event']) public onDrop(event: DragEvent) {
@HostListener('document:drop', ['$event']) public onDrop(event: DragEvent) {
if (!this.dragDropEnabled) return
event.preventDefault()
event.stopImmediatePropagation()