Skip to content

Free photo library: Allow uploading multiple images into Gallery #1863

@pinarol

Description

@pinarol

Choose from the free photo library
Gallery block should allow uploading images from the free photo library.

Note: ❌ On iOS, I observed that only the first image is added to the gallery block, with the rest appended as image blocks.

Steps:

Add a gallery block and tap "Add Media"
Select "Choose from the free photo library" option
Select multiple images from the device and confirm the selection
Expected behavior:

Gallery should show all images being uploaded as dimmed
Progress bars should be displayed indicating the upload progress
After each image upload has completed:
Image should not be dim
Image url scheme should be https:// (not file:///) in HTML mode

Root cause analysis

Refer here

We are actually passing "multipleSelection" but it is ignored intentionally since the desired behavior is to let user select multiple pics.

What we need to do differently for Gallery is, using that flag for to decide to go for "insertOnBlock" option:

// Append the first item via callback given by Gutenberg.
if let firstItem = assets.first {
    insertOnBlock(with: firstItem)
}
// Append the rest of images via `.appendMedia` event.
// Ideally we would send all picked images via the given callback, but that seems to not be possible yet.
appendOnNewBlocks(assets: assets.dropFirst())

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions