@tauri-apps/plugin-clipboard-manager 2.0.0-rc.1 → 2.0.0

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 CHANGED
@@ -2,9 +2,17 @@
2
2
 
3
3
  Read and write to the system clipboard.
4
4
 
5
+ | Platform | Supported |
6
+ | -------- | --------- |
7
+ | Linux | ✓ |
8
+ | Windows | ✓ |
9
+ | macOS | ✓ |
10
+ | Android | ✓ |
11
+ | iOS | ✓ |
12
+
5
13
  ## Install
6
14
 
7
- _This plugin requires a Rust version of at least **1.75**_
15
+ _This plugin requires a Rust version of at least **1.78**_
8
16
 
9
17
  There are three general methods of installation that we can recommend.
10
18
 
@@ -18,7 +26,7 @@ Install the Core plugin by adding the following to your `Cargo.toml` file:
18
26
 
19
27
  ```toml
20
28
  [dependencies]
21
- tauri-plugin-clipboard-manager = "2.0.0-rc"
29
+ tauri-plugin-clipboard-manager = "2.0.0"
22
30
  # alternatively with Git:
23
31
  tauri-plugin-clipboard-manager = { git = "https://github.com/tauri-apps/plugins-workspace", branch = "v2" }
24
32
  ```
@@ -60,9 +68,15 @@ fn main() {
60
68
  Afterwards all the plugin's APIs are available through the JavaScript guest bindings:
61
69
 
62
70
  ```javascript
63
- import { writeText, readText, writeHtml, readHtml, clear } from "@tauri-apps/plugin-clipboard-manager";
64
- await writeText("Tauri is awesome!");
65
- assert(await readText(), "Tauri is awesome!");
71
+ import {
72
+ writeText,
73
+ readText,
74
+ writeHtml,
75
+ readHtml,
76
+ clear
77
+ } from '@tauri-apps/plugin-clipboard-manager'
78
+ await writeText('Tauri is awesome!')
79
+ assert(await readText(), 'Tauri is awesome!')
66
80
  ```
67
81
 
68
82
  ## 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("plugin:clipboard-manager|write_text", {
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,10 +40,15 @@ async function writeText(text, opts) {
40
40
  * @since 2.0.0
41
41
  */
42
42
  async function readText() {
43
- return await core.invoke("plugin:clipboard-manager|read_text");
43
+ return await core.invoke('plugin:clipboard-manager|read_text');
44
44
  }
45
45
  /**
46
46
  * Writes image buffer to the clipboard.
47
+ *
48
+ * #### Platform-specific
49
+ *
50
+ * - **Android / iOS:** Not supported.
51
+ *
47
52
  * @example
48
53
  * ```typescript
49
54
  * import { writeImage } from '@tauri-apps/plugin-clipboard-manager';
@@ -61,12 +66,17 @@ async function readText() {
61
66
  * @since 2.0.0
62
67
  */
63
68
  async function writeImage(image$1) {
64
- await core.invoke("plugin:clipboard-manager|write_image", {
65
- image: image.transformImage(image$1),
69
+ await core.invoke('plugin:clipboard-manager|write_image', {
70
+ image: image.transformImage(image$1)
66
71
  });
67
72
  }
68
73
  /**
69
74
  * Gets the clipboard content as Uint8Array image.
75
+ *
76
+ * #### Platform-specific
77
+ *
78
+ * - **Android / iOS:** Not supported.
79
+ *
70
80
  * @example
71
81
  * ```typescript
72
82
  * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
@@ -78,10 +88,15 @@ async function writeImage(image$1) {
78
88
  * @since 2.0.0
79
89
  */
80
90
  async function readImage() {
81
- return await core.invoke("plugin:clipboard-manager|read_image").then((rid) => new image.Image(rid));
91
+ return await core.invoke('plugin:clipboard-manager|read_image').then((rid) => new image.Image(rid));
82
92
  }
83
93
  /**
84
94
  * * Writes HTML or fallbacks to write provided plain text to the clipboard.
95
+ *
96
+ * #### Platform-specific
97
+ *
98
+ * - **Android / iOS:** Not supported.
99
+ *
85
100
  * @example
86
101
  * ```typescript
87
102
  * import { writeHtml, readHtml } from '@tauri-apps/plugin-clipboard-manager';
@@ -95,13 +110,18 @@ async function readImage() {
95
110
  * @since 2.0.0
96
111
  */
97
112
  async function writeHtml(html, altHtml) {
98
- await core.invoke("plugin:clipboard-manager|write_html", {
113
+ await core.invoke('plugin:clipboard-manager|write_html', {
99
114
  html,
100
- altHtml,
115
+ altHtml
101
116
  });
102
117
  }
103
118
  /**
104
119
  * Clears the clipboard.
120
+ *
121
+ * #### Platform-specific
122
+ *
123
+ * - **Android:** Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead.
124
+ *
105
125
  * @example
106
126
  * ```typescript
107
127
  * import { clear } from '@tauri-apps/plugin-clipboard-manager';
@@ -110,7 +130,7 @@ async function writeHtml(html, altHtml) {
110
130
  * @since 2.0.0
111
131
  */
112
132
  async function clear() {
113
- await core.invoke("plugin:clipboard-manager|clear");
133
+ await core.invoke('plugin:clipboard-manager|clear');
114
134
  }
115
135
 
116
136
  exports.clear = clear;
@@ -1,4 +1,4 @@
1
- import { Image } from "@tauri-apps/api/image";
1
+ import { Image } from '@tauri-apps/api/image';
2
2
  /**
3
3
  * Writes plain text to the clipboard.
4
4
  * @example
@@ -27,6 +27,11 @@ declare function writeText(text: string, opts?: {
27
27
  declare function readText(): Promise<string>;
28
28
  /**
29
29
  * Writes image buffer to the clipboard.
30
+ *
31
+ * #### Platform-specific
32
+ *
33
+ * - **Android / iOS:** Not supported.
34
+ *
30
35
  * @example
31
36
  * ```typescript
32
37
  * import { writeImage } from '@tauri-apps/plugin-clipboard-manager';
@@ -46,6 +51,11 @@ declare function readText(): Promise<string>;
46
51
  declare function writeImage(image: string | Image | Uint8Array | ArrayBuffer | number[]): Promise<void>;
47
52
  /**
48
53
  * Gets the clipboard content as Uint8Array image.
54
+ *
55
+ * #### Platform-specific
56
+ *
57
+ * - **Android / iOS:** Not supported.
58
+ *
49
59
  * @example
50
60
  * ```typescript
51
61
  * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
@@ -59,6 +69,11 @@ declare function writeImage(image: string | Image | Uint8Array | ArrayBuffer | n
59
69
  declare function readImage(): Promise<Image>;
60
70
  /**
61
71
  * * Writes HTML or fallbacks to write provided plain text to the clipboard.
72
+ *
73
+ * #### Platform-specific
74
+ *
75
+ * - **Android / iOS:** Not supported.
76
+ *
62
77
  * @example
63
78
  * ```typescript
64
79
  * import { writeHtml, readHtml } from '@tauri-apps/plugin-clipboard-manager';
@@ -74,6 +89,11 @@ declare function readImage(): Promise<Image>;
74
89
  declare function writeHtml(html: string, altHtml?: string): Promise<void>;
75
90
  /**
76
91
  * Clears the clipboard.
92
+ *
93
+ * #### Platform-specific
94
+ *
95
+ * - **Android:** Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead.
96
+ *
77
97
  * @example
78
98
  * ```typescript
79
99
  * 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("plugin:clipboard-manager|write_text", {
26
+ await invoke('plugin:clipboard-manager|write_text', {
27
27
  label: opts?.label,
28
- text,
28
+ text
29
29
  });
30
30
  }
31
31
  /**
@@ -38,10 +38,15 @@ async function writeText(text, opts) {
38
38
  * @since 2.0.0
39
39
  */
40
40
  async function readText() {
41
- return await invoke("plugin:clipboard-manager|read_text");
41
+ return await invoke('plugin:clipboard-manager|read_text');
42
42
  }
43
43
  /**
44
44
  * Writes image buffer to the clipboard.
45
+ *
46
+ * #### Platform-specific
47
+ *
48
+ * - **Android / iOS:** Not supported.
49
+ *
45
50
  * @example
46
51
  * ```typescript
47
52
  * import { writeImage } from '@tauri-apps/plugin-clipboard-manager';
@@ -59,12 +64,17 @@ async function readText() {
59
64
  * @since 2.0.0
60
65
  */
61
66
  async function writeImage(image) {
62
- await invoke("plugin:clipboard-manager|write_image", {
63
- image: transformImage(image),
67
+ await invoke('plugin:clipboard-manager|write_image', {
68
+ image: transformImage(image)
64
69
  });
65
70
  }
66
71
  /**
67
72
  * Gets the clipboard content as Uint8Array image.
73
+ *
74
+ * #### Platform-specific
75
+ *
76
+ * - **Android / iOS:** Not supported.
77
+ *
68
78
  * @example
69
79
  * ```typescript
70
80
  * import { readImage } from '@tauri-apps/plugin-clipboard-manager';
@@ -76,10 +86,15 @@ async function writeImage(image) {
76
86
  * @since 2.0.0
77
87
  */
78
88
  async function readImage() {
79
- return await invoke("plugin:clipboard-manager|read_image").then((rid) => new Image(rid));
89
+ return await invoke('plugin:clipboard-manager|read_image').then((rid) => new Image(rid));
80
90
  }
81
91
  /**
82
92
  * * Writes HTML or fallbacks to write provided plain text to the clipboard.
93
+ *
94
+ * #### Platform-specific
95
+ *
96
+ * - **Android / iOS:** Not supported.
97
+ *
83
98
  * @example
84
99
  * ```typescript
85
100
  * import { writeHtml, readHtml } from '@tauri-apps/plugin-clipboard-manager';
@@ -93,13 +108,18 @@ async function readImage() {
93
108
  * @since 2.0.0
94
109
  */
95
110
  async function writeHtml(html, altHtml) {
96
- await invoke("plugin:clipboard-manager|write_html", {
111
+ await invoke('plugin:clipboard-manager|write_html', {
97
112
  html,
98
- altHtml,
113
+ altHtml
99
114
  });
100
115
  }
101
116
  /**
102
117
  * Clears the clipboard.
118
+ *
119
+ * #### Platform-specific
120
+ *
121
+ * - **Android:** Only supported on SDK 28+. For older releases we write an empty string to the clipboard instead.
122
+ *
103
123
  * @example
104
124
  * ```typescript
105
125
  * import { clear } from '@tauri-apps/plugin-clipboard-manager';
@@ -108,7 +128,7 @@ async function writeHtml(html, altHtml) {
108
128
  * @since 2.0.0
109
129
  */
110
130
  async function clear() {
111
- await invoke("plugin:clipboard-manager|clear");
131
+ await invoke('plugin:clipboard-manager|clear');
112
132
  }
113
133
 
114
134
  export { clear, readImage, readText, writeHtml, writeImage, writeText };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tauri-apps/plugin-clipboard-manager",
3
- "version": "2.0.0-rc.1",
4
- "license": "MIT or APACHE-2.0",
3
+ "version": "2.0.0",
4
+ "license": "MIT OR Apache-2.0",
5
5
  "authors": [
6
6
  "Tauri Programme within The Commons Conservancy"
7
7
  ],
@@ -24,6 +24,6 @@
24
24
  "LICENSE"
25
25
  ],
26
26
  "dependencies": {
27
- "@tauri-apps/api": "^2.0.0-rc.4"
27
+ "@tauri-apps/api": "^2.0.0"
28
28
  }
29
29
  }