-
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
Support for delayed clipboard data #41
Comments
This doesn't necessarily mitigate the desire to account for it, but note that Chrome is unlikely to support copying images without browser-side re-encoding for sanitization (that's one major motivation for the asynchronous API). So it wouldn't be beneficial to generate various image formats before passing to the API in that case. |
Presumably most OSes require pushing the data actively to the clipboard. Would it make sense to use a Promise here, since we are directly triggering the write with the API? |
That's fine for our needs, at least. We need this for non-image data (e.g. PDF for interop with Adobe products).
All major desktop platforms (i.e. Windows, macOS, and Linux) have a way to add format(s) to the clipboard and provide the data only when requested. A promise does not solve the problem we're trying to address. In our case, we are developing a design tool that ideally would interoperate with e.g. Adobe Illustrator, Sketch, Glyphs, etc. To maximize the number of interoperable applications, we need to be able to place arbitrary formats on the clipboard (e.g. |
Ooh, cool, I did not know. That makes me think of Chrome Remote Desktop, which could make use of a delayed clipboard the other way. Right now, I believe reads the clipboard every time you switch the app, and pushes that to the remote computer. If it had a clipboard listener whose handler could asynchronously query for formats it could also benefit from those OS mechanisms, right? |
The remote Chrome instance would have to block whatever thread processes the clipboard data request until it receives the data from the local Chrome instance. It is probably doable, but network latency could be a problem. |
@poiru :
Could you please clarify this? |
I linked to this earlier. Let me know if that page is not helpful! |
Thanks, taking a look. I've also noticed in your code example, you were using APIs from the modern clipboard spec |
@gked : That was the incubation document. We've folded the Async Clipboard API info into the main clipboard spec, so this seems like the best place to track the issue. @poiru : Do you know how that API works with multiple apps writing to the clipboard? E.g.:
From a quick glance, I couldn't convince myself that it was designed to work outside of a single app managing its own clipboard. |
@garykac Applications that own the clipboard with delayed data usually warn on quit. For example, Adobe Illustrator shows this:
|
The image sanitization is actually not great for our design tool. Users need the metadata and original content, so I'd recommended an early-out off sanitization detection first. If the image doesn't need to be sanitized, then pass through the original. For example, animated PNG might be converted to a regular PNG by the sanitization. |
I see that remote chrome is already mentioned here, but I'd like to add to that that there are many other remote desktop protocols (RDP, VNC, Spice, etc.) that could all benefit from not having to transfer the data whenever the clipboard changes. The user will in most cases not even use the clipboard so there will be a lot of wasted bandwidth. Bandwidth that could have been used for transferring image updates instead. It would be nice if this could be added before the async API is finalised. (This also affects DragEvent and ClipboardEvent, although it's probably rare that their inefficiency is a problem) |
Apple explains this well:
Has something like this been considered? For example, instead of:
we could have something like:
The text was updated successfully, but these errors were encountered: