[Webkit-unassigned] [Bug 229377] New: Can't read images via Clipboard API

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Sat Aug 21 17:05:15 PDT 2021


https://bugs.webkit.org/show_bug.cgi?id=229377

            Bug ID: 229377
           Summary: Can't read images via Clipboard API
           Product: WebKit
           Version: Safari 14
          Hardware: All
                OS: All
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: New Bugs
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: nchase at gmail.com

Created attachment 436098

  --> https://bugs.webkit.org/attachment.cgi?id=436098&action=review

Correct number of ClipboardItems, but no usable data.

When I use the Clipboard API to grab items that a user pastes into a text input, I see ClipboardItems, but they're always empty  (i.e. no `types`, no `presentationStyle`). 


I'm interested in taking the blob data that represents the file and uploading it to a server for the user as an attachment, after they use the Safari-provided paste option from the edit menu.

For example, if I paste two images this way, they appear as follows when I console.log them – see attachment (note that there are no `types`, and it seems there's no way to get at the file blobs).


Here's a minimal example that will reproduce the issue:

```
<input type="text" id="textInput" placeholder="paste clipboard contents here" style="width: 100%" />

<script>
  document.getElementById("textInput").addEventListener('click', (event) => {
    navigator.clipboard.read().then((data) => {
      console.log(data)
    })

    event.preventDefault()
  })
</script>
```

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20210822/9ea2ea4e/attachment.htm>


More information about the webkit-unassigned mailing list