@@ -62,8 +62,20 @@ export default class DropzoneHandler {
62
62
element . classList . add ( 'dropzone' ) ;
63
63
64
64
new Dropzone ( element , dropzoneConfiguration )
65
- . on ( 'removedfile' , ( file ) => {
65
+ . on ( 'addedfile' , ( file ) => {
66
+ const elType = file . previewElement . querySelector ( '[data-dz-type]' ) ;
67
+
68
+ if ( ! elType || ! file . type || ! file . type . includes ( '/' ) ) {
69
+ return ;
70
+ }
71
+
72
+ const splittedType = file . type . split ( '/' ) ;
66
73
74
+ if ( splittedType . length > 1 ) {
75
+ elType . textContent = splittedType [ 1 ] ;
76
+ }
77
+ } )
78
+ . on ( 'removedfile' , ( file ) => {
67
79
if ( this . suspendFileRemoval ) {
68
80
return ;
69
81
}
@@ -81,22 +93,26 @@ export default class DropzoneHandler {
81
93
id : data . uuid ,
82
94
} ) ;
83
95
} ) ;
84
- } ) . on ( 'sending' , ( file , xhr , formData ) => {
85
- submitButton . setAttribute ( 'disabled' , 'disabled' ) ;
86
- formData . append ( 'uuid' , file . upload . uuid ) ;
87
- } ) . on ( 'complete' , ( ) => {
88
- submitButton . removeAttribute ( 'disabled' ) ;
89
- } ) . on ( 'success' , ( file , response ) => {
90
- this . addToStorageField ( storageField , {
91
- id : response . uuid ,
92
- fileName : response . fileName ,
96
+ } )
97
+ . on ( 'sending' , ( file , xhr , formData ) => {
98
+ submitButton . setAttribute ( 'disabled' , 'disabled' ) ;
99
+ formData . append ( 'uuid' , file . upload . uuid ) ;
100
+ } )
101
+ . on ( 'complete' , ( ) => {
102
+ submitButton . removeAttribute ( 'disabled' ) ;
103
+ } )
104
+ . on ( 'success' , ( file , response ) => {
105
+ this . addToStorageField ( storageField , {
106
+ id : response . uuid ,
107
+ fileName : response . fileName ,
108
+ } ) ;
109
+ } )
110
+ . on ( 'cancel' , ( ) => {
111
+ submitButton . removeAttribute ( 'disabled' ) ;
112
+ } )
113
+ . on ( 'reset' , ( ) => {
114
+ this . suspendFileRemoval = false ;
93
115
} ) ;
94
- } ) . on ( 'cancel' , ( ) => {
95
- submitButton . removeAttribute ( 'disabled' ) ;
96
- } ) . on ( 'reset' , ( ) => {
97
- this . suspendFileRemoval = false ;
98
- } ) ;
99
-
100
116
}
101
117
102
118
addToStorageField ( storage , newData ) {
0 commit comments