Created
August 10, 2020 21:24
-
-
Save rockchalkwushock/1a5b78438c0f0829e14c4a8ba3794cc7 to your computer and use it in GitHub Desktop.
DraftJS gotcha
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
"//": "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