44 */
55
66import { Direction , Directionality } from '@angular/cdk/bidi' ;
7+ import { Platform } from '@angular/cdk/platform' ;
78import { DOCUMENT , NgClass , NgIf , NgTemplateOutlet } from '@angular/common' ;
89import {
910 AfterViewInit ,
@@ -21,7 +22,8 @@ import {
2122 Output ,
2223 TemplateRef ,
2324 ViewChild ,
24- ViewEncapsulation
25+ ViewEncapsulation ,
26+ inject
2527} from '@angular/core' ;
2628import { Observable , Subject , Subscription , fromEvent , of } from 'rxjs' ;
2729import { filter , takeUntil } from 'rxjs/operators' ;
@@ -178,6 +180,8 @@ export class NzUploadComponent implements OnInit, AfterViewInit, OnChanges, OnDe
178180 return this ;
179181 }
180182
183+ private readonly platform = inject ( Platform ) ;
184+
181185 // #endregion
182186
183187 constructor (
@@ -353,15 +357,17 @@ export class NzUploadComponent implements OnInit, AfterViewInit, OnChanges, OnDe
353357 }
354358
355359 ngAfterViewInit ( ) : void {
356- // fix firefox drop open new tab
357- this . ngZone . runOutsideAngular ( ( ) =>
358- fromEvent < MouseEvent > ( this . document . body , 'drop' )
359- . pipe ( takeUntil ( this . destroy$ ) )
360- . subscribe ( event => {
361- event . preventDefault ( ) ;
362- event . stopPropagation ( ) ;
363- } )
364- ) ;
360+ if ( this . platform . FIREFOX ) {
361+ // fix firefox drop open new tab
362+ this . ngZone . runOutsideAngular ( ( ) =>
363+ fromEvent < MouseEvent > ( this . document . body , 'drop' )
364+ . pipe ( takeUntil ( this . destroy$ ) )
365+ . subscribe ( event => {
366+ event . preventDefault ( ) ;
367+ event . stopPropagation ( ) ;
368+ } )
369+ ) ;
370+ }
365371 }
366372
367373 ngOnChanges ( ) : void {
0 commit comments