You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior? convertFromHTML returns zero contentBlocks for an empty string or an empty tag like <p></p> or <em></em>. When I use that result to create a ContentState with ContentState.createFromBlockArray(), the ContentState can't be used in ContentState.hasText().
**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
convert empty tag like e.g. convertFromHTML('')
use the result in ContentState.createFromBlockArray()
Try to use that content state in content.hasText()
What is the expected behavior?
contentState.hasText() returns false
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
I've only tested with 0.11.13 in Chrome on Windows 10 but I'm assuming this affects all browsers.
This was reported in issue #2226. The createWithContent function was protected from this error but hasText still gives errors for me.
The text was updated successfully, but these errors were encountered:
I think Draft assumes that you will have at least one block in your blockMap. Since your block array is an empty array, when it runs getLength() on the first block (which is undefined) it throws an error.
I think Draft assumes that you will have at least one block in your blockMap. Since your block array is an empty array, when it runs getLength() on the first block (which is undefined) it throws an error.
Do you think that Is the desired behavior? createWithContent was modified so that an error isn't thrown for an empty array so I feel that hasText() would be similarly protected.
Probably. The blank editor on draftjs.org starts with one ContentBlock. If you want to make a blank ContentState, you could always use ContentState.createFromText("").
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
convertFromHTML
returns zero contentBlocks for an empty string or an empty tag like<p></p>
or<em></em>
. When I use that result to create a ContentState withContentState.createFromBlockArray()
, the ContentState can't be used inContentState.hasText()
.**If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem.
https://jsfiddle.net/rzrshrp/wpLz9st3/21/
What is the expected behavior?
contentState.hasText() returns false
Which versions of Draft.js, and which browser / OS are affected by this issue? Did this work in previous versions of Draft.js?
I've only tested with 0.11.13 in Chrome on Windows 10 but I'm assuming this affects all browsers.
This was reported in issue #2226. The createWithContent function was protected from this error but hasText still gives errors for me.
The text was updated successfully, but these errors were encountered: