Skip to content

Commit

Permalink
feat(entry): add entryComponent as a mention plugin option to enable …
Browse files Browse the repository at this point in the history
…customization (draft-js-plugins#1491)
  • Loading branch information
sibelius authored Sep 11, 2020
1 parent efaffd0 commit 9d9ead9
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions draft-js-mention-plugin/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- onOpen and onClose callbacks are removed in favour of onOpenChange
- Made suggestions prop required (pass empty array for async suggestions)
- Remove prevState and state from positionSuggestions
- add entryComponent to mention plugin

## 3.1.5

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import Avatar from './Avatar/Avatar';

const defaultEntryComponent = props => {
const DefaultEntryComponent = props => {
const {
mention,
theme,
Expand All @@ -18,4 +18,4 @@ const defaultEntryComponent = props => {
);
};

export default defaultEntryComponent;
export default DefaultEntryComponent;
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Entry from './Entry/Entry';
import addMention from '../modifiers/addMention';
import decodeOffsetKey from '../utils/decodeOffsetKey';
import getSearchText from '../utils/getSearchText';
import defaultEntryComponent from './Entry/defaultEntryComponent';
import defaultEntryComponent from './Entry/DefaultEntryComponent';

export class MentionSuggestions extends Component {
static propTypes = {
Expand Down
2 changes: 2 additions & 0 deletions draft-js-mention-plugin/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export default (config = {}) => {
mentionTrigger = '@',
mentionRegExp = defaultRegExp,
supportWhitespace = false,
entryComponent,
} = config;
const mentionSearchProps = {
ariaProps,
Expand All @@ -97,6 +98,7 @@ export default (config = {}) => {
positionSuggestions,
mentionTrigger,
mentionPrefix,
entryComponent,
};
const DecoratedMentionSuggestionsComponent = props => (
<MentionSuggestionsComponent {...props} {...mentionSearchProps} />
Expand Down

0 comments on commit 9d9ead9

Please sign in to comment.