Fixing double enter in channel switcher (#6208)

Этот коммит содержится в:
Christopher Speller
2017-04-24 13:10:34 -04:00
коммит произвёл Joram Wilander
родитель 134f78e630
Коммит 7f68a60f8c
2 изменённых файлов: 7 добавлений и 0 удалений

Просмотреть файл

@@ -36,6 +36,7 @@ export default class SearchBar extends React.Component {
this.handleSubmit = this.handleSubmit.bind(this);
this.searchMentions = this.searchMentions.bind(this);
this.getFlagged = this.getFlagged.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
const state = this.getSearchTermStateFromStores();
state.focused = false;
@@ -107,6 +108,10 @@ export default class SearchBar extends React.Component {
});
}
handleKeyDown() {
// This is just to prevent a JS error
}
handleChange(e) {
var term = e.target.value;
SearchStore.storeSearchTerm(term);
@@ -320,6 +325,7 @@ export default class SearchBar extends React.Component {
onFocus={this.handleUserFocus}
onBlur={this.handleUserBlur}
onChange={this.handleChange}
onKeyDown={this.handleKeyDown}
listComponent={SearchSuggestionList}
providers={this.suggestionProviders}
type='search'

Просмотреть файл

@@ -172,6 +172,7 @@ export default class SuggestionBox extends React.Component {
e.preventDefault();
} else if (e.which === KeyCodes.ENTER || e.which === KeyCodes.TAB) {
GlobalActions.emitCompleteWordSuggestion(this.suggestionId);
this.props.onKeyDown(e);
e.preventDefault();
} else if (e.which === KeyCodes.ESCAPE) {
GlobalActions.emitClearSuggestions(this.suggestionId);