mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
chat: refocus and reset state on submit, allow enter linebreaks on mobile
This commit is contained in:
parent
11e89cf388
commit
f39c642801
@ -74,6 +74,8 @@ class ChatInput extends Component<ChatInputProps, ChatInputState> {
|
||||
} else {
|
||||
onSubmit(tokenizeMessage(text));
|
||||
}
|
||||
this.chatEditor.current.editor.focus();
|
||||
this.setState({ currentInput: '' });
|
||||
}
|
||||
|
||||
uploadSuccess(url: string) {
|
||||
|
@ -240,17 +240,12 @@ export default class ChatEditor extends Component {
|
||||
rows="1"
|
||||
style={{ width: '100%', background: 'transparent', color: 'currentColor' }}
|
||||
placeholder={inCodeMode ? "Code..." : "Message..."}
|
||||
onChange={event => {
|
||||
this.messageChange(null, null, event.target.value);
|
||||
}}
|
||||
onKeyDown={event => {
|
||||
if (event.key === 'Enter') {
|
||||
event.preventDefault();
|
||||
this.submit();
|
||||
} else {
|
||||
this.messageChange(null, null, event.target.value);
|
||||
onChange={event =>
|
||||
this.messageChange(null, null, event.target.value)
|
||||
}
|
||||
onKeyDown={event =>
|
||||
this.messageChange(null, null, event.target.value)
|
||||
}
|
||||
}}
|
||||
ref={input => {
|
||||
if (!input) return;
|
||||
this.editor = inputProxy(input);
|
||||
|
Loading…
Reference in New Issue
Block a user