3

I'm developing a react app, using redux and electron. As I was programming an editor with INLINETEX support along with draft.js and the draft-js-mathjax-plugin, the necessity of saving my editor state showed up. So I'm converting the ContentState to Raw in order to save that state to a database:

const testContent = convertToRaw(this.state.editorState.getCurrentContent())

And posteriorly converting it again to a ContentState:

const testState = EditorState.createWithContent(convertFromRaw(testContent))

With the convertToRaw and convertFromRaw methods, the inline style is lost, and only blocks of TeX can be created. That doesn't happen if no conversion is made. Any idea why this is happening?

1 Answers1

0

This commonly occurs when you haven't set a onChange function to the component where you're trying to view the DraftJS. Try adding an onChange function to your Viewing component too. Once you're done with that, you'd also find that the mathjax plugin does not respect the readonly tag, at which point you'll have to do a workaround using CSS.

gigin26
  • 533
  • 1
  • 5
  • 16