Currently, if "Insert from Media Library" button in CKEditor allows to upload one media entity at a time but user can select multiple entities.

Steps to test

1. Login as admin
2. Configure "Full HTML" text format editor to use "Insert from Media Library" button
3. Enable embedded Media, and configure plugin's default view mode to "Media Library"
4. Select multiple media types i.e. Image, Document etc. and save
5. Goto node/add/article page, and edit body field. Select text format as "Full HTML"
6. Click on the "Insert from Media Library", and upload couple of images. You will notice that you can only select one image at a time.
7. Switch to Document tab, and upload a document. Notice that the document is also selected.
8. Go back to image tab, and the earlier selected image is still selected and now you can select multiple images.
9. Press Insert button
10. Notice that the image which was selected first is inserted into editor.

Above can be reproduced with just Drupal core v9.x. Attached

Comments

gaurav.goyal created an issue. See original summary.

gaurav.goyal’s picture

Issue summary: View changes
codersukanta’s picture

StatusFileSize
new3.8 KB

The patch will allow users to select only one media.

codersukanta’s picture

Status: Active » Needs review
codersukanta’s picture

tripurari’s picture

Reviewing and will update the status shortly.

phenaproxima’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Thanks for the patch! This will need automated tests, I think, so we can confirm the bug is properly fixed. :)

tripurari’s picture

StatusFileSize
new345.25 KB
new133.87 KB
new350.93 KB
new184.39 KB
new312.58 KB
new169.44 KB

Manual testing wise Changes looks good to me . I agree with @phenaproxima

Thanks for the patch! This will need automated tests, I think, so we can confirm the bug is properly fixed. :)
phenaproxima’s picture

Status: Needs work » Closed (duplicate)

I'm closing this in favor of #3092536: Possible to select multiple images in a media field where only 1 value is accepted, which has more activity on it. I have transferred credit from this issue to that one.