Provide API to access selection clipboard, fixes #377.
This commit is contained in:
parent
7c14c2758b
commit
950704c7e8
3 changed files with 73 additions and 30 deletions
|
@ -1,38 +1,55 @@
|
|||
# clipboard
|
||||
|
||||
An example of writing a string to clipboard:
|
||||
The `clipboard` provides methods to do copy/paste operations. An example of
|
||||
writing a string to clipboard:
|
||||
|
||||
```javascript
|
||||
var clipboard = require('clipboard');
|
||||
clipboard.writeText('Example String');
|
||||
```
|
||||
|
||||
## clipboard.readText()
|
||||
On X Window systems, there is also a selection clipboard, to manipulate in it
|
||||
you need to pass `selection` to each method:
|
||||
|
||||
```javascript
|
||||
var clipboard = require('clipboard');
|
||||
clipboard.writeText('Example String', 'selection');
|
||||
console.log(clipboard.readText('selection'));
|
||||
```
|
||||
|
||||
## clipboard.readText([type])
|
||||
|
||||
* `type` String
|
||||
|
||||
Returns the content in clipboard as plain text.
|
||||
|
||||
## clipboard.writeText(text)
|
||||
## clipboard.writeText(text[, type])
|
||||
|
||||
* `text` String
|
||||
* `type` String
|
||||
|
||||
Writes the `text` into clipboard as plain text.
|
||||
|
||||
## clipboard.clear()
|
||||
## clipboard.clear([type])
|
||||
|
||||
* `type` String
|
||||
|
||||
Clears everything in clipboard.
|
||||
|
||||
## clipboard.has(type)
|
||||
## clipboard.has(format[, type])
|
||||
|
||||
* `format` String
|
||||
* `type` String
|
||||
|
||||
Returns whether clipboard has data in specified `type`.
|
||||
Returns whether clipboard has data in specified `format`.
|
||||
|
||||
**Note:** This API is experimental and could be removed in future.
|
||||
|
||||
## clipboard.read(type)
|
||||
## clipboard.read(format[, type])
|
||||
|
||||
* `format` String
|
||||
* `type` String
|
||||
|
||||
Reads the data in clipboard of the `type`.
|
||||
Reads the data in clipboard of the `format`.
|
||||
|
||||
**Note:** This API is experimental and could be removed in future.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue