Commit 87ac9eb 1 parent acf7707 commit 87ac9eb Copy full SHA for 87ac9eb
File tree 2 files changed +24
-18
lines changed
2 files changed +24
-18
lines changed Original file line number Diff line number Diff line change @@ -60,23 +60,25 @@ export default class PDF extends Webform {
60
60
submission . readOnly = ! ! this . options . readOnly ;
61
61
this . postMessage ( { name : 'submission' , data : submission } ) ;
62
62
return super . setSubmission ( submission ) . then ( ( ) => {
63
- this . formio . getDownloadUrl ( ) . then ( ( url ) => {
64
- // Add a download button if it has a download url.
65
- if ( ! url ) {
66
- return ;
67
- }
68
- if ( ! this . downloadButton ) {
69
- this . downloadButton = this . ce ( 'a' , {
70
- href : url ,
71
- target : '_blank' ,
72
- style : 'position:absolute;right:10px;top:110px;cursor:pointer;'
73
- } , this . ce ( 'img' , {
74
- src : require ( './pdf.image' ) ,
75
- style : 'width:3em;'
76
- } ) ) ;
77
- this . element . insertBefore ( this . downloadButton , this . iframe ) ;
78
- }
79
- } ) ;
63
+ if ( this . formio ) {
64
+ this . formio . getDownloadUrl ( ) . then ( ( url ) => {
65
+ // Add a download button if it has a download url.
66
+ if ( ! url ) {
67
+ return ;
68
+ }
69
+ if ( ! this . downloadButton ) {
70
+ this . downloadButton = this . ce ( 'a' , {
71
+ href : url ,
72
+ target : '_blank' ,
73
+ style : 'position:absolute;right:10px;top:110px;cursor:pointer;'
74
+ } , this . ce ( 'img' , {
75
+ src : require ( './pdf.image' ) ,
76
+ style : 'width:3em;'
77
+ } ) ) ;
78
+ this . element . insertBefore ( this . downloadButton , this . iframe ) ;
79
+ }
80
+ } ) ;
81
+ }
80
82
} ) ;
81
83
}
82
84
Original file line number Diff line number Diff line change @@ -13,7 +13,8 @@ export default class FileComponent extends BaseComponent {
13
13
imageSize : '200' ,
14
14
filePattern : '*' ,
15
15
fileMinSize : '0KB' ,
16
- fileMaxSize : '1GB'
16
+ fileMaxSize : '1GB' ,
17
+ uploadOnly : false
17
18
} , ...extend ) ;
18
19
}
19
20
@@ -184,6 +185,9 @@ export default class FileComponent extends BaseComponent {
184
185
}
185
186
186
187
createFileLink ( file ) {
188
+ if ( this . options . uploadOnly ) {
189
+ return file . originalName || file . name ;
190
+ }
187
191
return this . ce ( 'a' , {
188
192
href : file . url , target : '_blank' ,
189
193
onClick : this . getFile . bind ( this , file )
You can’t perform that action at this time.
0 commit comments