Clipboard.js
2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*
* Ext JS Library 0.30
* Copyright(c) 2006-2009, Ext JS, LLC.
* licensing@extjs.com
*
* http://extjs.com/license
*/
/**
* @class Ext.air.Clipboard
* @singleton
* Allows you to manipulate the native system clipboard and handle various formats.
* This class is essentially a passthrough to air.Clipboard.generalClipboard at this
* time, but may get more Ext-like functions in the future.
*
* The Clipboard has different types which it can hold:
* CONSTANT - value
* air.ClipboardFormats.TEXT_FORMAT - air:text
* air.ClipboardFormats.HTML_FORMAT - air:html
* air.ClipboardFormats.RICH_TEXT_FORMAT - air:rtf
* air.ClipboardFormats.URL_FORMAT - air:url
* air.ClipboardFormats.FILE_LIST_FORMAT - air:file list
* air.ClipboardFormats.BITMAP_FORMAT - air:bitmap
*/
Ext.air.Clipboard = function() {
var clipboard = air.Clipboard.generalClipboard;
return {
/**
* Determine if there is any data in a particular format clipboard.
* @param {String} format Use the air.ClipboardFormats CONSTANT or the string value
*/
hasData: function(format) {
return clipboard.hasFormat(format);
},
/**
* Set the data for a particular format clipboard.
* @param {String} format Use the air.ClipboardFormats CONSTANT or the string value
* @param {Mixed} data Data to set
*/
setData: function(format, data) {
clipboard.setData(format, data);
},
/**
* Set the data handler for a particular format clipboard.
* @param {String} format Use the air.ClipboardFormats CONSTANT or the string value
* @param {Function} fn The function to evaluate when getting the clipboard data
*/
setDataHandler: function(format, fn) {
clipboard.setDataHandler(format, fn);
},
/**
* Get the data for a particular format.
* @param {String} format Use the air.ClipboardFormats CONSTANT or the string value
* @param {String} transferMode
*/
getData: function(format, transferMode) {
clipboard.getData(format, transferMode);
},
/**
* Clear the clipboard for all formats.
*/
clear: function() {
clipboard.clear();
},
/**
* Clear the data for a particular format.
* @param {String} format Use the air.ClipboardFormats CONSTANT or the string value
*/
clearData: function(format) {
clipboard.clearData(format);
}
};
}();