d2coreui 21.0.24 → 21.0.25
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.
|
@@ -1,6 +1,23 @@
|
|
|
1
1
|
export class ClipboardUtils {
|
|
2
2
|
static copyToClipboard(text) {
|
|
3
|
-
|
|
3
|
+
if (document.queryCommandSupported && document.queryCommandSupported("copy")) {
|
|
4
|
+
var textarea = document.createElement("textarea");
|
|
5
|
+
textarea.textContent = text;
|
|
6
|
+
textarea.style.position = "fixed";
|
|
7
|
+
document.body.appendChild(textarea);
|
|
8
|
+
textarea.select();
|
|
9
|
+
try {
|
|
10
|
+
return document.execCommand("copy");
|
|
11
|
+
}
|
|
12
|
+
catch (ex) {
|
|
13
|
+
console.warn("Copy to clipboard failed.", ex);
|
|
14
|
+
return false;
|
|
15
|
+
}
|
|
16
|
+
finally {
|
|
17
|
+
document.body.removeChild(textarea);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
4
21
|
}
|
|
5
22
|
}
|
|
6
23
|
//# sourceMappingURL=clipboardUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clipboardUtils.js","sourceRoot":"","sources":["../../../../components/clipboard/clipboardUtils.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IAQvB,MAAM,CAAC,eAAe,CAAC,IAAY;QAC/B,
|
|
1
|
+
{"version":3,"file":"clipboardUtils.js","sourceRoot":"","sources":["../../../../components/clipboard/clipboardUtils.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,cAAc;IAQvB,MAAM,CAAC,eAAe,CAAC,IAAY;QAC/B,IAAI,QAAQ,CAAC,qBAAqB,IAAI,QAAQ,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YAC1E,IAAI,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;YAClD,QAAQ,CAAC,WAAW,GAAG,IAAI,CAAC;YAC5B,QAAQ,CAAC,KAAK,CAAC,QAAQ,GAAG,OAAO,CAAC;YAClC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;YACpC,QAAQ,CAAC,MAAM,EAAE,CAAC;YAClB,IAAI;gBACA,OAAO,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;aACvC;YAAC,OAAO,EAAE,EAAE;gBACT,OAAO,CAAC,IAAI,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC;gBAC9C,OAAO,KAAK,CAAC;aAChB;oBAAS;gBACN,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;aACvC;SACJ;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ","sourcesContent":["export class ClipboardUtils {\n // Copies a string to the clipboard. Must be called from within an\n // event handler such as click. May return false if it failed, but\n // this is not always possible. Browser support for Chrome 43+,\n // Firefox 42+, Safari 10+, Edge and IE 10+.\n // IE: The clipboard feature may be disabled by an administrator. By\n // default a prompt is shown the first time the clipboard is\n // used (per session).\n static copyToClipboard(text: string): boolean {\n if (document.queryCommandSupported && document.queryCommandSupported(\"copy\")) {\n var textarea = document.createElement(\"textarea\");\n textarea.textContent = text;\n textarea.style.position = \"fixed\"; // Prevent scrolling to bottom of page in MS Edge.\n document.body.appendChild(textarea);\n textarea.select();\n try {\n return document.execCommand(\"copy\"); // Security exception may be thrown by some browsers.\n } catch (ex) {\n console.warn(\"Copy to clipboard failed.\", ex);\n return false;\n } finally {\n document.body.removeChild(textarea);\n }\n }\n return false;\n }\n}"]}
|