HubSpot / draft-convert

Extensibly serialize & deserialize Draft.js ContentState with HTML.
Apache License 2.0
484 stars 94 forks source link

Decorators #158

Open timothyarmes opened 4 years ago

timothyarmes commented 4 years ago

Is there a way to convert draftjs decorators to HTML? For example, this tweet decorator example from draftjs : https://github.com/facebook/draft-js/blob/master/examples/draft-0-10-0/tweet/tweet.html

Currently when I try to convert my content to HTML, I see my strategy is called, but my component is never rendered in the output.

benbriggs commented 4 years ago

There is not - decorators that aren't paired with an entity like in that example are usually meant for transient, editor-only UI and are independent of ContentState altogether. I'd recommend finding a way to persist the ranges you're hoping to add a component around using an entity range that will be represented in the ContentState.