User Tools

Site Tools


en:code:data:clipboard

Differences

This shows you the differences between two versions of the page.


Previous revision
en:code:data:clipboard [2021/02/13 11:23] (current) – external edit 127.0.0.1
Line 1: Line 1:
 +====== 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 ===
 +<code javascript>
 +var myObject = new Clipboard();
 +</code>
 +<code javascript>
 +var myObject = new Clipboard(mode);
 +</code>
 +
 +=== Arguments ===
 +  - mode - ([[#mode|Mode]]) the clipboard mode
 +
 +=== Example ===
 +Create a Clipboard object.
 +<code javascript>
 +var myObject = new Clipboard();
 +</code>
 +Create a Clipboard object to the selection buffer.
 +<code javascript>
 +var myObject = new Clipboard(Clipboard.Selection);
 +</code>
 +
 +===== Methods =====
 +
 +==== setMode ====
 +Set the clipboard mode.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.setMode(mode);
 +</code>
 +
 +=== Arguments ===
 +  - mode - ([[#mode|Mode]]) the clipboard mode
 +
 +=== Returns ===
 +  * (Clipboard) this Clipboard
 +
 +=== Exceptions ===
 +  * (UnsupportedSelectionModeError) this mode is not supported under this operating system
 +
 +==== setText ====
 +Sets the clipboard text.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.setText(text);
 +</code>
 +
 +=== Arguments ===
 +  - text - (string) the text to write to the clipboard
 +
 +=== Returns ===
 +  * (Clipboard) this Clipboard
 +
 +==== setImage ====
 +Sets the clipboard image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.setImage(image);
 +</code>
 +
 +=== Arguments ===
 +  - image - ([[en:code:core:image|Image]]) the image to write to the clipboard
 +
 +=== Returns ===
 +  * (Clipboard) this Clipboard
 +
 +==== text ====
 +Returns the content of the clipboard as text.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.text();
 +</code>
 +
 +=== Returns ===
 +  * (string) the content of the clipboard as text
 +
 +==== image ====
 +Returns the content of the clipboard as an image.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.image();
 +</code>
 +
 +=== Returns ===
 +  * ([[en:code:core:image|Image]]) the content of the clipboard as an image
 +
 +==== dataType ====
 +Returns the current clipboard content type.
 +
 +=== Syntax ===
 +<code javascript>
 +myObject.dataType();
 +</code>
 +
 +=== Returns ===
 +  * ([[#datatype|DataType]]) the current clipboard content type
 +
 +===== Attributes =====
 +
 +==== text ====
 +The clipboard's content as text. (string)
 +
 +==== image ====
 +The clipboard's content as an image. ([[en:code:core:image|Image]])
 +
 +===== 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