jpuri / draftjs-to-html

Library for converting Draftjs editor content state to HTML
MIT License
321 stars 143 forks source link

Readme Usage is not clear #4

Closed heaplabs closed 7 years ago

heaplabs commented 7 years ago

The example usage on the Readme file is as follows:

` import draftToHtml from 'draftjs-to-html';

const rawContentState = convertToRaw(editorState.getCurrentContent()); const markup = draftToHtml(contentState, directional, customEntityTransform); `

Its not clear what the arguments contentState, directional, and customEntityTransform should be ? And how is the rawContentState supposed to be used to get the markup ?

Thank you, Akhilesh

jpuri commented 7 years ago

Thanks for feedback @heaplabs, I will improve it soon. For now you can refer this: https://github.com/jpuri/react-draft-wysiwyg/blob/master/docs/src/components/Demo/index.js#L66

jpuri commented 7 years ago

@heaplabs: I have added more details to readme today. Plz share ur feedbacks. PR also welcome 😄

lumio commented 7 years ago

Additional to that: What is convertToRaw or for what is it needed, since rawContentState is never used?

//edit: Okay my bad... that function comes from draft-js itself. 😃 I might send you a PR that mentions that.

Thanks for you work!

jpuri commented 7 years ago

I add some more clarity to readme, hope it helps.