- From: FrederickDoering <notifications@github.com>
- Date: Thu, 23 Jul 2015 07:19:46 -0700
- To: w3c/clipboard-apis <clipboard-apis@noreply.github.com>
- Message-ID: <w3c/clipboard-apis/issues/9/124121821@github.com>
@hallvors Regarding file vs. string. A data transfer item has a "kind" of either "string" or "file". There needs to be some way of specifying which kind will be returned by a paste operation. Additionally, the encoding of strings would also need to be specified. The way I solved this in the chrome extension I made to demonstrate proof of concept (currently only working on windows) is to specify the encoding on a per osHandle basis so the syntax is: ```javascript registerClipboardFormat(String mimeType, Object osHandles); ``` where osHandles is a dictionary that uses the os specific handle names as keys and then an encoding enum as values where the encodings currently supported are: `ASCII`, `UTF_8`, `UFT_16`, and `BINARY` The binary encoding always returns files, while the other three return strings (in standard UTF-16 JS strings. The encoding us just for how the string is stored on the OS clipboard) So for my Mathcad usage I called: ```javascript registerClipboardFormat("application/vnd.mathsoft.equation+xml",{ "XMCD Format":registerClipboardFormat.formats.UTF_16, "com.mathsoft.xml":registerClipboardFormat.formats.UTF_16 }); ``` --- Reply to this email directly or view it on GitHub: https://github.com/w3c/clipboard-apis/issues/9#issuecomment-124121821
Received on Thursday, 23 July 2015 14:21:22 UTC