chat: persist submit button

This commit is contained in:
James Acklin 2021-04-26 15:49:02 -04:00
parent 844bc1f8f4
commit ff3d1822c2
2 changed files with 5 additions and 19 deletions

View File

@ -44,7 +44,7 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
inCodeMode: false,
submitFocus: false,
uploadingPaste: false,
currentInput: props.message,
currentInput: props.message
};
this.chatEditor = React.createRef();
@ -124,10 +124,6 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
.catch(this.uploadError);
});
}
toggleFocus(value) {
this.setState({ submitFocus: value });
}
eventHandler(value) {
this.setState({ currentInput: value });
@ -194,8 +190,6 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
onUnmount={props.onUnmount}
message={props.message}
onPaste={this.onPaste.bind(this)}
focusEvent={() => this.toggleFocus(true)}
blurEvent={() => this.toggleFocus(false)}
changeEvent={this.eventHandler}
placeholder='Message...'
/>
@ -224,9 +218,7 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
)
) : null}
</Box>
{(MOBILE_BROWSER_REGEX.test(navigator.userAgent) &&
state.submitFocus) ||
state.currentInput !== "" ? (
{MOBILE_BROWSER_REGEX.test(navigator.userAgent) ?
<Box
ml={2}
mr="12px"
@ -237,13 +229,13 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
width="24px"
height="24px"
borderRadius="50%"
backgroundColor={state.currentInput !== "" ? "blue" : "gray"}
cursor={state.currentInput !== "" ? "pointer" : "default"}
backgroundColor={state.currentInput !== '' ? 'blue' : 'gray'}
cursor={state.currentInput !== '' ? 'pointer' : 'default'}
onClick={() => this.chatEditor.current.submit()}
>
<Icon icon="ArrowEast" color="white" />
</Box>
) : null}
: null}
</Row>
);
}

View File

@ -181,8 +181,6 @@ export default class ChatEditor extends Component {
inCodeMode,
placeholder,
message,
focusEvent,
blurEvent,
...props
} = this.props;
@ -242,8 +240,6 @@ export default class ChatEditor extends Component {
rows="1"
style={{ width: '100%', background: 'transparent', color: 'currentColor' }}
placeholder={inCodeMode ? "Code..." : "Message..."}
onFocus={focusEvent}
onBlur={blurEvent}
onChange={event => {
this.messageChange(null, null, event.target.value);
}}
@ -271,8 +267,6 @@ export default class ChatEditor extends Component {
this.editor = editor;
editor.focus();
}}
onFocus={focusEvent}
onBlur={blurEvent}
{...props}
/>
}