@tauri-apps/plugin-clipboard-manager 2.0.0-rc.0 → 2.0.0-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -3
- package/dist-js/index.cjs +14 -9
- package/dist-js/index.d.ts +6 -1
- package/dist-js/index.js +14 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -60,9 +60,15 @@ fn main() {
|
|
|
60
60
|
Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
|
|
61
61
|
|
|
62
62
|
```javascript
|
|
63
|
-
import {
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
import {
|
|
64
|
+
writeText,
|
|
65
|
+
readText,
|
|
66
|
+
writeHtml,
|
|
67
|
+
readHtml,
|
|
68
|
+
clear
|
|
69
|
+
} from '@tauri-apps/plugin-clipboard-manager'
|
|
70
|
+
await writeText('Tauri is awesome!')
|
|
71
|
+
assert(await readText(), 'Tauri is awesome!')
|
|
66
72
|
```
|
|
67
73
|
|
|
68
74
|
## Contributing
|
package/dist-js/index.cjs
CHANGED
|
@@ -25,9 +25,9 @@ var image = require('@tauri-apps/api/image');
|
|
|
25
25
|
* @since 2.0.0
|
|
26
26
|
*/
|
|
27
27
|
async function writeText(text, opts) {
|
|
28
|
-
await core.invoke(
|
|
28
|
+
await core.invoke('plugin:clipboard-manager|write_text', {
|
|
29
29
|
label: opts?.label,
|
|
30
|
-
text
|
|
30
|
+
text
|
|
31
31
|
});
|
|
32
32
|
}
|
|
33
33
|
/**
|
|
@@ -40,7 +40,7 @@ async function writeText(text, opts) {
|
|
|
40
40
|
* @since 2.0.0
|
|
41
41
|
*/
|
|
42
42
|
async function readText() {
|
|
43
|
-
return await core.invoke(
|
|
43
|
+
return await core.invoke('plugin:clipboard-manager|read_text');
|
|
44
44
|
}
|
|
45
45
|
/**
|
|
46
46
|
* Writes image buffer to the clipboard.
|
|
@@ -61,8 +61,8 @@ async function readText() {
|
|
|
61
61
|
* @since 2.0.0
|
|
62
62
|
*/
|
|
63
63
|
async function writeImage(image$1) {
|
|
64
|
-
await core.invoke(
|
|
65
|
-
image: image.transformImage(image$1)
|
|
64
|
+
await core.invoke('plugin:clipboard-manager|write_image', {
|
|
65
|
+
image: image.transformImage(image$1)
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
@@ -78,7 +78,7 @@ async function writeImage(image$1) {
|
|
|
78
78
|
* @since 2.0.0
|
|
79
79
|
*/
|
|
80
80
|
async function readImage() {
|
|
81
|
-
return await core.invoke(
|
|
81
|
+
return await core.invoke('plugin:clipboard-manager|read_image').then((rid) => new image.Image(rid));
|
|
82
82
|
}
|
|
83
83
|
/**
|
|
84
84
|
* * Writes HTML or fallbacks to write provided plain text to the clipboard.
|
|
@@ -95,13 +95,18 @@ async function readImage() {
|
|
|
95
95
|
* @since 2.0.0
|
|
96
96
|
*/
|
|
97
97
|
async function writeHtml(html, altHtml) {
|
|
98
|
-
await core.invoke(
|
|
98
|
+
await core.invoke('plugin:clipboard-manager|write_html', {
|
|
99
99
|
html,
|
|
100
|
-
altHtml
|
|
100
|
+
altHtml
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* Clears the clipboard.
|
|
105
|
+
*
|
|
106
|
+
* #### Platform-specific
|
|
107
|
+
*
|
|
108
|
+
* - **Android:** Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead.
|
|
109
|
+
*
|
|
105
110
|
* @example
|
|
106
111
|
* ```typescript
|
|
107
112
|
* import { clear } from '@tauri-apps/plugin-clipboard-manager';
|
|
@@ -110,7 +115,7 @@ async function writeHtml(html, altHtml) {
|
|
|
110
115
|
* @since 2.0.0
|
|
111
116
|
*/
|
|
112
117
|
async function clear() {
|
|
113
|
-
await core.invoke(
|
|
118
|
+
await core.invoke('plugin:clipboard-manager|clear');
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
exports.clear = clear;
|
package/dist-js/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Image } from
|
|
1
|
+
import { Image } from '@tauri-apps/api/image';
|
|
2
2
|
/**
|
|
3
3
|
* Writes plain text to the clipboard.
|
|
4
4
|
* @example
|
|
@@ -74,6 +74,11 @@ declare function readImage(): Promise<Image>;
|
|
|
74
74
|
declare function writeHtml(html: string, altHtml?: string): Promise<void>;
|
|
75
75
|
/**
|
|
76
76
|
* Clears the clipboard.
|
|
77
|
+
*
|
|
78
|
+
* #### Platform-specific
|
|
79
|
+
*
|
|
80
|
+
* - **Android:** Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead.
|
|
81
|
+
*
|
|
77
82
|
* @example
|
|
78
83
|
* ```typescript
|
|
79
84
|
* import { clear } from '@tauri-apps/plugin-clipboard-manager';
|
package/dist-js/index.js
CHANGED
|
@@ -23,9 +23,9 @@ import { transformImage, Image } from '@tauri-apps/api/image';
|
|
|
23
23
|
* @since 2.0.0
|
|
24
24
|
*/
|
|
25
25
|
async function writeText(text, opts) {
|
|
26
|
-
await invoke(
|
|
26
|
+
await invoke('plugin:clipboard-manager|write_text', {
|
|
27
27
|
label: opts?.label,
|
|
28
|
-
text
|
|
28
|
+
text
|
|
29
29
|
});
|
|
30
30
|
}
|
|
31
31
|
/**
|
|
@@ -38,7 +38,7 @@ async function writeText(text, opts) {
|
|
|
38
38
|
* @since 2.0.0
|
|
39
39
|
*/
|
|
40
40
|
async function readText() {
|
|
41
|
-
return await invoke(
|
|
41
|
+
return await invoke('plugin:clipboard-manager|read_text');
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Writes image buffer to the clipboard.
|
|
@@ -59,8 +59,8 @@ async function readText() {
|
|
|
59
59
|
* @since 2.0.0
|
|
60
60
|
*/
|
|
61
61
|
async function writeImage(image) {
|
|
62
|
-
await invoke(
|
|
63
|
-
image: transformImage(image)
|
|
62
|
+
await invoke('plugin:clipboard-manager|write_image', {
|
|
63
|
+
image: transformImage(image)
|
|
64
64
|
});
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
@@ -76,7 +76,7 @@ async function writeImage(image) {
|
|
|
76
76
|
* @since 2.0.0
|
|
77
77
|
*/
|
|
78
78
|
async function readImage() {
|
|
79
|
-
return await invoke(
|
|
79
|
+
return await invoke('plugin:clipboard-manager|read_image').then((rid) => new Image(rid));
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
82
|
* * Writes HTML or fallbacks to write provided plain text to the clipboard.
|
|
@@ -93,13 +93,18 @@ async function readImage() {
|
|
|
93
93
|
* @since 2.0.0
|
|
94
94
|
*/
|
|
95
95
|
async function writeHtml(html, altHtml) {
|
|
96
|
-
await invoke(
|
|
96
|
+
await invoke('plugin:clipboard-manager|write_html', {
|
|
97
97
|
html,
|
|
98
|
-
altHtml
|
|
98
|
+
altHtml
|
|
99
99
|
});
|
|
100
100
|
}
|
|
101
101
|
/**
|
|
102
102
|
* Clears the clipboard.
|
|
103
|
+
*
|
|
104
|
+
* #### Platform-specific
|
|
105
|
+
*
|
|
106
|
+
* - **Android:** Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead.
|
|
107
|
+
*
|
|
103
108
|
* @example
|
|
104
109
|
* ```typescript
|
|
105
110
|
* import { clear } from '@tauri-apps/plugin-clipboard-manager';
|
|
@@ -108,7 +113,7 @@ async function writeHtml(html, altHtml) {
|
|
|
108
113
|
* @since 2.0.0
|
|
109
114
|
*/
|
|
110
115
|
async function clear() {
|
|
111
|
-
await invoke(
|
|
116
|
+
await invoke('plugin:clipboard-manager|clear');
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
export { clear, readImage, readText, writeHtml, writeImage, writeText };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tauri-apps/plugin-clipboard-manager",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.2",
|
|
4
4
|
"license": "MIT or APACHE-2.0",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Tauri Programme within The Commons Conservancy"
|
|
@@ -24,6 +24,6 @@
|
|
|
24
24
|
"LICENSE"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@tauri-apps/api": "^2.0.0-rc.
|
|
27
|
+
"@tauri-apps/api": "^2.0.0-rc.4"
|
|
28
28
|
}
|
|
29
29
|
}
|