mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 21:19:37 +08:00
Bugfix: Handle defaultSearchChange when suggestions contain ‘Nav’ items (#7701)
This commit is contained in:
parent
8b1a4f80a9
commit
1dc4e45bce
@ -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…
Reference in New Issue
Block a user