From 3dae9f3d58f475e9c25b076e04fdb0987c1a5481 Mon Sep 17 00:00:00 2001
From: YaoiFangirl420 <48789208+YaoiFangirl420@users.noreply.github.com>
Date: Sat, 6 Apr 2019 21:58:05 -0700
Subject: [PATCH] Move FormattingButton to separate component
Signed-off-by: YaoiFangirl420 <48789208+YaoiFangirl420@users.noreply.github.com>
---
src/components/views/rooms/MessageComposer.js | 40 +++++++++++--------
1 file changed, 23 insertions(+), 17 deletions(-)
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,