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

Bug: LinkNode.importDOM doesn't support image content #4533

Closed
roeycohen opened this issue May 23, 2023 · 4 comments · Fixed by #5010
Closed

Bug: LinkNode.importDOM doesn't support image content #4533

roeycohen opened this issue May 23, 2023 · 4 comments · Fixed by #5010
Labels
good first issue Good for newcomers hyperlinks Relates to Lexical Links

Comments

@roeycohen
Copy link

roeycohen commented May 23, 2023

loading the following HTML:
<a href="https://facebook.com"><img src="https://server/img.jpg"/></a>
drops the A element.

this happens because of this:

if (content !== null && content !== '') {

Lexical version: 0.10

if I may suggest the fix could look like this:
if ((content !== null && content !== '') || domNode.querySelector('img') !== null)

@acywatson
Copy link
Contributor

Thanks for reporting this - fix looks ok, but actually I think we should probably handle other node content as well. Maybe it would be more like domNode.children.length > 0 as an additional condition.

@acywatson acywatson added hyperlinks Relates to Lexical Links good first issue Good for newcomers labels May 25, 2023
@roeycohen
Copy link
Author

it's a possibility... although other children might be none clickable nodes such as <iframe/> or

@utkarsh-shrivastav77
Copy link

Hi is this issue still open

@roeycohen
Copy link
Author

seems like @utkarsh-shrivastav77

hi @acywatson, would you like me to create PR for the fix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers hyperlinks Relates to Lexical Links
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants