-
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
Gallery: Reduce attribute storage requirements #1986
Comments
Previously: #1469 (comment) We should not store data in comment attributes for this block, it leads to ugly generated markup and invites the two data sources (comments, HTML) to get out of sync. |
It may be worth reviewing the attributes that are uses in the current gallery shortcode (docs). I agree that for images, we probably only need the attachment ids. |
Thanks for opening up this issue @aduth - so as of now the edit gallery modals require the sizes and thumbnails to be specified which as you point out leads to a bunch of extra data being stored. @joemcgill - we need core media to be updated to only need the data for attachment ids and it getting all of the appropriate thumbnails and data needed for edit. In my testing opening the modal did end up needing sizes, mime, type, and subtype or various parts didn't show. Should I open a ticket for this? |
After some discussion, the idea to address this issue is to not use the Media modals for editing a Gutenberg gallery only for adding images. The data is really only needed to reopen the modal with the images. So editing (remove, reorder) of the gallery will be done in the block itself and then the data will not be necessary to store within comment attributes. See #2128 and #2129 |
@mkaz Keeping editing in the inspector makes sense to me. We also have to keep in mind the flow for adding new images to an existing gallery. I still think we can get away with doing this by only passing IDs to the media library. I'll look into what might be needed from core's side later this week, but if you have any further details describing what barriers you ran into, that would be a big help. |
Fixed in #2294 |
Related: #1785 (comment)
Here's an example of markup generated from a gallery block with two images:
We should be more responsible about the amount of data we store, ideally the minimal necessary to display the content on the front-end and still be able to "make sense" of the block's structure in the editor.
For example, we may not need:
For most of these, an image ID should be sufficient.
cc @mkaz @mtias
The text was updated successfully, but these errors were encountered: