This page attempts to recollect a large amount of pointers to specifications,
articles, API-documents, and attempts that related to the clipboard and more
generally to user-initiated transfers, such as copy-and-paste or drag-and-drop
as we know them in common desktop environments.
It comes as an attempt to clarify a few ideas in order to propose sensible
copy-and-paste facilities that web-page scripts could influence.
Copy and Paste, Clipboard, Data-flavours, Drag-And-Drop…
Litterature about User-initiated Transfers
Fundamental litterature
Maybe a good start is the copy-and-paste Wikipedia definition as well as the
drag-and-drop Wikipedia definition.
Both could be thicker though!
I should include here the platform’s UI guidelines.
Maybe the origins of these paradigms can be found at early versions of such.
A beginning list which should provide precise pointers to the transfer actions::
Implementation specifications
From the specifications there or from some other sources we should find out what are the ingredients to a standardized new clipboard-format introduction for MathML.
On desktop applications:
MicroSoft Windows in:
- .NET and Visual Basic: centered around the Clipboard class
a set of encoding-types is pre-defined in DataFormats class
and it seems there are internal documents about the various data-type names.
Several documents treat transfers of particular formats along special conversion
facilities (e.g. images, audio-files, …).
- C++: some Clipboard Formats,
are predefined and can also be registered at application-startup.
Data-exchange
is a developer documentation chapter which includes clipboard and drag-and-drop
and may even be based on shared memory spaces (!).
Apple’s MacOSX in
- Cocoa: copy and paste centered around the NSPasteboard class
A large set of own encoding-types
is pre-defined. Several documents treat transfers of particular formats (also fonts, …)
- Carbon: the
OSType class is responsible to designate the names, traditionally based on 4-characters-codes, and an emerging specification is called Uniform Type Identifiers
which provide applications-info-level information about clipboard (and files’) types.
the Java runtime has fairly complete transfer mechanisms
in all platforms.
A DnD and Data Transfer tutorial
exists for the Swing widget set.
The java runtime uses the DataFlavor
class to mimic mime-types, they are used as keys to denote the encodings
of a transfer, presented under the Transferable
interface. Every java installation comes with SystemFlavorMap which relies on a file called flavormap.properties which associates platform-local-names to MIME-types. There seems to exist tricks to enrich this map, application per application.
In web-browsers:
- Internet Explorer’s DHTML Data Tansfer (now replaced by About DHTML Data Transfer
It was never clear whether that API can be considered to stay or not. It seems
there are good reasons not to keep it active since it allows any web-page-script
to read the clipboard or write to it without the user doing anything else than
reading. Only URLs and plain-text is supported.
- Safari offers an API for scripts to replace the content being copied or pasted
through standard gestures as well as specify individual draggeable elements’
and behaviour in
Safari JS Programming
All formats seem supported using mime-types as encoding names.
- nothing in Mozilla I know of
- nothing in Opera I know of
Standardization attempts
- a first incomplete working-draft of clipboard API on the web (by Charles McCathieNeville and Doug Schepers)
at the webAPI working group. Discussion continues, e.g. see this mailing-list-thread where, among others, evidence that a sanitization process is required before arbitrary web-data can enter the clipboard).
- Design-Science and MicroSoft’s MathML-clipboard (requires W3C member password) this has flowed in the following
- MathML 3 current draft has a nice section specifying how MathML should be put in the clipboard. This almost generlizes the specification above (and I guess the almost will be erased soon). The nicest part, I feel, is that it even empowers page authors, in case the MathML is put in the clipboard, to put into it, parallel types such as image renderings or alternate language representations.
- HTML5, the “back to roots through parsing wizardy” ongoing spec, has a current draft that specifies an API for drag-and-drop and direct translation to copy-and-paste. Maybe something compatible with the clipboard-operations’ draft, or that will be. Looks like Mozilla implementations are there already (in French)
Miscellanous
- LiveClipboard: Ray Ozzie’s initiative to use
the clipboard transferring XML fragments. Assumes the web-application entirely
masters (and displays) the selection (which is quite an issue). Probably
only works well with atomic selection elements. Also, cannot care for multiple
encodings since it relies on the browser actually copy-and-pasting XML-content
as plain-text
- an old site about copy and paste
- Tim Berners-Lee considers important to give types to transferred objets
Inspector Helpers
Note: none much tested!
Trackback URL for this post:
http://eds.activemath.org/de/trackback/161
clipboard.js
well… one day I wish the browser world would not be so crooked!
codecogs.com’s EquationEditor (which looks pretty good btw) has a file clipboard.js which takes care of clipboard stuffs. Very simple: either you’re MSIE (hence you can write to clipboard) or… use flash!
The code is amazing and simple:
function copy(text2copy) { if (window.clipboardData) { window.clipboardData.setData("Text",text2copy); } else { var flashcopier = 'flashcopier'; if(!document.getElementById(flashcopier)) { var divholder = document.createElement('div'); divholder.id = flashcopier; document.body.appendChild(divholder); } document.getElementById(flashcopier).innerHTML = ''; var divinfo = ''; document.getElementById(flashcopier).innerHTML = divinfo; } }(I’m reproducing this here somehow freely, they claim somewhere their code is GPL but it’s not visible in the download, shame!).
Why should things be more complicated?
Why should we work about a standard for clipboard operations?