Skip to content

Instantly share code, notes, and snippets.

@rockchalkwushock
Created August 10, 2020 21:24
Show Gist options
  • Save rockchalkwushock/1a5b78438c0f0829e14c4a8ba3794cc7 to your computer and use it in GitHub Desktop.
Save rockchalkwushock/1a5b78438c0f0829e14c4a8ba3794cc7 to your computer and use it in GitHub Desktop.
DraftJS gotcha
[
"//": "DraftJS will return a single object with this signature.",
"//": "If it has not text that property will be empty and that is what 'hasText()' is checking.",
"//": "The immutable data struct still exists though, so we need to blow it away using 'Draft.EditorState.createEmpty()'."
{
"blocks": [
{
"key": "djgpq",
"text": "",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
}
],
"entityMap": {}
},
{
"blocks": [
{
"key": "djgpq",
"text": "hello",
"type": "unstyled",
"depth": 0,
"inlineStyleRanges": [],
"entityRanges": [],
"data": {}
}
],
"entityMap": {}
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment