I\'m trying to persist draft-js
\'s EditorContent
to database then read and recreate the EditorContent object again.
But EditorContent.getPla
I've found that I must stringify
and parse
the RawContentState object when reading and saving to the database.
import { convertFromRaw, convertToRaw } from 'draft-js';
// the raw state, stringified
const rawDraftContentState = JSON.stringify( convertToRaw(this.state.editorState.getCurrentContent()) );
// convert the raw state back to a useable ContentState object
const contentState = convertFromRaw( JSON.parse( rawDraftContentState) );