-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Read Blob data for the supported formats on-demand during getType. #191
Comments
Seems reasonable to me, but I'd like to hear from other implementers, especially re: their approach to stale data. |
Bot posted the resolution in an unrelated issue. Posting the relevant discussion here: w3c/edit-context#26 (comment)
|
A couple thoughts
|
No, it returns data in only one or zero formats. The one format is the first one in the list that was present on the clipboard. If the clipboard does not contain any of the provided formats, no data is returned. Neither the Excel nor Sheets example is very motivating because the paste options are presented before the paste event has actually happened, which means that they would need the clipboard permission if they work the way you're presenting (i.e. by figuring out what types are actually available at the time of right click). Sites like Excel and Sheets should not need the clipboard permission to function. I just tested out Google Sheets and discovered that "paste special" has 5+ different options even when I only have plain text on the clipboard. Seems not that disastrous to just present a broad array of options in "paste as" even without knowing what formats are actually available. Excel can optimize itself within this framework by utilizing a web custom format which holds a single representation of the copied data, and then after paste, processing that canonical data into "function" form, "link" form, "text" form or whatever else those icons imply.
I don't agree, but it's a toy example, and the point is that some apps could rely on existing behavior.
It's unfortunate that they diverged from the spec, but that doesn't change that this could break existing sites which only care about or test on non-Safari browsers. |
@evanstade Can we discuss your concerns in the next EditingWG call(01/11)? Wanted to make sure they are addressed before we mark this issue as resolved. (Removing the resolved for now). |
Yes, happy to discuss there. |
@evanstade We discussed with our Excel partners about the concerns you raised in the last EditingWG meeting and have some questions that we would like to discuss in the next meeting:
I agree that providing more delay between |
@evanstade Prepared a document describing the interaction of on-demand read with delayed clipboard rendering feature. Please let us know what you think. Thanks! |
The Web Editing Working Group just discussed The full IRC log of that discussion<dandclark> topic: https://github.com//issues/191<dandclark> github: https://github.com//issues/191 <dandclark> snianu: We're still investigating and discussing what the right approach is <dandclark> johanneswilm: Let's discuss another time <whsieh> https://github.com//issues/137 |
Reading all supported formats from the clipboard during read() takes time especially since the HTML/Image payload can be in MBs/GBs. We could defer reading of the actual data from the clipboard and populate the clipboard item object with just promises to the blob data for all supported formats. That way we can resolve the promise with the actual data from the clipboard when getType is called. But this also means that we would have to track changes to the system clipboard as any change to the formats that was read during ClipboardItem object creation, would make the object stale/invalid. It also impacts formats that were delay rendered.
In the spec[1] it explicitly states that read should read all the data from the system clipboard in step 3. When getType is called, we resolve the promise to the data that was read during Clipboarditem object creation in step 6.
Should we make a change to the spec to read the data on-demand and not upfront? This would also help in delayed rendering of formats.
Note that in Chromium, DataTransfer APIs already follow a similar pattern where the sequence number is checked to see if the clipboard data that was read during the data transfer item object creation is stale or not: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/clipboard/data_object_item.cc;drc=4c2fec5f6699ffeefd93137d2bf8c03504c6664c;l=215
@inexorabletash @evanstade @annevk @whsieh @sanketj
The text was updated successfully, but these errors were encountered: