Merge pull request #4836 from urbit/james/chat-input-fixes

chat: input behavior quirks
This commit is contained in:
Liam Fitzgerald 2021-04-30 10:42:39 +10:00 committed by GitHub
commit 3616673cae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 11 deletions

View File

@ -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) {

View File

@ -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);