support value props and controllred mode

This commit is contained in:
RaoHai 2016-07-18 16:58:08 +08:00
parent f547a97020
commit 69da207f3c
6 changed files with 8 additions and 6 deletions

View File

@ -15,7 +15,7 @@ Basic usage.
import { Mention } from 'antd';
function onChange(value) {
function onChange(editorState, value) {
console.log(value);
}

View File

@ -15,7 +15,7 @@ Multi lines mode.
import { Mention } from 'antd';
function onChange(value) {
function onChange(editorState, value) {
console.log(value);
}

View File

@ -28,11 +28,12 @@ When need to mention someone or something.
| suggestions | suggestion content | Array<string> or Array<Mention.Nav> | [] |
| suggestionStyle | style of suggestion container | Objet | {} |
| onSearchChange | Callback function called when search content changes | function(value:String) | [] |
| onChange | Callback function called when content of input changes | function(value:String) | null |
| onChange | Callback function called when content of input changes | function(editorState: EditorState, value:String) | null |
| notFoundContent| suggestion when suggestions empty | string | '无匹配结果,轻敲空格完成输入' |
| loading | loading mode | boolean | false |
| multiLines | multilines mode | boolean | false |
| defaultValue | default value | string | null |
| value | core state of mention | EditorState | null |
### Nav props

View File

@ -54,7 +54,7 @@ export default class Mention extends React.Component<MentionProps, MentionState>
onChange(editorState, textValue) {
if (this.props.onChange) {
this.props.onChange(textValue);
this.props.onChange(editorState, textValue);
}
}

View File

@ -28,11 +28,12 @@ english: Mention
| suggestions | 建议内容 | Array<string> or Array<Mention.Nav> | [] |
| suggestionStyle | 弹出下拉框样式 | Objet | {} |
| onSearchChange | 输入框中 @ 变化时回调 | function(value:String) | [] |
| onChange | 输入框内容变化时回调 | function(value:String) | null |
| onChange | 输入框内容变化时回调 | function(editorState: EditorState, value:String) | null |
| notFoundContent| 未找到时的内容 | string | '无匹配结果,轻敲空格完成输入' |
| loading | 加载中 | boolean | false |
| multiLines | 多行模式 | boolean | false |
| defaultValue | 默认值 | string | null |
| value | 值 | EditorState | null |
### Nav props

View File

@ -47,7 +47,7 @@
"rc-collapse": "~1.6.3",
"rc-dialog": "~6.1.1",
"rc-dropdown": "~1.4.8",
"rc-editor-mention": "~0.0.27",
"rc-editor-mention": "0.0.29",
"rc-form": "~0.17.1",
"rc-input-number": "~2.5.12",
"rc-menu": "~4.12.4",