Clipboard Test

<style></style>

<style>.description{ display: block; font-size: 13pt; color: #444; font-style: italic; margin-bottom: 7px; } .method>.returns{display: none;} .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param:not(:last-child):after{content: ","; padding-right: .5em; } .method>.name>.param>.name:after{content: " as "; font-weight: normal; } .method>.params{display: block; color:#555;} .method>.params>.param{display: block; margin-bottom:5px;} .method>.params>.param>.name{font-weight:bold; margin-right:.5em; min-width:80px; display:inline-block;} .method>.params>.param>.description{display:inline-block; width:300px; vertical-align:top;margin-right:30px} .method>.params>.param>.type{display:inline-block; width:100px; vertical-align:top;font-weight:bold;} .method>.params>.param>.type:before{content: "Type "; color: #888; font-weight:normal;} .method>.params>.param>.default{display:inline-block; width:100px; vertical-align:top;font-weight:bold;} .method>.params>.param>.default:before{content: "Default "; color: #888;font-weight:normal;} ]]></style>

Clipboard

Jetpack's clipboard support API provides a standardized way for features to access the clipboard. Features can get and set the clipboard in various flavors of data type.

The namespace associated with this API is jetpack.clipboard which provides both read and write access to the clipboard. The API is fairly straightforward; examples can be found here.

This API currently lives in the future and must be imported for use.

jetpack.future.import("clipboard");

Methods

set(contentstringflavorstring)Writes data from Jetpack to the clipboard. This is the recommended method of copying data to the clipboard. string
contentThe content to be copied to the clipboard. If no other arguments are specified, the flavor of the content is assumed to 'plain'.string
flavorData type. This is an optional parameter. The only flavors currently implemented are 'plain' (text/unicode) and 'html' (which is HTML).string"text"

Here's an example of how to use the method to set the clipboard.

jetpack.import.future("clipboard");
// In text format
jetpack.clipboard.set("Hello World");
// In other clipboard
get(flavor string)Returns data to Jetpack from the clipboard. If flavor is provided, the data is returned in that format.
flavorReturns data to Jetpack from the clipboard. If flavor is provided, the data is returned in that format. string

Here's an example of how to use the method to get the data on the clipboard. Remember to import clipboard from the future before calling it.

jetpack.import.future("clipboard");
var myContent = "<i>This is some italic text</i>";
jetpack.clipboard.set( myContent, "html" );
getCurrentFlavors()Returns an array of available Jetpack clipboard flavors, for the current system clipboard state.
jetpack.import.future("clipboard");

var myContent = "<i>This is some italic text</i>";
jetpack.clipboard.set( myContent, "html" );

var flavs = jetpack.clipboard.getClipboardFlavors();
// Should equal ["html", "text"]
console.log( flavs );