Skip to content
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.

Error when deleting character before an entity on master branch #1093

Closed
flarnie opened this issue Mar 24, 2017 · 2 comments
Closed

Error when deleting character before an entity on master branch #1093

flarnie opened this issue Mar 24, 2017 · 2 comments
Assignees
Labels

Comments

@flarnie
Copy link
Contributor

flarnie commented Mar 24, 2017

Do you want to request a feature or report a bug?
This is a bug.

What is the current behavior?
If you put the cursor just before an entity and try to delete, an error is thrown:

Uncaught Error: There should only be one entity range within this removal range.
    at invariant (Draft.js:751)
    at getEntityRemovalRange (Draft.js:9847)
    at getCharacterRemovalRange (Draft.js:9821)
    at Object.removeRange (Draft.js:868)
    at removeTextWithStrategy (Draft.js:1997)
    at keyCommandPlainBackspace (Draft.js:10570)
    at onKeyCommand (Draft.js:9127)
    at editOnKeyDown (Draft.js:9218)
    at Draft.js:6239
    at Object.ReactErrorUtils.invokeGuardedCallback (react-dom.js:9017)
invariant @ Draft.js:751
getEntityRemovalRange @ Draft.js:9847
getCharacterRemovalRange @ Draft.js:9821
removeRange @ Draft.js:868
removeTextWithStrategy @ Draft.js:1997
keyCommandPlainBackspace @ Draft.js:10570
onKeyCommand @ Draft.js:9127
editOnKeyDown @ Draft.js:9218
(anonymous) @ Draft.js:6239
ReactErrorUtils.invokeGuardedCallback @ react-dom.js:9017
executeDispatch @ react-dom.js:3006
executeDispatchesInOrder @ react-dom.js:3029
executeDispatchesAndRelease @ react-dom.js:2431
executeDispatchesAndReleaseTopLevel @ react-dom.js:2442
forEachAccumulated @ react-dom.js:15423
processEventQueue @ react-dom.js:2645
runEventQueueInBatch @ react-dom.js:9041
handleTopLevel @ react-dom.js:9052
handleTopLevelImpl @ react-dom.js:9129
perform @ react-dom.js:14724
batchedUpdates @ react-dom.js:8805
batchedUpdates @ react-dom.js:12852
dispatchEvent @ react-dom.js:9204

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. You can use this jsfiddle to get started: https://jsfiddle.net/stopachka/m6z0xn4r/.

This can be reproduced on the master branch in the 'entity' example.

What is the expected behavior?
The character should delete as expected.

Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
This is just on the master branch because it was introduced by 413e63a

@flarnie flarnie added the bug label Mar 24, 2017
@flarnie flarnie self-assigned this Mar 24, 2017
flarnie added a commit to flarnie/draft-js that referenced this issue Mar 24, 2017
Fixes facebookarchive#1093

Credit goes 100% to @mmmoussa for finding and fixing this bug, I'm just
making the PR to update Github.
@flarnie
Copy link
Contributor Author

flarnie commented Mar 30, 2017

Going to re-test this but I think it should be fixed now.

@sophiebits
Copy link
Contributor

Verified 543831d fixed this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants