mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
Merge pull request #4826 from urbit/james/chatinput
chat: persist submit button
This commit is contained in:
commit
a77fa96f8a
@ -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();
|
||||
@ -125,10 +125,6 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
|
||||
});
|
||||
}
|
||||
|
||||
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>
|
||||
);
|
||||
}
|
||||
|
@ -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}
|
||||
/>
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user