-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use new Entity API #82
Conversation
…sion process, and pass down a function to textToEntity and htmlToEntity to allow those passed methods to create an entity using that contentState.createEntity
Thanks for trying to get draft-js 0.10 working! What is the current status of this PR? |
This looks good to me. I'll try migrating to this branch next week and report back how it worked out. |
Finally had time to try this out. These changes work very well with my entities. 👍 |
Good job ! Could someone merge this ? |
sorry for the wait, published in For posterity, I ended up switching to the alternative mentioned in the original PR - |
Thanks ! |
@benbriggs thank you, Ban, for making the draft-convert fresh and reliable |
thanks! |
Fixes #38
First real pass at getting this working without using
Entity.create
. Essentially an emptyContentState
is created before conversion begins, and a function is passed down to be called on the result oftextToEntity
orhtmlToEntity
to create an entity on that contentState. Those*ToEntity
methods now return an object of shape{type, mutability, data}
.An alternative that I thought of while writing this was to instead pass that function as an additional argument to the
*ToEntity
functions themselves so that they can return with the string result of anEntity.create
-like function like before. This would also make it easier for users to track down issues if there were an exception when creating the entity since it would be called from their own code at some point.