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 case #72

Closed
MalikRumi opened this issue Aug 20, 2017 · 3 comments
Closed

use case #72

MalikRumi opened this issue Aug 20, 2017 · 3 comments
Labels
question Further information is requested

Comments

@MalikRumi
Copy link

Forgive my naivete, but why is this package needed? What is its purpose / use case for Python devs? I just found out about draft.js, and don't know a lot about javascript. Thanks.

@loicteixeira
Copy link
Contributor

Hi @MalikRumi,

TL;DR;
If you use Draft.js in the admin of your website to create content, you'll need this package to render that content to HTML if your back-end application is written in Python.

Longer version:
Draft.js is a rich text editor framework for React. It differs from other rich text editors like Hallo.js or TinyMCE (at least as far as we're concerned here) because it does not save data as HTML but rather as JSON.

Now this is a problem if you want to render on the front-end what you see in the editor. Before you had HTML so you could display it directly but now you have JSON and it needs to be transformed. This is exactly what this project does. It will convert the JSON output of Draft.js (called the ContentState) to HTML.

To give you a bigger picture, you could look at our other project WagtailDraftail which integrates Draft.js into the admin interface of Wagtail on one side and uses draftjs_exporter to then render it.

@loicteixeira loicteixeira added the question Further information is requested label Aug 21, 2017
@thibaudcolas
Copy link
Collaborator

thibaudcolas commented Aug 28, 2017

Hey @MalikRumi, I'll close this as I think @loicteixeira covers the "why", and I've added some notes in the README to formalise this.

Feel free to continue the conversation further here if you need more details or think we could communicate the use case better.


If other people stumble upon this issue, we would be really interested to hear what they use this for or as part of which project!

The pypi infrastructure doesn't offer any statistics at the moment, but back when it did this project had about 50-100 downloads / week so I'm sure there is someone out there finding it useful for other purposes than our own 🙂 .

Output from vanity for reference:

$ vanity draftjs_exporter
draftjs_exporter-0.1.0.tar.gz    2016-07-04          198
draftjs_exporter-0.2.0.tar.gz    2016-07-05          174
draftjs_exporter-0.3.0.tar.gz    2016-07-20          116
draftjs_exporter-0.3.1.tar.gz    2016-07-20          126
draftjs_exporter-0.3.2.tar.gz    2016-07-25          482
draftjs_exporter-0.3.3.tar.gz    2016-10-06          182
draftjs_exporter-0.4.0.tar.gz    2016-10-17          117
draftjs_exporter-0.5.0.tar.gz    2016-11-17           58
draftjs_exporter-0.5.1.tar.gz    2016-11-17          102
draftjs_exporter-0.5.2.tar.gz    2016-12-09           58
draftjs_exporter-0.6.0.tar.gz    2016-12-19           56
draftjs_exporter-0.6.1.tar.gz    2016-12-21           78
draftjs_exporter-0.6.2.tar.gz    2017-01-18           30
draftjs_exporter-0.7.0.tar.gz    2017-02-16           13
draftjs_exporter-0.8.0.tar.gz    2017-04-03           21
draftjs_exporter-0.8.1.tar.gz    2017-04-06          191
draftjs_exporter-0.9.0.tar.gz    2017-04-25            0
draftjs_exporter-1.0.0.tar.gz    2017-04-25            0
--------------------------------------------------------
draftjs_exporter has been downloaded 2,002 times!


	 *** Note: PyPI stats are broken again; we're now waiting for warehouse. https://github.com/aclark4life/vanity/issues/22 ***

@williamboman
Copy link

williamboman commented Nov 26, 2017

Just sharing our use case:

We allow users to write comments on articles using a rich text draft-js editor. We run Python in the back and in order for us to embed comments in notification emails that we send out we need to transform draft-js content state JSON structures stored in our database to HTML, which this package does wonderfully.

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

No branches or pull requests

4 participants