PLT-7313: Show help popover when search focused and empty. (#7134)

Этот коммит содержится в:
George Goldberg
2017-08-08 13:44:12 +01:00
коммит произвёл Joram Wilander
родитель bec6b90b8d
Коммит 82407bd44a

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

@@ -52,6 +52,11 @@ export default class SuggestionBox extends React.Component {
*/ */
completeOnTab: PropTypes.bool, completeOnTab: PropTypes.bool,
/**
* Function called when input box gains focus
*/
onFocus: PropTypes.func,
/** /**
* Function called when input box loses focus * Function called when input box loses focus
*/ */
@@ -177,9 +182,7 @@ export default class SuggestionBox extends React.Component {
} }
handleFocus() { handleFocus() {
if (!this.props.openOnFocus) { if (this.props.openOnFocus) {
return;
}
setTimeout(() => { setTimeout(() => {
const textbox = this.getTextbox(); const textbox = this.getTextbox();
if (textbox) { if (textbox) {
@@ -191,6 +194,11 @@ export default class SuggestionBox extends React.Component {
}); });
} }
if (this.props.onFocus) {
this.props.onFocus();
}
}
handleChange(e) { handleChange(e) {
const textbox = this.getTextbox(); const textbox = this.getTextbox();
const pretext = textbox.value.substring(0, textbox.selectionEnd); const pretext = textbox.value.substring(0, textbox.selectionEnd);