From a7847f25147c8a42f5dad47a4b313bd52df932bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 17 Feb 2021 13:25:53 +0100 Subject: [PATCH] onIsEmptyChanged() -> onChange() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/components/views/rooms/MessageComposer.js | 7 ++++--- src/components/views/rooms/SendMessageComposer.js | 6 ++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index cd1a51245e..d70cb5c786 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -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} />, , , diff --git a/src/components/views/rooms/SendMessageComposer.js b/src/components/views/rooms/SendMessageComposer.js index 9a14e33d05..657d67aee2 100644 --- a/src/components/views/rooms/SendMessageComposer.js +++ b/src/components/views/rooms/SendMessageComposer.js @@ -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() {