Fixing double enter in channel switcher (#6208)
Этот коммит содержится в:
коммит произвёл
Joram Wilander
родитель
134f78e630
Коммит
7f68a60f8c
@@ -36,6 +36,7 @@ export default class SearchBar extends React.Component {
|
|||||||
this.handleSubmit = this.handleSubmit.bind(this);
|
this.handleSubmit = this.handleSubmit.bind(this);
|
||||||
this.searchMentions = this.searchMentions.bind(this);
|
this.searchMentions = this.searchMentions.bind(this);
|
||||||
this.getFlagged = this.getFlagged.bind(this);
|
this.getFlagged = this.getFlagged.bind(this);
|
||||||
|
this.handleKeyDown = this.handleKeyDown.bind(this);
|
||||||
|
|
||||||
const state = this.getSearchTermStateFromStores();
|
const state = this.getSearchTermStateFromStores();
|
||||||
state.focused = false;
|
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) {
|
handleChange(e) {
|
||||||
var term = e.target.value;
|
var term = e.target.value;
|
||||||
SearchStore.storeSearchTerm(term);
|
SearchStore.storeSearchTerm(term);
|
||||||
@@ -320,6 +325,7 @@ export default class SearchBar extends React.Component {
|
|||||||
onFocus={this.handleUserFocus}
|
onFocus={this.handleUserFocus}
|
||||||
onBlur={this.handleUserBlur}
|
onBlur={this.handleUserBlur}
|
||||||
onChange={this.handleChange}
|
onChange={this.handleChange}
|
||||||
|
onKeyDown={this.handleKeyDown}
|
||||||
listComponent={SearchSuggestionList}
|
listComponent={SearchSuggestionList}
|
||||||
providers={this.suggestionProviders}
|
providers={this.suggestionProviders}
|
||||||
type='search'
|
type='search'
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ export default class SuggestionBox extends React.Component {
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} else if (e.which === KeyCodes.ENTER || e.which === KeyCodes.TAB) {
|
} else if (e.which === KeyCodes.ENTER || e.which === KeyCodes.TAB) {
|
||||||
GlobalActions.emitCompleteWordSuggestion(this.suggestionId);
|
GlobalActions.emitCompleteWordSuggestion(this.suggestionId);
|
||||||
|
this.props.onKeyDown(e);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
} else if (e.which === KeyCodes.ESCAPE) {
|
} else if (e.which === KeyCodes.ESCAPE) {
|
||||||
GlobalActions.emitClearSuggestions(this.suggestionId);
|
GlobalActions.emitClearSuggestions(this.suggestionId);
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user