Cannot render stickers from raw content state
See original GitHub issueHowdy,
First, thank you all for the great work on these set of plugins. They’re really helping to reduce my pain points with draft-js.
Second, I’m running into a problem where ContentStates that are “convertFromRaw” and stored as JS strings, can’t render their stickers. Instead, any sticker blockType throws an ‘Invariant’ exception and does not show up in the editor.
I am using draft-js-plugins-v2.0.0@beta5, draft-js-0.9.1, and React@15.3.2.
All stickers run into this problem, while other block types, like text, render perfectly fine.
I have attached screenshots of the debug output, particularly the line where it fails:
The getEntityAt(0) returns a null
that is passed into Entity.get, causing the error shown below.
And this is JSON of a sample ContentState being loaded, which throws the ‘Invariant’ exceptions:
{
"entityMap": {
"0": {
"type": "sticker",
"mutability": "IMMUTABLE",
"data": {
"id": "/static/media/images.97b53447.jpeg"
}
},
"1": {
"type": "sticker",
"mutability": "IMMUTABLE",
"data": {
"id": "/static/media/plague.2d0a9da3.gif"
}
}
},
"blocks": [{
"key": "7m54a",
"text": "",
"type": "sticker",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [{
"offset": 0,
"length": 0,
"key": 0
}],
"data": {}
}, {
"key": "fa7d4",
"text": "",
"type": "sticker",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [{
"offset": 0,
"length": 0,
"key": 1
}],
"data": {}
}, {
"key": "f6o38",
"text": "",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
}]
}
Would anyone have an idea of what I’m doing wrong here?
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
@timschambers sure, if there is a bug of plugin, we are PR welcome… but still feel somehow in your code base you have multiple copies of ‘draft-js’
Let me know if this issue still occurs …