Merge pull request #2968 from npny/npny/autocomplete-prevent-send-on-enter

Hide autocomplete on Enter key press instead of sending message
pull/21833/head
Bruno Windels 2019-05-28 09:17:28 +00:00 committed by GitHub
commit e1d1c8f99c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 0 deletions

View File

@ -988,6 +988,12 @@ export default class MessageComposerInput extends React.Component {
return change.insertText('\n');
}
if (this.autocomplete.countCompletions() > 0) {
this.autocomplete.hide();
ev.preventDefault();
return true;
}
const editorState = this.state.editorState;
const lastBlock = editorState.blocks.last();