mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
PLT-7313: Show help popover when search focused and empty. (#7134)
This commit is contained in:
committed by
Joram Wilander
parent
bec6b90b8d
commit
82407bd44a
@@ -52,6 +52,11 @@ export default class SuggestionBox extends React.Component {
|
||||
*/
|
||||
completeOnTab: PropTypes.bool,
|
||||
|
||||
/**
|
||||
* Function called when input box gains focus
|
||||
*/
|
||||
onFocus: PropTypes.func,
|
||||
|
||||
/**
|
||||
* Function called when input box loses focus
|
||||
*/
|
||||
@@ -177,18 +182,21 @@ export default class SuggestionBox extends React.Component {
|
||||
}
|
||||
|
||||
handleFocus() {
|
||||
if (!this.props.openOnFocus) {
|
||||
return;
|
||||
}
|
||||
setTimeout(() => {
|
||||
const textbox = this.getTextbox();
|
||||
if (textbox) {
|
||||
const pretext = textbox.value.substring(0, textbox.selectionEnd);
|
||||
if (pretext.length >= this.props.requiredCharacters) {
|
||||
GlobalActions.emitSuggestionPretextChanged(this.suggestionId, pretext);
|
||||
if (this.props.openOnFocus) {
|
||||
setTimeout(() => {
|
||||
const textbox = this.getTextbox();
|
||||
if (textbox) {
|
||||
const pretext = textbox.value.substring(0, textbox.selectionEnd);
|
||||
if (pretext.length >= this.props.requiredCharacters) {
|
||||
GlobalActions.emitSuggestionPretextChanged(this.suggestionId, pretext);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (this.props.onFocus) {
|
||||
this.props.onFocus();
|
||||
}
|
||||
}
|
||||
|
||||
handleChange(e) {
|
||||
|
||||
Reference in New Issue
Block a user