diff --git a/src/components/views/rooms/MessageComposer.js b/src/components/views/rooms/MessageComposer.js index 3c7a5b077b..51c7dbe710 100644 --- a/src/components/views/rooms/MessageComposer.js +++ b/src/components/views/rooms/MessageComposer.js @@ -117,6 +117,24 @@ HangupButton.propTypes = { roomId: PropTypes.string.isRequired, } +function FormattingButton(props) { + const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); + return ; +} + +FormattingButton.propTypes = { + showFormatting: PropTypes.bool.isRequired, + onClickHandler: PropTypes.func.isRequired, +} + class UploadButton extends React.Component { static propTypes = { roomId: PropTypes.string.isRequired, @@ -374,32 +392,19 @@ export default class MessageComposer extends React.Component { } render() { - const MessageComposerInput = sdk.getComponent("rooms.MessageComposerInput"); - - const callInProgress = this.props.callState && this.props.callState !== 'ended'; - const controls = [ this.state.me ? : null, this.props.e2eStatus ? : null, ]; - const AccessibleButton = sdk.getComponent('elements.AccessibleButton'); - if (!this.state.tombstone && this.state.canSendMessages) { // This also currently includes the call buttons. Really we should // check separately for whether we can call, but this is slightly // complex because of conference calls. - const formattingButton = this.state.inputState.isRichTextEnabled ? ( - - ) : null; - + const MessageComposerInput = sdk.getComponent("rooms.MessageComposerInput"); + const showFormattingButton = this.state.inputState.isRichTextEnabled; + const callInProgress = this.props.callState && this.props.callState !== 'ended'; controls.push( , - formattingButton, + showFormattingButton ? : null, , , callInProgress ? : null,