Implemented chat paste. Handles text and files.

chats_paste
crockwave 2020-09-28 14:27:00 -05:00
rodzic 35d99f0beb
commit 18b7be39cd
1 zmienionych plików z 8 dodań i 0 usunięć

Wyświetl plik

@ -89,6 +89,13 @@ class ChatBox extends ImmutablePureComponent {
}
}
onPaste = (e) => {
if (e.clipboardData && e.clipboardData.files.length === 1) {
this.handleFiles(e.clipboardData.files);
e.preventDefault();
}
}
insertLine = () => {
const { content } = this.state;
this.setState({ content: content + '\n' });
@ -199,6 +206,7 @@ class ChatBox extends ImmutablePureComponent {
placeholder={intl.formatMessage(messages.placeholder)}
onKeyDown={this.handleKeyDown}
onChange={this.handleContentChange}
onPaste={this.onPaste}
value={content}
ref={this.setInputRef}
/>