Re: clipboard events

Hello,

sorry to be slow.


Le 31 janv. 2011 à 11:39, Daniel Cheng a écrit :

>>> Platform capabilities vary.
>>> - Windows will be unhappy if you use up all the custom clipboard formats
>>> (~65535 or so). There is no way to release formats once registered.
>>> - Mac uses UTIs which are strings but not MIME types.
>>> - GTK+ seems to support arbitrary MIME types.
>>> So for push support, Windows will be unable to natively support arbitrary
>>> string types.
>> Thanks. Do you think it is OK to say that we allow arbitrary strings but it may not be available on all platforms, and recommend that script authors stick to known MIME types?
> I'd go one step further and say that there should be some agreement on what MIME types ought to be supported to try to insure somewhat consistent behavior across different platforms.

Some types will be predefined but the door should stay opened for others.

> The way I'm working on implementing it (for drag and drop, though it applies to copy and paste as well), arbitrary strings would not be accessible from a non-DOM application, e.g. a native app like Word or Photoshop. Only a set of known MIME types would be automatically converted to the corresponding native type.

This is really really a hard task that I wish neither the spec nor browsers implement. Here's a use case that I would find usefully implemented by this spec. 

A website maker for, say, a shop for furnitures that knows they can go into "my home plan maker" through the clipboard will want to be able to produce and export a clipboard flavor that is unknown to both browser implementors and spec makers now.
Provided the user may say that the format is "safe" (safe as a picture for example), he would be able to drag-and-drop the furniture and get a 3D view inside "my home plan maker".

Such a scenario (there are zillions such) requires:

- arbitrary flavor strings

- knowledge of the flavor strings only from the web-site makers and other software vendor

- agreement on safety (that may be the hard part)

And unfortunately, arbitrary flavor strings cannot be MIME-types only.


Le 26 janv. 2011 à 06:26, Hallvord R. M. Steen a écrit :

> It intends to, but this has two open issues:
> * I assume that many OS clipboard implementations have an enumerated list of "known" formats,

Just a few of them. (I'm trying to maintain pointers to that here: http://eds.activemath.org/transfers-literature )

> I'm not sure if all OSes can handle a request to push "text/foobar" data to the clipboard.

Not an arbitrary mime-type, an arbitrary flavour conforming to the platform's specifics.

> Does anyone know if we can rely on such functionality being truly cross-platform?

Do you mean a mapping from mime-type? No they are unfortunately extremely platform specific.

> 
> * There is not yet a clear way to push multi-part or alternate formats to the OS clipboard from JS.

I don't think this should be needed.

> To use something like iCal, I guess best practise would be to push one human-readable text/plain string for target software without iCal support, and one alternate entry in iCal format.

Absolutely.

> I guess that can be done with 
>  DataTransferItem add(in DOMString data, in DOMString type);
> 
> I.e. spec for copy event would be
> * default action: copy any document selection
> * if default action is prevented: push data in drag data store (as manipulated by setData() or items.add()) to clipboard, probably mapping certain known values to native clipboard formats while doing so.

I think that this is good.

paul

Received on Monday, 31 January 2011 11:26:05 UTC