File tree 2 files changed +8
-5
lines changed
2 files changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -63,12 +63,13 @@ export class UploaderBlock extends ActivityBlock {
63
63
} ) ;
64
64
}
65
65
66
- /** @param {boolean } capture */
67
- openSystemDialog ( capture = false ) {
66
+ /** @param {{ captureCamera?: boolean } } options */
67
+ openSystemDialog ( options = { } ) {
68
68
let accept = mergeFileTypes ( [
69
69
this . getCssData ( '--cfg-accept' ) ,
70
70
...( this . getCssData ( '--cfg-img-only' ) ? IMAGE_ACCEPT_LIST : [ ] ) ,
71
71
] ) . join ( ',' ) ;
72
+
72
73
if ( this . getCssData ( '--cfg-accept' ) && ! ! this . getCssData ( '--cfg-img-only' ) ) {
73
74
console . warn (
74
75
'There could be a mistake.\n' +
@@ -79,9 +80,11 @@ export class UploaderBlock extends ActivityBlock {
79
80
this . fileInput = document . createElement ( 'input' ) ;
80
81
this . fileInput . type = 'file' ;
81
82
this . fileInput . multiple = ! ! this . getCssData ( '--cfg-multiple' ) ;
82
- this . fileInput . accept = accept ;
83
- if ( capture ) {
83
+ if ( options . captureCamera ) {
84
84
this . fileInput . capture = '' ;
85
+ this . fileInput . accept = IMAGE_ACCEPT_LIST . join ( ',' ) ;
86
+ } else {
87
+ this . fileInput . accept = accept ;
85
88
}
86
89
this . fileInput . dispatchEvent ( new MouseEvent ( 'click' ) ) ;
87
90
this . fileInput . onchange = ( ) => {
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ export class SourceBtn extends UploaderBlock {
31
31
let el = document . createElement ( 'input' ) ;
32
32
var supportsCapture = el . capture !== undefined ;
33
33
if ( supportsCapture ) {
34
- this . openSystemDialog ( true ) ;
34
+ this . openSystemDialog ( { captureCamera : true } ) ;
35
35
}
36
36
return ! supportsCapture ;
37
37
} ,
You can’t perform that action at this time.
0 commit comments