[clipboard events] seeking implementor feedback on using CID: URI scheme for pasting embedded binary data

Hi,
pasting HTML that contains embeds (images, video) into a rich text editor is a use case we should cover. It's currently handled in different ways - 

* IE11 supports pasting images as either data: URLs or blobs [1] (and has a non-standard method to fill in a gap in the blob approach). I don't understand from this blog post how/if it supports referencing the binary parts from the HTML. If for example you paste a snippet from a Word page that contains two images, the DataTransferItemList is presumably populated with two image files, which can be processed/uploaded using the blob method - but how is the script processing the data supposed to know what IMG tag in the pasted HTML each image file belongs to?

* Pasting stuff as data: URLs seems like a hack, wasting memory and requiring quite some extra processing if there is a lot of data.

* Firefox apparently happily passes on file:/// URLs with local paths and all [2], this is of course a bug.

* Right now I'm not sure what WebKit/Blink - based implementations do. Test results welcome!

As the editor of the Clipboard Events spec, I'm proposing a somewhat different take on this: "cid:"-URIs for embeds. See http://dev.w3.org/2006/webapi/clipops/clipops.html (search for "cid:").

The idea is that rather than embedding potentially very huge data: URLs or reference local files in the embedded markup, we add a reference to the DataTransferItemList, and use the index of this reference to construct a cid: URI in the markup that clipboardEvent.getData('text/html') will see. The script processing this data can then pull out the cid: URIs, do drag-and-drop style file uploads for referenced clipboard parts, and update the data to refer to the locations on the server eventually (maybe first using an intermediate placeholder image or something like that.)

AFAIK, outside of the used in HTML intended for E-mail, this would be the first usage of CID: URIs in web platform specs. I'm looking for feedback regarding whether this is implementable and a good solution. I haven't had much (if any) feedback from implementors on this issue yet, so thank you all in advance for your ideas and input.
-Hallvord

[1] http://blogs.msdn.com/b/ie/archive/2013/10/24/enhanced-rich-editing-experiences-in-ie11.aspx
[2] https://bugzilla.mozilla.org/show_bug.cgi?id=665341

Received on Friday, 24 January 2014 01:30:08 UTC