I'm trying to save editorState
to DB and show back to editor. For this thing, I followed this answer
Now, when I try to get current content and permanently save it using convertToRaw
, It works fine. But when I try to use this data and transform raw to contentState
using convertFromRaw
I get following error:
Uncaught TypeError: contentState.getBlockMap is not a function
Here is my code to convert editorState
from saved state:
{
const convertedState = convertFromRaw(JSON.parse(value))
const editorValue = EditorState.createWithContent(convertedState);
}
This way, it shows data in editor but when I type something to rich editor. It prompts :
Uncaught TypeError: contentState.getBlockMap is not a function
P.s. using draft-js: '0.10.5'