ant-design/components/mention/demo/basic.md
RaoHai c5a043b4c8 Mention Improvement
+ add `getSuggestionContainer` callback function, which allow users modify the
 container element of suggestions dropdown.
 + the suggestions dropdown will mount on `document.body` defaultly, instead of
 on editor.
 + close #3588
2016-10-31 15:58:15 +08:00

620 B

order title
0
zh-CN en-US
基本使用 Basic

zh-CN

基本使用

en-US

Basic usage.

import { Mention } from 'antd';
const { toString, toEditorState } = Mention;

function onChange(editorState) {
  console.log(toString(editorState));
}

function onSelect(suggestion) {
  console.log('onSelect', suggestion);
}

ReactDOM.render(
  <Mention
    style={{ width: '100%', height: 100 }}
    onChange={onChange}
    defaultValue={toEditorState('@afc163')}
    suggestions={['afc163', 'benjycui', 'yiminghe', 'RaoHai', '中文', 'にほんご']}
    onSelect={onSelect}
  />
, mountNode);