leavesForLeafSet.first().get('start') returns an incorrect start position for some emoji characters
See original GitHub issueIn DraftEditorBlock.react.js (L190), certain strings cause leavesForLeafSet.first().get('start')
to incorrectly report the start position of the string.
For example, entering any of the emoji digits from 0-7 (0️⃣ - 7️⃣) causes leavesForLeafSet.first().get('start')
to incorrectly return the start position as 1, rather than 0. Oddly, entering either 8️⃣ or 9️⃣ works as expected and the start position is correctly returned as 0.
This doesn’t appear to have any negative effect on a basic <Editor />
, however it becomes an issue when using the emoji plugin as the decoratedText
prop that draft-js passes through to it ends up being an emoji modifier character (⃣).
You can see this in action by trying to enter any of the 0️⃣ - 7️⃣ emoji into the first demo (Simple Emoji Example) on the emoji-plugin docs site. (Related issue in draft-js-plugins repo).
Fixing the inconsistencies with leavesForLeafSet.first().get('start')
so that it consistently returns the correct start position of all numeric emoji characters would resolve this issue.
Tested with v0.10.5 of draft-js on MacOS 10.13.1
Issue Analytics
- State:
- Created 6 years ago
- Reactions:6
- Comments:7
Top GitHub Comments
Any update?
Any progress here?