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

Media File link configuration option does not work for external images #21518

Closed
tharglet opened this issue Apr 9, 2020 · 2 comments · Fixed by #22195
Closed

Media File link configuration option does not work for external images #21518

tharglet opened this issue Apr 9, 2020 · 2 comments · Fixed by #22195
Assignees
Labels
[Block] Image Affects the Image Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended

Comments

@tharglet
Copy link

tharglet commented Apr 9, 2020

Describe the bug
When I add a external image in an image block, the "Media File" button does not work when trying to make it into a link

To reproduce
Steps to reproduce the behavior:

  1. Create a new post in Wordpress 5.4
  2. Insert an image block
  3. Click "Insert from URL"
  4. Insert a valid URL for an image (e.g. one on Imgur)
  5. Click the "Insert link" button
  6. Click "Media File"

Expected behavior
The image becomes a link to the media file inserted in step 4. Instead, nothing happens

Desktop (please complete the following information):

  • OS: Windwos 10
  • Browser Chrome
  • Version 80.0.3987.163

Additional context

  • Please add the version of Gutenberg you are using in the description.
    Unsure of how to find this. Using WP5.4 with no editor plugins.

Images inserted from upload or the galleryDescribe the bug
When I add a external image in an image block, the "Media File" button does not work when trying to make it into a link

To reproduce
Steps to reproduce the behavior:

  1. Create a new post in Wordpress 5.4
  2. Insert an image block
  3. Click "Insert from URL"
  4. Insert a valid URL for an image (e.g. one on Imgur)
  5. Click the "Insert link" button
  6. Click "Media File"

Expected behavior
The image becomes a link to the media file inserted in step 4. Instead, nothing happens

Desktop (please complete the following information):

  • OS: Windwos 10
  • Browser Chrome
  • Version 80.0.3987.163

Additional context

  • Please add the version of Gutenberg you are using in the description.
    Unsure of how to find this. Using WP5.4 with no editor plugins.

The Media File button works correctly with images inserted from the gallery or as an upload.

@johngodley
Copy link
Contributor

Confirmed that trying to set the link on an externally hosted image to either 'media page' or 'attachment page' doesn't set the link or close the popup. Tested in master.

image

The problem seems to be caused by this code:

https://github.com/WordPress/gutenberg/blob/master/packages/block-library/src/image/edit.js#L376

The URL for externally hosted images is stored in url, not href.

Additionally I don't think it makes sense to have the attachment page as an option.

@johngodley johngodley added [Block] Image Affects the Image Block [Type] Bug An existing feature does not function as intended labels Apr 15, 2020
@kirilzh kirilzh self-assigned this May 5, 2020
@kirilzh
Copy link
Contributor

kirilzh commented May 7, 2020

I see that this bug only exists when adding an image from URL. Uploading a local file works as expected.

Edit: The problem is that props.image in packages/block-library/src/image/edit.js is null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Image Affects the Image Block [Status] In Progress Tracking issues with work in progress [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants