@react-native-ohos/clipboard 1.13.3-rc.1 → 1.13.3-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/dist/Clipboard.d.ts +159 -159
- package/dist/Clipboard.js +242 -232
- package/dist/index.d.ts +3 -3
- package/dist/index.js +7 -7
- package/harmony/clipboard/oh-package.json5 +1 -1
- package/harmony/clipboard.har +0 -0
- package/package.json +2 -2
package/dist/Clipboard.d.ts
CHANGED
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
import { EmitterSubscription } from 'react-native';
|
|
2
|
-
/**
|
|
3
|
-
* `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
|
|
4
|
-
*/
|
|
5
|
-
export declare const Clipboard: {
|
|
6
|
-
/**
|
|
7
|
-
* Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
8
|
-
* ```javascript
|
|
9
|
-
* async _getContent() {
|
|
10
|
-
* var content = await Clipboard.getString();
|
|
11
|
-
* }
|
|
12
|
-
* ```
|
|
13
|
-
*/
|
|
14
|
-
getString(): Promise<string>;
|
|
15
|
-
/**
|
|
16
|
-
* (iOS Only)
|
|
17
|
-
* Get contents of string array type, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
18
|
-
* ```javascript
|
|
19
|
-
* async _getContent() {
|
|
20
|
-
* var content = await Clipboard.getStrings();
|
|
21
|
-
* }
|
|
22
|
-
* ```
|
|
23
|
-
*/
|
|
24
|
-
getStrings(): Promise<string[]>;
|
|
25
|
-
/**
|
|
26
|
-
* Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
27
|
-
* ```javascript
|
|
28
|
-
* async _getContent() {
|
|
29
|
-
* var content = await Clipboard.getImagePNG();
|
|
30
|
-
* }
|
|
31
|
-
* ```
|
|
32
|
-
*/
|
|
33
|
-
getImagePNG(): Promise<string>;
|
|
34
|
-
/**
|
|
35
|
-
* Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
36
|
-
* ```javascript
|
|
37
|
-
* async _getContent() {
|
|
38
|
-
* var content = await Clipboard.getImageJPG();
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
getImageJPG(): Promise<string>;
|
|
43
|
-
/**
|
|
44
|
-
* (iOS Only)
|
|
45
|
-
* Set content of base64 image type. You can use following code to set clipboard content
|
|
46
|
-
* ```javascript
|
|
47
|
-
* _setContent() {
|
|
48
|
-
* Clipboard.setImage(...);
|
|
49
|
-
* }
|
|
50
|
-
* ```
|
|
51
|
-
* @param the content to be stored in the clipboard.
|
|
52
|
-
*/
|
|
53
|
-
setImage(content: string): void;
|
|
54
|
-
/**
|
|
55
|
-
* (Android Only)
|
|
56
|
-
* Get clipboard image in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
57
|
-
* ```javascript
|
|
58
|
-
* async _getContent() {
|
|
59
|
-
* var content = await Clipboard.getImage();
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
getImage(): Promise<string>;
|
|
64
|
-
/**
|
|
65
|
-
* Set content of string type. You can use following code to set clipboard content
|
|
66
|
-
* ```javascript
|
|
67
|
-
* _setContent() {
|
|
68
|
-
* Clipboard.setString('hello world');
|
|
69
|
-
* }
|
|
70
|
-
* ```
|
|
71
|
-
* @param the content to be stored in the clipboard.
|
|
72
|
-
*/
|
|
73
|
-
setString(content: string): void;
|
|
74
|
-
/**
|
|
75
|
-
* Set content of string array type. You can use following code to set clipboard content
|
|
76
|
-
* ```javascript
|
|
77
|
-
* _setContent() {
|
|
78
|
-
* Clipboard.setStrings(['hello world', 'second string']);
|
|
79
|
-
* }
|
|
80
|
-
* ```
|
|
81
|
-
* @param the content to be stored in the clipboard.
|
|
82
|
-
*/
|
|
83
|
-
setStrings(content: string[]): void;
|
|
84
|
-
/**
|
|
85
|
-
* Returns whether the clipboard has content or is empty.
|
|
86
|
-
* This method returns a `Promise`, so you can use following code to get clipboard content
|
|
87
|
-
* ```javascript
|
|
88
|
-
* async _hasContent() {
|
|
89
|
-
* var hasContent = await Clipboard.hasString();
|
|
90
|
-
* }
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
hasString():
|
|
94
|
-
/**
|
|
95
|
-
* Returns whether the clipboard has an image or is empty.
|
|
96
|
-
* This method returns a `Promise`, so you can use following code to check clipboard content
|
|
97
|
-
* ```javascript
|
|
98
|
-
* async _hasContent() {
|
|
99
|
-
* var hasContent = await Clipboard.hasImage();
|
|
100
|
-
* }
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
hasImage():
|
|
104
|
-
/**
|
|
105
|
-
* (iOS Only)
|
|
106
|
-
* Returns whether the clipboard has a URL content. Can check
|
|
107
|
-
* if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
108
|
-
* This method returns a `Promise`, so you can use following code to check for url content in clipboard.
|
|
109
|
-
* ```javascript
|
|
110
|
-
* async _hasURL() {
|
|
111
|
-
* var hasURL = await Clipboard.hasURL();
|
|
112
|
-
* }
|
|
113
|
-
* ```
|
|
114
|
-
*/
|
|
115
|
-
hasURL():
|
|
116
|
-
/**
|
|
117
|
-
* (iOS 14+ Only)
|
|
118
|
-
* Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check
|
|
119
|
-
* if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
120
|
-
* This method returns a `Promise`, so you can use following code to check for Number content in clipboard.
|
|
121
|
-
* ```javascript
|
|
122
|
-
* async _hasNumber() {
|
|
123
|
-
* var hasNumber = await Clipboard.hasNumber();
|
|
124
|
-
* }
|
|
125
|
-
* ```
|
|
126
|
-
*/
|
|
127
|
-
hasNumber():
|
|
128
|
-
/**
|
|
129
|
-
* (iOS 14+ Only)
|
|
130
|
-
* Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check
|
|
131
|
-
* if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
132
|
-
* This method returns a `Promise`, so you can use following code to check for WebURL content in clipboard.
|
|
133
|
-
* ```javascript
|
|
134
|
-
* async _hasWebURL() {
|
|
135
|
-
* var hasWebURL = await Clipboard.hasWebURL();
|
|
136
|
-
* }
|
|
137
|
-
* ```
|
|
138
|
-
*/
|
|
139
|
-
hasWebURL():
|
|
140
|
-
/**
|
|
141
|
-
* (iOS and Android Only)
|
|
142
|
-
* Adds a listener to get notifications when the clipboard has changed.
|
|
143
|
-
* If this is the first listener, turns on clipboard notifications on the native side.
|
|
144
|
-
* It returns EmitterSubscription where you can call "remove" to remove listener
|
|
145
|
-
* ```javascript
|
|
146
|
-
* const listener = () => console.log("changed!");
|
|
147
|
-
* Clipboard.addListener(listener);
|
|
148
|
-
* ```
|
|
149
|
-
*/
|
|
150
|
-
addListener(callback: () => void): EmitterSubscription;
|
|
151
|
-
/**
|
|
152
|
-
* (iOS and Android Only)
|
|
153
|
-
* Removes all previously registered listeners and turns off notifications on the native side.
|
|
154
|
-
* ```javascript
|
|
155
|
-
* Clipboard.removeAllListeners();
|
|
156
|
-
* ```
|
|
157
|
-
*/
|
|
158
|
-
removeAllListeners(): void;
|
|
159
|
-
};
|
|
1
|
+
import { EmitterSubscription } from 'react-native';
|
|
2
|
+
/**
|
|
3
|
+
* `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
|
|
4
|
+
*/
|
|
5
|
+
export declare const Clipboard: {
|
|
6
|
+
/**
|
|
7
|
+
* Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
8
|
+
* ```javascript
|
|
9
|
+
* async _getContent() {
|
|
10
|
+
* var content = await Clipboard.getString();
|
|
11
|
+
* }
|
|
12
|
+
* ```
|
|
13
|
+
*/
|
|
14
|
+
getString(): Promise<string>;
|
|
15
|
+
/**
|
|
16
|
+
* (iOS Only)
|
|
17
|
+
* Get contents of string array type, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
18
|
+
* ```javascript
|
|
19
|
+
* async _getContent() {
|
|
20
|
+
* var content = await Clipboard.getStrings();
|
|
21
|
+
* }
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
getStrings(): Promise<string[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
27
|
+
* ```javascript
|
|
28
|
+
* async _getContent() {
|
|
29
|
+
* var content = await Clipboard.getImagePNG();
|
|
30
|
+
* }
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
getImagePNG(): Promise<string>;
|
|
34
|
+
/**
|
|
35
|
+
* Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
36
|
+
* ```javascript
|
|
37
|
+
* async _getContent() {
|
|
38
|
+
* var content = await Clipboard.getImageJPG();
|
|
39
|
+
* }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
getImageJPG(): Promise<string>;
|
|
43
|
+
/**
|
|
44
|
+
* (iOS Only)
|
|
45
|
+
* Set content of base64 image type. You can use following code to set clipboard content
|
|
46
|
+
* ```javascript
|
|
47
|
+
* _setContent() {
|
|
48
|
+
* Clipboard.setImage(...);
|
|
49
|
+
* }
|
|
50
|
+
* ```
|
|
51
|
+
* @param the content to be stored in the clipboard.
|
|
52
|
+
*/
|
|
53
|
+
setImage(content: string): void;
|
|
54
|
+
/**
|
|
55
|
+
* (Android Only)
|
|
56
|
+
* Get clipboard image in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
57
|
+
* ```javascript
|
|
58
|
+
* async _getContent() {
|
|
59
|
+
* var content = await Clipboard.getImage();
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
getImage(): Promise<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Set content of string type. You can use following code to set clipboard content
|
|
66
|
+
* ```javascript
|
|
67
|
+
* _setContent() {
|
|
68
|
+
* Clipboard.setString('hello world');
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
* @param the content to be stored in the clipboard.
|
|
72
|
+
*/
|
|
73
|
+
setString(content: string): void;
|
|
74
|
+
/**
|
|
75
|
+
* Set content of string array type. You can use following code to set clipboard content
|
|
76
|
+
* ```javascript
|
|
77
|
+
* _setContent() {
|
|
78
|
+
* Clipboard.setStrings(['hello world', 'second string']);
|
|
79
|
+
* }
|
|
80
|
+
* ```
|
|
81
|
+
* @param the content to be stored in the clipboard.
|
|
82
|
+
*/
|
|
83
|
+
setStrings(content: string[]): void;
|
|
84
|
+
/**
|
|
85
|
+
* Returns whether the clipboard has content or is empty.
|
|
86
|
+
* This method returns a `Promise`, so you can use following code to get clipboard content
|
|
87
|
+
* ```javascript
|
|
88
|
+
* async _hasContent() {
|
|
89
|
+
* var hasContent = await Clipboard.hasString();
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
hasString(): any;
|
|
94
|
+
/**
|
|
95
|
+
* Returns whether the clipboard has an image or is empty.
|
|
96
|
+
* This method returns a `Promise`, so you can use following code to check clipboard content
|
|
97
|
+
* ```javascript
|
|
98
|
+
* async _hasContent() {
|
|
99
|
+
* var hasContent = await Clipboard.hasImage();
|
|
100
|
+
* }
|
|
101
|
+
* ```
|
|
102
|
+
*/
|
|
103
|
+
hasImage(): any;
|
|
104
|
+
/**
|
|
105
|
+
* (iOS Only)
|
|
106
|
+
* Returns whether the clipboard has a URL content. Can check
|
|
107
|
+
* if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
108
|
+
* This method returns a `Promise`, so you can use following code to check for url content in clipboard.
|
|
109
|
+
* ```javascript
|
|
110
|
+
* async _hasURL() {
|
|
111
|
+
* var hasURL = await Clipboard.hasURL();
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
hasURL(): any;
|
|
116
|
+
/**
|
|
117
|
+
* (iOS 14+ Only)
|
|
118
|
+
* Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check
|
|
119
|
+
* if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
120
|
+
* This method returns a `Promise`, so you can use following code to check for Number content in clipboard.
|
|
121
|
+
* ```javascript
|
|
122
|
+
* async _hasNumber() {
|
|
123
|
+
* var hasNumber = await Clipboard.hasNumber();
|
|
124
|
+
* }
|
|
125
|
+
* ```
|
|
126
|
+
*/
|
|
127
|
+
hasNumber(): any;
|
|
128
|
+
/**
|
|
129
|
+
* (iOS 14+ Only)
|
|
130
|
+
* Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check
|
|
131
|
+
* if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
132
|
+
* This method returns a `Promise`, so you can use following code to check for WebURL content in clipboard.
|
|
133
|
+
* ```javascript
|
|
134
|
+
* async _hasWebURL() {
|
|
135
|
+
* var hasWebURL = await Clipboard.hasWebURL();
|
|
136
|
+
* }
|
|
137
|
+
* ```
|
|
138
|
+
*/
|
|
139
|
+
hasWebURL(): any;
|
|
140
|
+
/**
|
|
141
|
+
* (iOS and Android Only)
|
|
142
|
+
* Adds a listener to get notifications when the clipboard has changed.
|
|
143
|
+
* If this is the first listener, turns on clipboard notifications on the native side.
|
|
144
|
+
* It returns EmitterSubscription where you can call "remove" to remove listener
|
|
145
|
+
* ```javascript
|
|
146
|
+
* const listener = () => console.log("changed!");
|
|
147
|
+
* Clipboard.addListener(listener);
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
addListener(callback: () => void): EmitterSubscription;
|
|
151
|
+
/**
|
|
152
|
+
* (iOS and Android Only)
|
|
153
|
+
* Removes all previously registered listeners and turns off notifications on the native side.
|
|
154
|
+
* ```javascript
|
|
155
|
+
* Clipboard.removeAllListeners();
|
|
156
|
+
* ```
|
|
157
|
+
*/
|
|
158
|
+
removeAllListeners(): void;
|
|
159
|
+
};
|
package/dist/Clipboard.js
CHANGED
|
@@ -1,232 +1,242 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
*
|
|
69
|
-
*
|
|
70
|
-
*
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
83
|
-
*
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
*
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
*
|
|
121
|
-
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
124
|
-
*
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
*
|
|
159
|
-
*
|
|
160
|
-
* ```
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
*
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
*
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
*
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
* Clipboard.
|
|
227
|
-
* ```
|
|
228
|
-
*/
|
|
229
|
-
|
|
230
|
-
(0, NativeClipboardModule_1.
|
|
231
|
-
},
|
|
232
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.Clipboard = void 0;
|
|
37
|
+
var react_native_1 = require("react-native");
|
|
38
|
+
var NativeClipboardModule_1 = __importStar(require("@react-native-clipboard/clipboard/src/NativeClipboardModule"));
|
|
39
|
+
/**
|
|
40
|
+
* `Clipboard` gives you an interface for setting and getting content from Clipboard on both iOS and Android
|
|
41
|
+
*/
|
|
42
|
+
exports.Clipboard = {
|
|
43
|
+
/**
|
|
44
|
+
* Get content of string type, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
45
|
+
* ```javascript
|
|
46
|
+
* async _getContent() {
|
|
47
|
+
* var content = await Clipboard.getString();
|
|
48
|
+
* }
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
getString: function () {
|
|
52
|
+
return NativeClipboardModule_1.default.getString();
|
|
53
|
+
},
|
|
54
|
+
/**
|
|
55
|
+
* (iOS Only)
|
|
56
|
+
* Get contents of string array type, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
57
|
+
* ```javascript
|
|
58
|
+
* async _getContent() {
|
|
59
|
+
* var content = await Clipboard.getStrings();
|
|
60
|
+
* }
|
|
61
|
+
* ```
|
|
62
|
+
*/
|
|
63
|
+
getStrings: function () {
|
|
64
|
+
return NativeClipboardModule_1.default.getStrings();
|
|
65
|
+
},
|
|
66
|
+
/**
|
|
67
|
+
* Get clipboard image as PNG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
68
|
+
* ```javascript
|
|
69
|
+
* async _getContent() {
|
|
70
|
+
* var content = await Clipboard.getImagePNG();
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
getImagePNG: function () {
|
|
75
|
+
return NativeClipboardModule_1.default.getImagePNG();
|
|
76
|
+
},
|
|
77
|
+
/**
|
|
78
|
+
* Get clipboard image as JPG in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
79
|
+
* ```javascript
|
|
80
|
+
* async _getContent() {
|
|
81
|
+
* var content = await Clipboard.getImageJPG();
|
|
82
|
+
* }
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
getImageJPG: function () {
|
|
86
|
+
return NativeClipboardModule_1.default.getImageJPG();
|
|
87
|
+
},
|
|
88
|
+
/**
|
|
89
|
+
* (iOS Only)
|
|
90
|
+
* Set content of base64 image type. You can use following code to set clipboard content
|
|
91
|
+
* ```javascript
|
|
92
|
+
* _setContent() {
|
|
93
|
+
* Clipboard.setImage(...);
|
|
94
|
+
* }
|
|
95
|
+
* ```
|
|
96
|
+
* @param the content to be stored in the clipboard.
|
|
97
|
+
*/
|
|
98
|
+
setImage: function (content) {
|
|
99
|
+
// @ts-ignore
|
|
100
|
+
if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
|
|
101
|
+
NativeClipboardModule_1.default.setImage(content);
|
|
102
|
+
}
|
|
103
|
+
return;
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* (Android Only)
|
|
107
|
+
* Get clipboard image in base64, this method returns a `Promise`, so you can use following code to get clipboard content
|
|
108
|
+
* ```javascript
|
|
109
|
+
* async _getContent() {
|
|
110
|
+
* var content = await Clipboard.getImage();
|
|
111
|
+
* }
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
getImage: function () {
|
|
115
|
+
return NativeClipboardModule_1.default.getImage();
|
|
116
|
+
},
|
|
117
|
+
/**
|
|
118
|
+
* Set content of string type. You can use following code to set clipboard content
|
|
119
|
+
* ```javascript
|
|
120
|
+
* _setContent() {
|
|
121
|
+
* Clipboard.setString('hello world');
|
|
122
|
+
* }
|
|
123
|
+
* ```
|
|
124
|
+
* @param the content to be stored in the clipboard.
|
|
125
|
+
*/
|
|
126
|
+
setString: function (content) {
|
|
127
|
+
NativeClipboardModule_1.default.setString(content);
|
|
128
|
+
},
|
|
129
|
+
/**
|
|
130
|
+
* Set content of string array type. You can use following code to set clipboard content
|
|
131
|
+
* ```javascript
|
|
132
|
+
* _setContent() {
|
|
133
|
+
* Clipboard.setStrings(['hello world', 'second string']);
|
|
134
|
+
* }
|
|
135
|
+
* ```
|
|
136
|
+
* @param the content to be stored in the clipboard.
|
|
137
|
+
*/
|
|
138
|
+
setStrings: function (content) {
|
|
139
|
+
NativeClipboardModule_1.default.setStrings(content);
|
|
140
|
+
},
|
|
141
|
+
/**
|
|
142
|
+
* Returns whether the clipboard has content or is empty.
|
|
143
|
+
* This method returns a `Promise`, so you can use following code to get clipboard content
|
|
144
|
+
* ```javascript
|
|
145
|
+
* async _hasContent() {
|
|
146
|
+
* var hasContent = await Clipboard.hasString();
|
|
147
|
+
* }
|
|
148
|
+
* ```
|
|
149
|
+
*/
|
|
150
|
+
hasString: function () {
|
|
151
|
+
return NativeClipboardModule_1.default.hasString();
|
|
152
|
+
},
|
|
153
|
+
/**
|
|
154
|
+
* Returns whether the clipboard has an image or is empty.
|
|
155
|
+
* This method returns a `Promise`, so you can use following code to check clipboard content
|
|
156
|
+
* ```javascript
|
|
157
|
+
* async _hasContent() {
|
|
158
|
+
* var hasContent = await Clipboard.hasImage();
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
hasImage: function () {
|
|
163
|
+
return NativeClipboardModule_1.default.hasImage();
|
|
164
|
+
},
|
|
165
|
+
/**
|
|
166
|
+
* (iOS Only)
|
|
167
|
+
* Returns whether the clipboard has a URL content. Can check
|
|
168
|
+
* if there is a URL content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
169
|
+
* This method returns a `Promise`, so you can use following code to check for url content in clipboard.
|
|
170
|
+
* ```javascript
|
|
171
|
+
* async _hasURL() {
|
|
172
|
+
* var hasURL = await Clipboard.hasURL();
|
|
173
|
+
* }
|
|
174
|
+
* ```
|
|
175
|
+
*/
|
|
176
|
+
hasURL: function () {
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
|
|
179
|
+
return NativeClipboardModule_1.default.hasURL();
|
|
180
|
+
}
|
|
181
|
+
return;
|
|
182
|
+
},
|
|
183
|
+
/**
|
|
184
|
+
* (iOS 14+ Only)
|
|
185
|
+
* Returns whether the clipboard has a Number(UIPasteboardDetectionPatternNumber) content. Can check
|
|
186
|
+
* if there is a Number content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
187
|
+
* This method returns a `Promise`, so you can use following code to check for Number content in clipboard.
|
|
188
|
+
* ```javascript
|
|
189
|
+
* async _hasNumber() {
|
|
190
|
+
* var hasNumber = await Clipboard.hasNumber();
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
hasNumber: function () {
|
|
195
|
+
// @ts-ignore
|
|
196
|
+
if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
|
|
197
|
+
return NativeClipboardModule_1.default.hasNumber();
|
|
198
|
+
}
|
|
199
|
+
return;
|
|
200
|
+
},
|
|
201
|
+
/**
|
|
202
|
+
* (iOS 14+ Only)
|
|
203
|
+
* Returns whether the clipboard has a WebURL(UIPasteboardDetectionPatternProbableWebURL) content. Can check
|
|
204
|
+
* if there is a WebURL content in clipboard without triggering PasteBoard notification for iOS 14+
|
|
205
|
+
* This method returns a `Promise`, so you can use following code to check for WebURL content in clipboard.
|
|
206
|
+
* ```javascript
|
|
207
|
+
* async _hasWebURL() {
|
|
208
|
+
* var hasWebURL = await Clipboard.hasWebURL();
|
|
209
|
+
* }
|
|
210
|
+
* ```
|
|
211
|
+
*/
|
|
212
|
+
hasWebURL: function () {
|
|
213
|
+
// @ts-ignore
|
|
214
|
+
if (react_native_1.Platform.OS == 'ios' || react_native_1.Platform.OS == 'harmony') {
|
|
215
|
+
return NativeClipboardModule_1.default.hasWebURL();
|
|
216
|
+
}
|
|
217
|
+
return;
|
|
218
|
+
},
|
|
219
|
+
/**
|
|
220
|
+
* (iOS and Android Only)
|
|
221
|
+
* Adds a listener to get notifications when the clipboard has changed.
|
|
222
|
+
* If this is the first listener, turns on clipboard notifications on the native side.
|
|
223
|
+
* It returns EmitterSubscription where you can call "remove" to remove listener
|
|
224
|
+
* ```javascript
|
|
225
|
+
* const listener = () => console.log("changed!");
|
|
226
|
+
* Clipboard.addListener(listener);
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
addListener: function (callback) {
|
|
230
|
+
return (0, NativeClipboardModule_1.addListener)(callback);
|
|
231
|
+
},
|
|
232
|
+
/**
|
|
233
|
+
* (iOS and Android Only)
|
|
234
|
+
* Removes all previously registered listeners and turns off notifications on the native side.
|
|
235
|
+
* ```javascript
|
|
236
|
+
* Clipboard.removeAllListeners();
|
|
237
|
+
* ```
|
|
238
|
+
*/
|
|
239
|
+
removeAllListeners: function () {
|
|
240
|
+
(0, NativeClipboardModule_1.removeAllListeners)();
|
|
241
|
+
},
|
|
242
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Clipboard } from './Clipboard';
|
|
2
|
-
export { useClipboard } from '@react-native-clipboard/clipboard/src/useClipboard';
|
|
3
|
-
export default Clipboard;
|
|
1
|
+
import { Clipboard } from './Clipboard';
|
|
2
|
+
export { useClipboard } from '@react-native-clipboard/clipboard/src/useClipboard';
|
|
3
|
+
export default Clipboard;
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.useClipboard = void 0;
|
|
4
|
-
var Clipboard_1 = require("./Clipboard");
|
|
5
|
-
var useClipboard_1 = require("@react-native-clipboard/clipboard/src/useClipboard");
|
|
6
|
-
Object.defineProperty(exports, "useClipboard", { enumerable: true, get: function () { return useClipboard_1.useClipboard; } });
|
|
7
|
-
exports.default = Clipboard_1.Clipboard;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useClipboard = void 0;
|
|
4
|
+
var Clipboard_1 = require("./Clipboard");
|
|
5
|
+
var useClipboard_1 = require("@react-native-clipboard/clipboard/src/useClipboard");
|
|
6
|
+
Object.defineProperty(exports, "useClipboard", { enumerable: true, get: function () { return useClipboard_1.useClipboard; } });
|
|
7
|
+
exports.default = Clipboard_1.Clipboard;
|
package/harmony/clipboard.har
CHANGED
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-ohos/clipboard",
|
|
3
|
-
"version": "1.13.3-rc.
|
|
3
|
+
"version": "1.13.3-rc.2",
|
|
4
4
|
"description": "React Native Clipboard API",
|
|
5
5
|
"harmony": {
|
|
6
|
-
"alias": "react-native-clipboard/clipboard",
|
|
6
|
+
"alias": "@react-native-clipboard/clipboard",
|
|
7
7
|
"autolinking": {
|
|
8
8
|
"etsPackageClassName": "ClipboardPackage",
|
|
9
9
|
"cppPackageClassName": "ClipboardPackage",
|