mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
fix(chat-input) Autofocus when sending private message (#13400)
This commit is contained in:
@@ -22,6 +22,11 @@ interface IProps extends WithTranslation {
|
||||
*/
|
||||
_areSmileysDisabled: boolean;
|
||||
|
||||
/**
|
||||
* The id of the message recipient, if any.
|
||||
*/
|
||||
_privateMessageRecipientId?: string;
|
||||
|
||||
/**
|
||||
* Invoked to send chat messages.
|
||||
*/
|
||||
@@ -95,6 +100,17 @@ class ChatInput extends Component<IProps, IState> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements {@code Component#componentDidUpdate}.
|
||||
*
|
||||
* @inheritdoc
|
||||
*/
|
||||
componentDidUpdate(prevProps: Readonly<IProps>) {
|
||||
if (prevProps._privateMessageRecipientId !== this.props._privateMessageRecipientId) {
|
||||
this._textArea?.current?.focus();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implements React's {@link Component#render()}.
|
||||
*
|
||||
@@ -255,8 +271,11 @@ class ChatInput extends Component<IProps, IState> {
|
||||
* }}
|
||||
*/
|
||||
const mapStateToProps = (state: IReduxState) => {
|
||||
const { privateMessageRecipient } = state['features/chat'];
|
||||
|
||||
return {
|
||||
_areSmileysDisabled: areSmileysDisabled(state)
|
||||
_areSmileysDisabled: areSmileysDisabled(state),
|
||||
_privateMessageRecipientId: privateMessageRecipient?.id
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user