sstur / react-rte

Pure React rich text WYSIWYG editor based on draft-js.
https://react-rte.org
ISC License
2.86k stars 431 forks source link

Save text and editor state separately? #421

Closed indefinitelee closed 2 years ago

indefinitelee commented 2 years ago

I'm looking to do something like save plain text as well as editor state in separate database fields and then combine them on the client to display the formatted text. This is because formatting is useful for users to see but it will also be an input to another system that cannot parse the markup.

Does this seem possible?

Is there a method to return the plain text content of the editor? Is there a way to save an editor state and then apply it to some text? -- I'm guessing something like in the demo https://github.com/sstur/react-rte/blob/master/src/EditorDemo.js#L138 But not sure how I would then use that to apply to the plain text

Thanks for the help.