mirror of
https://github.com/urbit/shrub.git
synced 2024-11-29 14:57:12 +03:00
Merge branch 'mp/chat-ux-fix' (#3273)
* origin/mp/chat-ux-fix: chat: prevent retaining sent message on unmount chat: autofocus on desktop, not mobile Signed-off-by: Matilde Park <matilde.park@sunshinegardens.org>
This commit is contained in:
commit
3f8d0e2463
@ -141,6 +141,9 @@ export class ChatScreen extends Component<ChatScreenProps, ChatScreenState> {
|
||||
s3={props.s3}
|
||||
placeholder="Message..."
|
||||
message={this.state.messages.get(props.station) || ""}
|
||||
deleteMessage={() => this.setState({
|
||||
messages: this.state.messages.set(props.station, "")
|
||||
})}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
@ -80,11 +80,17 @@ export default class ChatEditor extends Component {
|
||||
return;
|
||||
}
|
||||
|
||||
this.setState({ message: '' });
|
||||
this.props.submit(editorMessage);
|
||||
this.editor.setValue('');
|
||||
}
|
||||
|
||||
messageChange(editor, data, value) {
|
||||
if (this.state.message !== '' && value == '') {
|
||||
this.setState({
|
||||
message: value
|
||||
});
|
||||
}
|
||||
if (value == this.props.message || value == '' || value == ' ') {
|
||||
return;
|
||||
}
|
||||
@ -124,7 +130,7 @@ export default class ChatEditor extends Component {
|
||||
onChange={(e, d, v) => this.messageChange(e, d, v)}
|
||||
editorDidMount={(editor) => {
|
||||
this.editor = editor;
|
||||
if (BROWSER_REGEX.test(navigator.userAgent)) {
|
||||
if (!(BROWSER_REGEX.test(navigator.userAgent))) {
|
||||
editor.focus();
|
||||
}
|
||||
}}
|
||||
|
@ -141,6 +141,8 @@ export class ChatInput extends Component {
|
||||
messages.push(message);
|
||||
}
|
||||
|
||||
props.deleteMessage();
|
||||
|
||||
messages.forEach((message) => {
|
||||
if (message.length > 0) {
|
||||
message = this.getLetterType(message.join(' '));
|
||||
|
Loading…
Reference in New Issue
Block a user