draft-js
draft-js copied to clipboard
Error when `formatPastedText` returns html with no text content
Do you want to request a feature or report a bug?
Bug.
What is the current behavior?
https://codesandbox.io/s/spring-framework-zp7hq?file=/src/App.js
- Copy "a" and paste it in the editor.
-
formatPastedText
removes "a" from html. -
insertFragmentIntoContentState.js:189 Uncaught TypeError: Cannot read property 'getLength' of undefined
at https://github.com/facebook/draft-js/blob/10ca1ad44843e970c4314f85a8f37d26f842ebf9/src/model/transaction/insertFragmentIntoContentState.js#L257
What is the expected behavior?
No error.
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
macOS v11.3.1 Chrome v90.0.4430.93 Draft v0.11.7
Hi @tu4mo ) I can not reproduce this bug in chrome from local project wich was created with create-react-app , it seems it is the bug with codesandbox
Hi @Quintis1212, thanks for taking the time to look in to this. Perhaps "crash" was a wrong word to describe the issue. I rephrased it. The error happens locally as well.
@tu4mo If you paste text in editor copied from https://www.lipsum.com/, it throws the same error. However, if you paste only text or only HTML this formatPastedText
works fine on my local system.