Review main Merged

96259[FEATURE] Paste files into the Media module to upload

Oli Bartsch CR +2 V +2 Normal +82 −2 updated 10/02/26, 07:59

Commit message

Files copied to the clipboard, either in the file manager of the
operating system or as image data, can now be pasted into the Media
module to upload them to the current folder. They run through the same
upload as dropped files, including the dialog for files that already
exist.

The paste handler of the drag uploader is enabled by a data attribute,
so only the Media module uses it. File fields in FormEngine render
several uploaders on one page and keep their behaviour. Pasting into a
form field is left to the field.

Review

  • Code review CR +2 Done
    • Oli Bartsch +2
    • Georg Ringer +1
    • Josua Vogel +1
  • Verified V +2 Done
    • Oli Bartsch +2
    • Georg Ringer +1
    • Josua Vogel +1
    • core-ci +1 CI

Issues 1

Files 6

Review log 910

  1. Oli Bartsch uploaded patch set 1 10/01/26, 12:55

  2. core-ci voted on patch set 1 V +1 10/01/26, 13:05 Core CI is happy: https://git.typo3.org/typo3/CI/cms/-/pipelines/109793

  3. Georg Ringer commented on patch set 1 10/01/26, 21:09

    it works great but small nitpick: it only works if I click one time into the content module. if I only select a folder in the foldertree and press ctrl+v, nothing happens
  4. Oli Bartsch commented on patch set 1 10/01/26, 21:45

    Reply

    Hey, thanks for testing! This is expected. The browser sends the paste event to the document that has focus, and after clicking a node in the folder tree, focus is in the tree, outside the content area where the uploader listens. I deliberately didn't forward pastes from the tree. Keyboard focus in the tree doesn't have to be on the folder that's displayed. Arrow keys move focus, only Enter/Space opens the folder. If a paste in the tree uploaded into the displayed folder, a keyboard user focused on folder B could end up with files in folder A without noticing. Moving focus into the content area after selecting a folder isn't an option either, because it breaks keyboard navigation of the tree. The clean solution would be pasting onto a tree node to upload into that folder, like a drop target. The tree doesn't accept files from the OS at all yet, so that's a separate feature. We could do this as a follow-up if you think it's worth it. For this patch I'd keep it as is. Paste goes where the focus is.
  5. Simon Schaufelberger commented on patch set 1 10/02/26, 00:35

    I personally need this feature much more in the overlay when inserting an image into a content element. Drag&drop doesn't work there yet but both would be awesome!
  6. Georg Ringer voted on patch set 1 CR +1 V +1 10/02/26, 06:00

  7. Oli Bartsch commented on patch set 1 10/02/26, 06:29

    Reply

    In FormEngine a record can have several file fields, each with its own uploader, so a paste needs a clear target. That's why this patch only enables it in the Media module. A follow-up could route the paste to the file field that currently has focus (e.g. after clicking "Select & upload files" or into its dropzone), and do nothing otherwise. The upload itself would run through the existing uploader of that field, including allowed extensions and the duplicate handling. I'll create a separate issue for that, as it changes FormEngine behaviour and deserves its own tests.
  8. Josua Vogel voted on patch set 1 CR +1 V +1 10/02/26, 07:43

  9. Oli Bartsch voted on patch set 1 CR +2 V +2 10/02/26, 07:59

  10. Oli Bartsch merged patch set 2 10/02/26, 07:59