Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,20 @@ findMentions: (val) => {

**`placeholder: string`** placeholder for empty input.

**`onUpdateSuggestions: function`** This function will be called on the mention keyword change. You can use this property to fetch the list from the data source.

```js
<Editor
list={this.state.users}
onUpdateSuggestions={(keyword) => {
this.setState({
users: fetchUsers(keyword)
});
}}
...
/>
```

**`renderMentionList: function`** If you want to render totally different list. You can use this property to provide alternative mention list renderer. It will be called with certain properties to controll the functionality of list.

```js
Expand Down
8 changes: 7 additions & 1 deletion src/Editor/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ export class Editor extends React.Component {
onHideMentions: PropTypes.func,
editorStyles: PropTypes.object,
placeholder: PropTypes.string,
renderMentionList: PropTypes.func
renderMentionList: PropTypes.func,
onUpdateSuggestions: PropTypes.func
};

static defaultProps = {
onUpdateSuggestions: () => {}
};

constructor(props) {
Expand Down Expand Up @@ -135,6 +140,7 @@ export class Editor extends React.Component {
this.setState({
keyword: lastKeyword
});
this.props.onUpdateSuggestions(lastKeyword);
}

resetTextbox() {
Expand Down