Skip to content
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

Pickling for Async Clipboard API #525

Open
snianu opened this issue May 11, 2021 · 14 comments
Open

Pickling for Async Clipboard API #525

snianu opened this issue May 11, 2021 · 14 comments

Comments

@snianu
Copy link

snianu commented May 11, 2021

Request for Mozilla Position on an Emerging Web Specification

Other information

There have been discussions on Pickling Clipboard API during TPAC and also while discussing Raw Clipboard API.
Slides: https://docs.google.com/presentation/d/1_fAgL54D0whQ497G8iL0K2kKpxiWDr3M7gXXSIS76II
Editing TF Minutes: https://lists.w3.org/Archives/Public/public-editing-tf/2020Oct/0017.html
Chrome Status entry: https://chromestatus.com/feature/5649558757441536
Design Doc: https://docs.google.com/document/d/1afc45MQuwxEWgoUeJCO-sOWRSzs31V4JS-kKXJNMTXw/edit?usp=sharing

Some notes about Mozilla's support for custom formats.

  • It currently has an implementation to support custom format, but that is not standardized.
  • This proposal just adds an option to include custom formats via ClipboardItemOption so the formats don't get written into the clipboard without web authors explicitly specifying the custom formats. This also allows for creating unsanitized pickled formats even for well-known mime types

Thanks!

@evilpie
Copy link

evilpie commented May 12, 2021

I think before specifying support for custom formats it would be good to specify the subset of other formats that are actually supported.

We are interested in the async clipboard API, but the current specification is under-specified and differs between Webkit and Blink, which currently blocks us from enabling at least clipboard.write. It would be great if we could make progress on w3c/clipboard-apis#135 first.

@snianu
Copy link
Author

snianu commented May 17, 2021

@evilpie I've responded to w3c/clipboard-apis#135 issue, but I think custom format support is sort of orthogonal to other standard formats. Custom format is already supported by major browsers via DataTransfer object(e.g. https://jsfiddle.net/gked/5xo1whye/4) and we are trying to standardize this via Async Clipboard APIs. Particularly we are interested in getting feedback for:
(a) The shape of the API to read/write the pickled data.
(b) The format of pickled data on the native clipboard.
Please let us know if you have any thoughts on the proposal.

@annevk
Copy link
Contributor

annevk commented May 18, 2021

It's a problem to be asked to evaluate new stuff when the older new stuff isn't written down/maintained to the point where it can be implemented. Sure, it's a somewhat separable API piece, but there's a larger problem here that needs addressing first as we don't want this to compound.

@gked
Copy link

gked commented May 18, 2021

Thanks, @annevk. We've started discussing this over on web editing front - w3c/editing#305.
I agree that we could specify mime types. At least the ones that are non-controversial and having cross-browser support.

Given that you also agree it is somewhat tangential to pickling, we were hoping to get a yay/nay on the current proposal so we know how to proceed with the work and we'll address adding supported MIME types to the async clipboard spec shortly after the pickling format goes in.

Thoughts?

@annevk
Copy link
Contributor

annevk commented May 19, 2021

The problem goes a lot further than that, no? E.g., looking at https://w3c.github.io/clipboard-apis/#clipboard-interface there's an entire object there (ClipboardItem) that is not defined in the slightest. And that object seems somewhat important for the case at hand.

In the abstract pickling is a good idea and something we have suggested we should do for a while. So from that perspective I'm glad we all landed on the same page, but I feel like we have more fundamental problems to tackle first such as getting the specification maintained and adding cross-browser automated test infrastructure.

@snianu
Copy link
Author

snianu commented May 20, 2021

@annevk ClipboardItem is described here. I'm not sure what information is missing there though. We are discussing some changes related to clipboard formats in w3c/editing#305 issue. It'd be great if Mozilla can participate in those discussions as well.

@annevk
Copy link
Contributor

annevk commented May 20, 2021

It's not? Where is the definition of its constructor or any of its members for instance?

@snianu
Copy link
Author

snianu commented May 20, 2021

Sorry, but I'm still confused. Below is the description of the interface and its members copy-pasted from here:

typedef Promise<ClipboardItemDataType> ClipboardItemData;

callback ClipboardItemDelayedCallback = ClipboardItemData ();

[Exposed=Window] interface ClipboardItem {
  constructor(record<DOMString, ClipboardItemData> items,
    optional ClipboardItemOptions options = {});
  static ClipboardItem createDelayed(
      record<DOMString, ClipboardItemDelayedCallback> items,
      optional ClipboardItemOptions options = {});

  readonly attribute PresentationStyle presentationStyle;
  readonly attribute long long lastModified;
  readonly attribute boolean delayed;

  readonly attribute FrozenArray<DOMString> types;

  Promise<Blob> getType(DOMString type);
};

enum PresentationStyle { "unspecified", "inline", "attachment" };

dictionary ClipboardItemOptions {
  PresentationStyle presentationStyle = "unspecified";
};

@annevk
Copy link
Contributor

annevk commented May 20, 2021

That's IDL. IDL needs to be accompanied by prose that defines how things work. E.g., https://dom.spec.whatwg.org/#interface-text has the Text interface and https://dom.spec.whatwg.org/#dom-text-text defines the constructor for it (linked from the IDL).

@annevk annevk mentioned this issue Sep 29, 2021
@snianu
Copy link
Author

snianu commented Nov 3, 2021

@annevk @mbrodesser we are committed to improving the existing async clipboard spec. Any chance you could comment on the Pickling API proposal?

@annevk
Copy link
Contributor

annevk commented Nov 23, 2021

As per w3c/clipboard-apis#162 (comment) I still think the proposal needs further work before it can be evaluated properly.

@mbrodesser
Copy link

@annevk @mbrodesser we are committed to improving the existing async clipboard spec. Any chance you could comment on the Pickling API proposal?

I'd like to finish w3c/clipboard-apis#158 first. AFAIU, pickling comes on top of it.

@zcorpan
Copy link
Member

zcorpan commented Mar 20, 2023

It seems the spec is now in a better shape with IDL members properly defined. e.g. https://w3c.github.io/clipboard-apis/#clipboard-item-interface

The explainer for Pickling has moved to https://github.com/w3c/editing/blob/gh-pages/docs/clipboard-pickling/explainer.md#pickling-for-async-clipboard-api

@snianu
Copy link
Author

snianu commented Mar 20, 2023

I have also made the required spec changes for this feature. To merge these changes, I need someone who has write access to the repo to sign-off on the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Unscreened
Development

No branches or pull requests

6 participants