On Tue, Jan 25, 2011 at 21:26, Hallvord R. M. Steen <hallvord@opera.com>wrote:
> (Responding to multiple E-mails. Plead guilty to Ianesque behaviour there.
> Last draft of spec is http://dev.w3.org/2006/webapi/clipops/clipops.html.)
>
> On Fri, 24 Dec 2010 07:21:35 +0900, Paul Libbrecht <paul@hoplahup.net>
> wrote:
>
> - this seems to support the insertion in the clipboard's data of other
>> types than what is currently commonly supported by browsers and the minimum
>> quoted there; this is good and important. I think, for example, that such
>> data as the iCal format would fit very well and be very useful here.
>>
>
> It intends to, but this has two open issues:
> * I assume that many OS clipboard implementations have an enumerated list
> of "known" formats, I'm not sure if all OSes can handle a request to push
> "text/foobar" data to the clipboard. Does anyone know if we can rely on such
> functionality being truly cross-platform?
>
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.
When pulling data from the clipboard, I wonder if it may also be a bad idea
to expose all the native types. I was working on a patch to do this in
WebKit, and it turns out some of the native types leak information about
filesystem paths when files are involved in the dragging/paste operation.
> * There is not yet a clear way to push multi-part or alternate formats to
> the OS clipboard from JS. 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. 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.
>
If the default action is prevented and no data was added to the drag data
store, does that imply the clipboard should be cleared?
Daniel