Skip to content

Commit

Permalink
Merge pull request #33 from embbnux/add-key-down-event
Browse files Browse the repository at this point in the history
add onKeyDown prop
  • Loading branch information
afc163 committed May 20, 2019
2 parents e61308d + 4dc44fb commit 9fd1783
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/component/Mention.react.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ class Mention extends React.Component {
onFocus: PropTypes.func,
onBlur: PropTypes.func,
onSelect: PropTypes.func,
onKeyDown: PropTypes.func,
getSuggestionContainer: PropTypes.func,
noRedup: PropTypes.bool,
mentionStyle: PropTypes.object,
Expand Down Expand Up @@ -110,6 +111,11 @@ class Mention extends React.Component {
this.props.onBlur(e);
}
}
onKeyDown = (e) => {
if (this.props.onKeyDown) {
this.props.onKeyDown(e);
}
}
getPrefix(props = this.props) {
return Array.isArray(props.prefix) ? props.prefix : [props.prefix];
}
Expand Down Expand Up @@ -154,6 +160,7 @@ class Mention extends React.Component {
placeholder={placeholder}
onFocus={this.onFocus}
onBlur={this.onBlur}
onKeyDown={this.onKeyDown}
onChange={this.onEditorChange}
{...editorProps}
readOnly={readOnly || disabled}
Expand Down

0 comments on commit 9fd1783

Please sign in to comment.