-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Images → Gallery transform fails for ID-less images #3698
Comments
An uploaded image has an ID? If the image is on a remote sever then this will not be possible without a CORS proxy. Image Block does something similar on cDM but would need to fetch the image instead (via CORS proxy). We could detect that the image is on a remote server and show an appropriate error? |
An image uploaded using the controls offered by both Image and Gallery blocks will, once pushed to the media library via
Perhaps, but long-term it'd be great to support external images in general—thus presumably ID-less—more gracefully for both Image and Gallery blocks. This wouldn't be an issue most of the time, as the canonical flow would still require images to be uploaded to the media library; one thing to improve is to allow uploading via URL, as seen in the classic editor's media modal: However, non-canonical flows like freeform-to-blocks conversion and clipboard-to-blocks conversions will still exist, and this is where we have to deal with external images.
Looping in @jasmussen and @mtias to ponder. |
Some thoughts:
|
My take is that we support pasting of unknown (HTML) content, which includes image handling. It's not the main flow, but I also wouldn't consider it a niche one. That said, I can't even start to quantify how common it is. :)
My point is more that we should be aware of this limitation. As we move forward, actual usage of Gutenberg should inform how to address it. Right now, I'm fine if we ignore it, or if we handle it in a basic way—cf. graceful degradation you described in 3). Perhaps I'd lean towards the latter, because there might be a future where the editor had better offline support, in which case background uploading might cause headaches (though I suppose in that situation you wouldn't see external images anyway) ¯_(ツ)_/¯ External images doesn't sound like the greatest showcase for offline abilities ¯_(ツ)_/¯, but 💯 for keeping an eye out for offline in general. |
I would love it if we could get rid of linking external images directly in the image block. It can still be allowed in a custom HTML block of course, if the user would really want that. There could even be a special explicit block for this. (Thinking "Embedded Image" as it works more or less like an embed.) We already don't allow it in galleries, so it would make sense to not allow it in the image block either? If we do detect an image without ID, we should upload it. I think auto uploading is particularly useful in the case of pasting or in some cases drag and drop. The user has no idea that, after paste, the image still links to the site they pasted from, or they have no idea what the difference is. I have seen people adding pictures from Facebook to their website as external images (by accident). It worked, so that's all they care about. But when the links at Facebook change, or the original is deleted, the image on the website will be gone as well. Maybe irreversibly so. I think it would therefore be good to always upload, unless the user knows what they are doing in a custom HTML block or similar. We will need to do this in some cases anyway. When pasting from Google Docs, we'll need to upload the pasted images from the Google CDN. We can't just leave them like that. |
Would be nice if the REST API supports uploading by URL pointing to a valid resource. At the moment there is |
Surprisingly, |
I'm moving this issue out of the Try Callout milestone, as blockers for that milestone are primarily concerned with behaviour when converting an existing classic post to blocks. The only way I've found to reproduce this when converting to blocks is to add the images in Classic, then remove the Figuring out a way to deal with that particular flow would be nice, but it isn't necessary for the Try Callout, particularly considering that the Classic Editor stops linking the image to it's media library entry when the class is removed, too. |
Based on @pento's comment about the only way to reproduce it, I think this can be closed. If a way to reproduce it that is more commonly found is known, please comment and let's reopen. |
Issue Overview
Steps to Reproduce (for bugs)
Expected Behavior
The selected images show up as a gallery block containing all of the original images.
Current Behavior
An empty gallery shows up.
Possible Solution
The conversion process in steps 1. a. / 1. b. results in image blocks which are missing the ID attribute:
The Gallery transform obviously needs these IDs, hence the failure.
Mutually compatible solutions include:
Screenshots / Video
Related Issues and/or PRs
Todos
The text was updated successfully, but these errors were encountered: