Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

img with span problem #63

Open
Frank1e0927 opened this issue Jan 4, 2019 · 4 comments
Open

img with span problem #63

Frank1e0927 opened this issue Jan 4, 2019 · 4 comments

Comments

@Frank1e0927
Copy link

Frank1e0927 commented Jan 4, 2019

   const blocksFromHtml = htmlToDraft(this.props.value);
    const { contentBlocks, entityMap } = blocksFromHtml;
    const contentState = ContentState.createFromBlockArray(contentBlocks, entityMap);
    const editorState = EditorState.createWithContent(contentState);
    this.state = {
      editorState,
      loading: false
    };
<Editor editorState={this.state.editorState} defaultEditorState={this.state.editorState}/>

here props value just is img tag with src

it will throw an error Unknown DraftEntity key: null.

why ????

and if i pass

<p></p>
<img src="..."/>

it will work

and if i pass

<p></p>
<img src="..."/>
<span>it will invisible or miss in editor<span>

// or

<p></p>
<img src="..."/>it will invisible or miss in editor

it will invisible all the element after img tag

Hope to get the answer

@jpuri
Copy link
Owner

jpuri commented Jan 4, 2019

Hey @Frank1e0927 , there is a limitation - currently the library best works with only html produced by https://github.com/jpuri/react-draft-wysiwyg it can not take care of any arbitrary html.

Is this HTML generated by above wysiwyg ?

@Frank1e0927
Copy link
Author

Hey @Frank1e0927 , there is a limitation - currently the library best works with only html produced by https://github.com/jpuri/react-draft-wysiwyg it can not take care of any arbitrary html.

Is this HTML generated by above wysiwyg ?

yes, i used react-draft-wysiwyg

@jpuri
Copy link
Owner

jpuri commented Jan 12, 2019

But AFAIK lib does not produce span like this. Can you plz details the step to reproduce this.

@ElliotZhang
Copy link

We have this issue because we try to migrate our UI to use this component but some pre-exisiting HTML data just break.

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

No branches or pull requests

3 participants