File tree Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Expand file tree Collapse file tree 2 files changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,10 @@ module.exports = {
29
29
function : 'fileValidation' ,
30
30
on : 'change' ,
31
31
} ,
32
+ script : {
33
+ function : 'fileScript' ,
34
+ on : 'change' ,
35
+ } ,
32
36
type : 'file' ,
33
37
label : 'Upload a file' ,
34
38
settings : {
Original file line number Diff line number Diff line change @@ -100,15 +100,23 @@ module.exports = function fileScript(input, settings) {
100
100
101
101
if ( target . checked ) {
102
102
link . style . display = 'none' ;
103
+ if ( upload . value ) {
104
+ upload . value = '' ;
105
+ link = clear ( link ) ;
106
+ }
103
107
}
104
108
else {
105
109
link . style . display = '' ;
106
110
}
107
111
}
108
112
109
- // actions on the file input element
110
- upload . addEventListener ( 'change' , uploadHandler ) ;
113
+ if ( upload ) {
114
+ // actions on the file input element
115
+ upload . addEventListener ( 'change' , uploadHandler ) ;
116
+ }
111
117
112
- // actions on the checkbox element
113
- checkbox . addEventListener ( 'change' , checkboxHandler ) ;
118
+ if ( checkbox ) {
119
+ // actions on the checkbox element
120
+ checkbox . addEventListener ( 'change' , checkboxHandler ) ;
121
+ }
114
122
} ;
You can’t perform that action at this time.
0 commit comments