Skip to content
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

Merged
merged 7 commits into from
Sep 12, 2017
Merged

use new Entity API #82

merged 7 commits into from
Sep 12, 2017

Conversation

benbriggs
Copy link
Contributor

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 of textToEntity or htmlToEntity 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 an Entity.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.

Ben Briggs added 3 commits July 13, 2017 18:06
…sion process, and pass down a function to textToEntity and htmlToEntity to allow those passed methods to create an entity using that contentState.createEntity
@neurosnap
Copy link

Thanks for trying to get draft-js 0.10 working! What is the current status of this PR?

@0rvar
Copy link
Contributor

0rvar commented Aug 19, 2017

This looks good to me. I'll try migrating to this branch next week and report back how it worked out.

@0rvar
Copy link
Contributor

0rvar commented Sep 6, 2017

Finally had time to try this out. These changes work very well with my entities. 👍

@benbriggs benbriggs changed the title [wip] use new Entity API use new Entity API Sep 12, 2017
@cedricmessiant
Copy link

Good job ! Could someone merge this ?

@benbriggs benbriggs merged commit 1a87c21 into master Sep 12, 2017
@benbriggs benbriggs deleted the new-entity-api branch September 12, 2017 20:24
@benbriggs
Copy link
Contributor Author

benbriggs commented Sep 12, 2017

sorry for the wait, published in draft-convert@2.0.0!

For posterity, I ended up switching to the alternative mentioned in the original PR - textToEntity and htmlToEntity now receive functions as arguments to create/get/manipulate entities. The docs have been updated with the new arguments.

@cedricmessiant
Copy link

Thanks !

@optimatex
Copy link

@benbriggs thank you, Ban, for making the draft-convert fresh and reliable

@KyoungWan
Copy link

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants