Skip to content

Commit

Permalink
add onKeyDown prop
Browse files Browse the repository at this point in the history
  • Loading branch information
embbnux committed Jul 24, 2018
1 parent b4cc343 commit 4dc44fb
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 @@ -153,6 +159,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 4dc44fb

Please sign in to comment.