<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
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
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" );
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 );