mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
standardize all javascript blocks in English docs
This commit is contained in:
@@ -5,16 +5,17 @@
|
||||
The following example shows how to write a string to the clipboard:
|
||||
|
||||
```javascript
|
||||
const {clipboard} = require('electron');
|
||||
clipboard.writeText('Example String');
|
||||
const {clipboard} = require('electron')
|
||||
clipboard.writeText('Example String')
|
||||
```
|
||||
|
||||
On X Window systems, there is also a selection clipboard. To manipulate it
|
||||
you need to pass `selection` to each method:
|
||||
|
||||
```javascript
|
||||
clipboard.writeText('Example String', 'selection');
|
||||
console.log(clipboard.readText('selection'));
|
||||
const {clipboard} = require('electron')
|
||||
clipboard.writeText('Example String', 'selection')
|
||||
console.log(clipboard.readText('selection'))
|
||||
```
|
||||
|
||||
## Methods
|
||||
@@ -109,7 +110,8 @@ Returns an array of supported formats for the clipboard `type`.
|
||||
Returns whether the clipboard supports the format of specified `data`.
|
||||
|
||||
```javascript
|
||||
console.log(clipboard.has('<p>selection</p>'));
|
||||
const {clipboard} = require('electron')
|
||||
console.log(clipboard.has('<p>selection</p>'))
|
||||
```
|
||||
|
||||
### `clipboard.read(data[, type])` _Experimental_
|
||||
@@ -130,6 +132,7 @@ Reads `data` from the clipboard.
|
||||
* `type` String (optional)
|
||||
|
||||
```javascript
|
||||
clipboard.write({text: 'test', html: "<b>test</b>"});
|
||||
const {clipboard} = require('electron')
|
||||
clipboard.write({text: 'test', html: '<b>test</b>'})
|
||||
```
|
||||
Writes `data` to the clipboard.
|
||||
|
||||
Reference in New Issue
Block a user