Browse Source

Bugfix: Handle defaultSearchChange when suggestions contain ‘Nav’ items (#7701)

pull/7716/head
Sanjay Kumar 7 years ago
committed by 陆离
parent
commit
1dc4e45bce
  1. 9
      components/mention/index.tsx

9
components/mention/index.tsx

@ -80,7 +80,14 @@ export default class Mention extends React.Component<MentionProps, MentionState>
defaultSearchChange(value: String): void {
const searchValue = value.toLowerCase();
const filteredSuggestions = (this.props.suggestions || []).filter(
suggestion => suggestion.toLowerCase().indexOf(searchValue) !== -1,
suggestion => {
if (suggestion.type && suggestion.type === Nav) {
return suggestion.props.value ?
suggestion.props.value.toLowerCase().indexOf(searchValue) !== -1
: true;
}
return suggestion.toLowerCase().indexOf(searchValue) !== -1;
},
);
this.setState({
suggestions: filteredSuggestions,

Loading…
Cancel
Save