onIsEmptyChanged() -> onChange()

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-02-17 13:25:53 +01:00
parent 9420cc35cc
commit a7847f2514
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
2 changed files with 6 additions and 7 deletions

View File

@ -415,9 +415,10 @@ export default class MessageComposer extends React.Component {
this.messageComposerInput._sendMessage();
}
onIsEmptyChanged = (isEmpty) => {
onChange = () => {
if (!this.messageComposerInput) return;
this.setState({
isComposerEmpty: isEmpty,
isComposerEmpty: this.messageComposerInput.model.isEmpty,
});
}
@ -446,7 +447,7 @@ export default class MessageComposer extends React.Component {
resizeNotifier={this.props.resizeNotifier}
permalinkCreator={this.props.permalinkCreator}
replyToEvent={this.props.replyToEvent}
onIsEmptyChanged={this.onIsEmptyChanged}
onChange={this.onChange}
/>,
<UploadButton key="controls_upload" roomId={this.props.room.roomId} />,
<EmojiButton key="emoji_button" addEmoji={this.addEmoji} />,

View File

@ -117,7 +117,7 @@ export default class SendMessageComposer extends React.Component {
placeholder: PropTypes.string,
permalinkCreator: PropTypes.object.isRequired,
replyToEvent: PropTypes.object,
onIsEmptyChanged: PropTypes.func,
onChange: PropTypes.func,
};
static contextType = MatrixClientContext;
@ -538,9 +538,7 @@ export default class SendMessageComposer extends React.Component {
}
onChange = () => {
if (this.props.onIsEmptyChanged) {
this.props.onIsEmptyChanged(this.model.isEmpty);
}
if (this.props.onChange) this.props.onChange();
}
render() {