en:code:data:clipboard
This is an old revision of the document!
Table of Contents
Clipboard
This object allows you to have access to the system's clipboard. Under Linux you also have access to the selection buffer.
Functions
Clipboard
Constructor function.
Syntax
var myObject = new Clipboard();
var myObject = new Clipboard(options);
Arguments
- options - (object) clipboard options
- mode - (Mode) the clipboard mode
Example
Create a Clipboard object.
var myObject = new Clipboard();
Create a Clipboard object to the selection buffer.
var myObject = new Clipboard({ "mode": Clipboard.Selection });
Methods
setMode
Set the clipboard mode.
Syntax
myObject.setMode(mode);
Arguments
- mode - (Mode) the clipboard mode
Returns
- (Clipboard) this Clipboard
Exceptions
- (UnsupportedSelectionModeError) this mode is not supported under this operating system
writeText
Sets the clipboard text.
Syntax
myObject.writeText(text);
Arguments
- text - (string) the text to write to the clipboard
Returns
- (Clipboard) this Clipboard
writeImage
Sets the clipboard image.
Syntax
myObject.writeImage(image);
Arguments
- image - (Image) the image to write to the clipboard
Returns
- (Clipboard) this Clipboard
readText
Returns the content of the clipboard as text.
Syntax
myObject.readText();
Returns
- (string) the content of the clipboard as text
readImage
Returns the content of the clipboard as an image.
Syntax
myObject.readImage();
Returns
- (Image) the content of the clipboard as an image
dataType
Returns the current clipboard content type.
Syntax
myObject.dataType();
Returns
- (DataType) the current clipboard content type
Enumerations
Mode
Clipboard mode.
Values
- Standard: standard clipboard
- Selection: selection buffer (Linux only)
- FindBuffer: find buffer (Mac only)
DataType
The clipboard's data type.
Values
- Text: text
- Image: an image
en/code/data/clipboard.1295825376.txt.gz · Last modified: 2021/02/13 11:23 (external edit)