Browser `paste` event with multiple files selection

245 views Asked by At

I'm having trouble with handling paste to browser, with multiple images clipboard. I'm using the following snippet:

document.addEventListener('paste', event => {
  console.log(event.items)
})

It works if a single file was selected, showing 3 items, with the types of text/plain, text/html and image/png. However, if two or more files were selected then clipboardData only contains items with the type text/plain and text/html, as if a text was copied.

I also checked the event.files, for single file event.files contains that one file, however for multiple files the list was empty.

Last but not least, I also checked the newer API - navigator.clipboard.read(). It shows the correct number of items (same number with the files I copied), however I was not be able to extract the files from those items.

Any help?

0

There are 0 answers