hylid-bridge 4.0.28-alpha.2 → 4.0.28
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/lib/common/apis/custom/web/h5/setClipboard.js +35 -2
- package/lib/umd/index.js +1 -1
- package/lib/umd/mp_web_alipay.js +1 -1
- package/lib/umd/mp_web_mpay.js +1 -1
- package/lib/umd/web_alipay.js +1 -1
- package/lib/umd/web_alipayhk.js +1 -1
- package/lib/umd/web_demo.js +1 -1
- package/lib/umd/web_h5.js +1 -1
- package/lib/umd/web_tngdh5ng.js +1 -1
- package/package.json +7 -7
|
@@ -1,4 +1,37 @@
|
|
|
1
|
-
|
|
1
|
+
function _setClipboard(options) {
|
|
2
|
+
var _a, _b, _c, _d, _e, _f;
|
|
3
|
+
if (!options.text) {
|
|
4
|
+
(_a = options.fail) === null || _a === void 0 ? void 0 : _a.call(options);
|
|
5
|
+
(_b = options.complete) === null || _b === void 0 ? void 0 : _b.call(options, {
|
|
6
|
+
success: false
|
|
7
|
+
});
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
var input = document.createElement('input');
|
|
11
|
+
input.style.position = 'fixed';
|
|
12
|
+
input.style.opacity = '0';
|
|
13
|
+
input.style.zIndex = '-1000';
|
|
14
|
+
document.body.appendChild(input);
|
|
15
|
+
input.setAttribute('readonly', 'readonly');
|
|
16
|
+
input.setAttribute('value', options.text);
|
|
17
|
+
input.setSelectionRange(0, options.text.length);
|
|
18
|
+
input.focus();
|
|
19
|
+
input.select();
|
|
20
|
+
if (document.execCommand('copy')) {
|
|
21
|
+
(_c = options.success) === null || _c === void 0 ? void 0 : _c.call(options, {
|
|
22
|
+
success: true
|
|
23
|
+
});
|
|
24
|
+
(_d = options.complete) === null || _d === void 0 ? void 0 : _d.call(options, {
|
|
25
|
+
success: true
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
(_e = options.fail) === null || _e === void 0 ? void 0 : _e.call(options);
|
|
29
|
+
(_f = options.complete) === null || _f === void 0 ? void 0 : _f.call(options, {
|
|
30
|
+
success: false
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
document.body.removeChild(input);
|
|
34
|
+
}
|
|
2
35
|
export default function setClipboard(options) {
|
|
3
|
-
return
|
|
36
|
+
return _setClipboard(options);
|
|
4
37
|
}
|