diff --git a/components/mention/index.tsx b/components/mention/index.tsx index 85253e26b3..32e696519e 100644 --- a/components/mention/index.tsx +++ b/components/mention/index.tsx @@ -4,15 +4,15 @@ import classnames from 'classnames'; export interface MentionProps { prefixCls: string; - suggestionStyle?: Object; + suggestionStyle?: Object; suggestions?: Array; onSearchChange?: Function; onChange?: Function; notFoundContent?: any; loading?: Boolean; style?: Object; - defaultValue?: string, - className?: string, + defaultValue?: string; + className?: string; multiLines?: Boolean; } @@ -45,7 +45,6 @@ export default class Mention extends React.Component } onSearchChange(value) { - console.log('onSearchChange', this.props.onSearchChange); if (this.props.onSearchChange) { return this.props.onSearchChange(value); } @@ -57,10 +56,10 @@ export default class Mention extends React.Component this.props.onChange(editorState, textValue); } } - + defaultSearchChange(value: String): void { const searchValue = value.toLowerCase(); - const filteredSuggestions = this.props.suggestions.filter( + const filteredSuggestions = this.props.suggestions.filter( suggestion => suggestion.toLowerCase().indexOf(searchValue) !== -1 ); this.setState({ @@ -69,9 +68,9 @@ export default class Mention extends React.Component } render() { - const { className, prefixCls, style, multiLines, defaultValue } = this.props; + const { className, prefixCls, style, multiLines, defaultValue } = this.props; let { notFoundContent } = this.props; - + const { suggestions, focus } = this.state; const cls = classnames({ [className]: !!className, @@ -81,8 +80,8 @@ export default class Mention extends React.Component if (this.props.loading) { notFoundContent = ; } - - return onChange={this.onChange.bind(this)} onFocus={() => this.setState({focus: true})} onBlur={() => this.setState({focus: false})} - suggestions={suggestions} + suggestions={suggestions} notFoundContent={notFoundContent} />; }