User Tools

Site Tools


en:code:data:clipboard

This is an old revision of the document!


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

  1. 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

  1. 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

  1. text - (string) the text to write to the clipboard

Returns

  • (Clipboard) this Clipboard

writeImage

Sets the clipboard image.

Syntax

myObject.writeImage(image);

Arguments

  1. 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

  1. Standard: standard clipboard
  2. Selection: selection buffer (Linux only)
  3. FindBuffer: find buffer (Mac only)

DataType

The clipboard's data type.

Values

  1. Text: text
  2. Image: an image
en/code/data/clipboard.1295825376.txt.gz · Last modified: 2021/02/13 11:23 (external edit)