I'm trying to implement file pasting in the browser using the following code
document.onpaste = function (event) {
for (var item of event.clipboardData.items) {
if (item.kind == 'file')
process(item.getAsFile());
}
};
But I didn't get the file I pasted. Logging the DataTransferItem
object item
I noticed that its kind
is not file
but always string
and it's a list of the copied files' names. Is there a problem in my code or this issue is related to my platform ?
I am working with Firefox 104.0, Ubuntu 22.04 and Wayland