@@ -14,18 +14,18 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17- import React , { useContext , useRef , useState } from 'react' ;
18- import { EventType } from 'matrix-js-sdk/src/@types/event' ;
1917import classNames from 'classnames' ;
18+ import { EventType } from 'matrix-js-sdk/src/@types/event' ;
19+ import React , { useContext , useRef , useState , MouseEvent } from 'react' ;
2020
21- import AccessibleButton from "./AccessibleButton" ;
22- import Spinner from "./Spinner" ;
21+ import Analytics from "../../../Analytics" ;
2322import MatrixClientContext from "../../../contexts/MatrixClientContext" ;
23+ import RoomContext from "../../../contexts/RoomContext" ;
2424import { useTimeout } from "../../../hooks/useTimeout" ;
25- import Analytics from "../../../Analytics" ;
2625import { TranslatedString } from '../../../languageHandler' ;
27- import RoomContext from "../../../contexts/RoomContext" ;
2826import { chromeFileInputFix } from "../../../utils/BrowserWorkarounds" ;
27+ import AccessibleButton from "./AccessibleButton" ;
28+ import Spinner from "./Spinner" ;
2929
3030export const AVATAR_SIZE = 52 ;
3131
@@ -35,10 +35,11 @@ interface IProps {
3535 hasAvatarLabel ?: TranslatedString ;
3636 setAvatarUrl ( url : string ) : Promise < unknown > ;
3737 isUserAvatar ?: boolean ;
38+ onClick ?( ev : MouseEvent < HTMLInputElement > ) : void ;
3839}
3940
4041const MiniAvatarUploader : React . FC < IProps > = ( {
41- hasAvatar, hasAvatarLabel, noAvatarLabel, setAvatarUrl, isUserAvatar, children,
42+ hasAvatar, hasAvatarLabel, noAvatarLabel, setAvatarUrl, isUserAvatar, children, onClick ,
4243} ) => {
4344 const cli = useContext ( MatrixClientContext ) ;
4445 const [ busy , setBusy ] = useState ( false ) ;
@@ -66,7 +67,10 @@ const MiniAvatarUploader: React.FC<IProps> = ({
6667 type = "file"
6768 ref = { uploadRef }
6869 className = "mx_MiniAvatarUploader_input"
69- onClick = { chromeFileInputFix }
70+ onClick = { ( ev ) => {
71+ chromeFileInputFix ( ev ) ;
72+ onClick ?.( ev ) ;
73+ } }
7074 onChange = { async ( ev ) => {
7175 if ( ! ev . target . files ?. length ) return ;
7276 setBusy ( true ) ;
0 commit comments