Editor breaks regularly on multiple block-deletion :: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
See original GitHub issueI’m running into a bug and I can’t seem to find a sound solution for it. I’m presently working on some sort of workaround as the project I’m working on is a little pressing. But this is a relatively large stumbling block as it’s being designed for non-technical users.
What is the current behavior? The editor will break, unpredictably, when handling deletions of multiple blocks at once. Again, unpredictably. I can’t seem to reproduce the problem reliably, but can usually cause it to occur when I make an effort to do so.
To be more specific about the case, the users will be pasting large amounts of text from inDesign (with formatting) into the editor. I set the editor to strip formatting, but it retains all hard breaks – which is a bit of a pain, but I’ve created another solution for that as well.
However when you couple a number of incidental hard breaks with the error above, it creates a great problem for users as the editor will fault out and I have no way yet of forcing a hard reset on only the encapsulating component.
I’m sure there are issues with my code, but it’s been a bit rushed.
I am either running into this error, or another that states cannot 'getLength' of undefined
. I’m assuming this is checking for cursor position inside of a block that has been removed?
The version in the picture is the implemented version which varies slightly, but not crucially. The general codebase is here: https://github.com/Robert-Fairley/draftjs-litho-editor And I’ve got a demo of it here: https://robert-fairley.github.io/draftjs-litho-editor/ You won’t get an error dialog in that version yet, but it will happily flood your console for you. 😛
It’s not really released, but figured I’d put it out there anyway.
What is the expected behavior? Ideally, no error thrown. Or if an error is thrown but the editor can persist in functioning or at least handle an isolated re-render or reset that doesn’t require reloading the entire page (it contains other fields that the user would lose if they had filled them out prior to the editor breaking.)
I can share the fully implemented version on a more private basis. I’m a little bound by the difficult navigation of large-company copyright/intellectual property issues.
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js? Current. Have only used the current version. Every browser. Only tested macOS so far.
Any help or insight is appreciated! I’d like to be able to package and release it in the end.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:7 (3 by maintainers)
Top GitHub Comments
See this solution. https://github.com/facebook/draft-js/issues/1320#issuecomment-476509968
Why is that fix not handling auto-scroll? Check this: https://github.com/samuelmeuli/mini-diary/issues/47