@@ -14,18 +14,18 @@ See the License for the specific language governing permissions and
14
14
limitations under the License.
15
15
*/
16
16
17
- import React , { useContext , useRef , useState } from 'react' ;
18
- import { EventType } from 'matrix-js-sdk/src/@types/event' ;
19
17
import classNames from 'classnames' ;
18
+ import { EventType } from 'matrix-js-sdk/src/@types/event' ;
19
+ import React , { useContext , useRef , useState , MouseEvent } from 'react' ;
20
20
21
- import AccessibleButton from "./AccessibleButton" ;
22
- import Spinner from "./Spinner" ;
21
+ import Analytics from "../../../Analytics" ;
23
22
import MatrixClientContext from "../../../contexts/MatrixClientContext" ;
23
+ import RoomContext from "../../../contexts/RoomContext" ;
24
24
import { useTimeout } from "../../../hooks/useTimeout" ;
25
- import Analytics from "../../../Analytics" ;
26
25
import { TranslatedString } from '../../../languageHandler' ;
27
- import RoomContext from "../../../contexts/RoomContext" ;
28
26
import { chromeFileInputFix } from "../../../utils/BrowserWorkarounds" ;
27
+ import AccessibleButton from "./AccessibleButton" ;
28
+ import Spinner from "./Spinner" ;
29
29
30
30
export const AVATAR_SIZE = 52 ;
31
31
@@ -35,10 +35,11 @@ interface IProps {
35
35
hasAvatarLabel ?: TranslatedString ;
36
36
setAvatarUrl ( url : string ) : Promise < unknown > ;
37
37
isUserAvatar ?: boolean ;
38
+ onClick ?( ev : MouseEvent < HTMLInputElement > ) : void ;
38
39
}
39
40
40
41
const MiniAvatarUploader : React . FC < IProps > = ( {
41
- hasAvatar, hasAvatarLabel, noAvatarLabel, setAvatarUrl, isUserAvatar, children,
42
+ hasAvatar, hasAvatarLabel, noAvatarLabel, setAvatarUrl, isUserAvatar, children, onClick ,
42
43
} ) => {
43
44
const cli = useContext ( MatrixClientContext ) ;
44
45
const [ busy , setBusy ] = useState ( false ) ;
@@ -66,7 +67,10 @@ const MiniAvatarUploader: React.FC<IProps> = ({
66
67
type = "file"
67
68
ref = { uploadRef }
68
69
className = "mx_MiniAvatarUploader_input"
69
- onClick = { chromeFileInputFix }
70
+ onClick = { ( ev ) => {
71
+ chromeFileInputFix ( ev ) ;
72
+ onClick ?.( ev ) ;
73
+ } }
70
74
onChange = { async ( ev ) => {
71
75
if ( ! ev . target . files ?. length ) return ;
72
76
setBusy ( true ) ;
0 commit comments