Draft-js-plugins: Custom entity for mentions

Created on 9 Jul 2016  路  4Comments  路  Source: draft-js-plugins/draft-js-plugins

Hello, first of all thanks for this great library!

I noticed that the entity used in the mentions plugin is actually hardcoded (https://github.com/draft-js-plugins/draft-js-plugins/blob/master/draft-js-mention-plugin/src/Mention/index.js#L11), it would be great if we could customize the entity that gets used

mentions-plugin question stale

Most helpful comment

@paglias Im doing this in my autocomplete plugin creator

Its a plugin-creator, meaning that it handles most of the boilerplate surrounding the connection to the draft-js-plugin system and just requires the SuggestionEntry Component, the modifier to update the editor when the user clicks/hits enter, and the strategy for opening the suggestions.

I'm currently working on improving the examples and adding some API documentation. Any input you have on what you'd like to see or ways to improve the autocomplete plugin creator would be great!

All 4 comments

Hey! Thanks for your nice words, I'm sure @nikgraf will appreciate :) I can see the advantages of such option but could you elaborate on your use case? It would help a lot to think about the best solution.

Now that I thought more about it probably the best solution would be to implement a general autocomplete plugin (as suggested in #78) that would allow devs to control what happens when an item is selected from the dropdown.

Some use cases I'm thinking about are:

  • Insertion of custom block components
  • Use of different elements other than a and span

So yeah what I'd like is a way to control / override the command sent to the editor

@paglias Im doing this in my autocomplete plugin creator

Its a plugin-creator, meaning that it handles most of the boilerplate surrounding the connection to the draft-js-plugin system and just requires the SuggestionEntry Component, the modifier to update the editor when the user clicks/hits enter, and the strategy for opening the suggestions.

I'm currently working on improving the examples and adding some API documentation. Any input you have on what you'd like to see or ways to improve the autocomplete plugin creator would be great!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

oleksandraab picture oleksandraab  路  3Comments

svnm picture svnm  路  3Comments

berdof picture berdof  路  5Comments

GaborLeskoFlach picture GaborLeskoFlach  路  3Comments

alexlatchford picture alexlatchford  路  3Comments