michelson / dante2

A complete rewrite of dante editor in draft-js
https://michelson.github.io/dante2/
Other
912 stars 121 forks source link

content prop not rendering content. #208

Closed HugoSanchez closed 4 years ago

HugoSanchez commented 4 years ago

Hey Michelson,

I'm trying to have Dante 2 editor display some content (in the right format: {blocks: Array, entityMap: {}}) like so:

<DanteEditor content={this.state.content} read_only={false} config={this.options} data_storage={this.storage} default_wrappers={this.wrappers}/>

But nothing is being displayed. Any clues on what I might be missing?

Thank you! Hugo

mbm-michal commented 4 years ago

@HugoSanchez you need to pass valid draftjs object. For example if you have your content saved as markdown you can format it to draftjs by using this module: https://www.npmjs.com/package/markdown-draft-js

HugoSanchez commented 4 years ago

Michelson,

Apparently the problem was with the component life-cycle and not with the format. It's is now solved.

Thank you!

anup-a commented 4 years ago

@HugoSanchez I'm facing similar problem could elaborate how you fixed it?

HugoSanchez commented 4 years ago

Hey @anup-a sorry for the late reply. This is from long ago so I don't remember very well. I'd say though that the issue was that I'm passing the state right into DanteEditor (see above) and that caused problems.

I'm not sure if that's very helpful though, sorry!

anup-a commented 4 years ago

@HugoSanchez thanks I figured that out.